Skip to content

Commit

Permalink
Fix first comment in mobile view with french locale
Browse files Browse the repository at this point in the history
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.

closes diaspora#7441
  • Loading branch information
svbergerem authored and frankrousseau committed May 21, 2017
1 parent e48b0d5 commit a811eec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

## Bug fixes
* Make photo upload button hover text translatable [#7429](https://github.com/diaspora/diaspora/pull/7429)
* Fix first comment in mobile view with french locale [#7441](https://github.com/diaspora/diaspora/pull/7441)

## Features

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/mobile/mobile_comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
increaseReactionCount: function(bottomBar) {
var toggleReactionsLink = bottomBar.find(".show-comments").first();
var count = toggleReactionsLink.text().match(/.*(\d+).*/);
count = parseInt(count, 10);
count = parseInt(count, 10) || 0;
var text = Diaspora.I18n.t("stream.comments", {count: count + 1});

// No previous comment
Expand Down
14 changes: 13 additions & 1 deletion spec/javascripts/mobile/mobile_comments_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe("Diaspora.Mobile.Comments", function(){
expect(this.toggleReactionsLink.text().trim()).toBe("6 comments");
});

it("Creates the reaction link when no reactions", function(){
it("Creates the reaction link when there are no reactions", function() {
var parent = this.toggleReactionsLink.parent();
var postGuid = this.bottomBar.parents(".stream-element").data("guid");
this.toggleReactionsLink.remove();
Expand All @@ -155,6 +155,18 @@ describe("Diaspora.Mobile.Comments", function(){
expect(this.toggleReactionsLink.text().trim()).toBe("1 comment");
expect(this.toggleReactionsLink.attr("href")).toBe("/posts/" + postGuid + "/comments.mobile");
});

it("Creates the reaction link when there are no reactions (french locale)", function() {
var parent = this.toggleReactionsLink.parent();
var postGuid = this.bottomBar.parents(".stream-element").data("guid");
this.toggleReactionsLink.remove();
parent.prepend($("<span/>", {"class": "show-comments"}).text("Aucun commentaire"));

Diaspora.Mobile.Comments.increaseReactionCount(this.bottomBar);
this.toggleReactionsLink = this.bottomBar.find(".show-comments").first();
expect(this.toggleReactionsLink.text().trim()).toBe("1 comment");
expect(this.toggleReactionsLink.attr("href")).toBe("/posts/" + postGuid + "/comments.mobile");
});
});

describe("bottomBarLazy", function(){
Expand Down

0 comments on commit a811eec

Please sign in to comment.