Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix first comment in mobile view with french locale #7441

Closed

Conversation

svbergerem
Copy link
Member

Fixes #7438. The regression has possibly been introduced by #7207.

Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.
@SuperTux88 SuperTux88 added this to the 0.6.6.0 milestone May 3, 2017
@SuperTux88
Copy link
Member

Ah, I only tested with a post where already were comments ... that explains why I wasn't able to reproduce this ;)


Diaspora.Mobile.Comments.increaseReactionCount(this.bottomBar);
this.toggleReactionsLink = this.bottomBar.find(".show-comments").first();
expect(this.toggleReactionsLink.text().trim()).toBe("1 comment");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the local is set to french, this should be "1 commentaire" I guess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The locale is not set to french. I just used the "0 comments" translation from the french locale because that caused the problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it, if you manually set the text, how does that test anything?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changing the comments count tries to get the number from the bottom bar, increases the number and sets the new text afterwards. In the English locale the text is “0 comments”, so it finds the “0” and is able to parse and increase it. For the French locale you have “Aucun commentaire”, so finding the number and parsing it failed. This PR changes the code to use 0 if it's unable to find a number.

To test the correct behavior I have to set some text that doesn't contain a number and since the issue has been reported for the French locale I used “Aucun commentaire”. Without the change in app/assets/javascripts/mobile/mobile_comments.js the test fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we preload the number (with gon?) instead of parsing the text representation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, okay. Yeah, parsing the interface feels a bit hackish.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do lots of things that would include bigger refactorings. ;) This is just a quickfix for the (hackish) implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then perhaps it would be nice to create a tracking issue for this hack refactoring, if there isn't one yet.

@SuperTux88 SuperTux88 closed this in fc28d6a May 5, 2017
@SuperTux88
Copy link
Member

Merged as fc28d6a

Thank you 🍪

@svbergerem svbergerem deleted the fix-french-mobile-comments branch May 5, 2017 04:59
frankrousseau pushed a commit to frankrousseau/diaspora that referenced this pull request May 20, 2017
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.

closes diaspora#7441
frankrousseau pushed a commit to frankrousseau/diaspora that referenced this pull request May 21, 2017
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.

closes diaspora#7441
frankrousseau pushed a commit to frankrousseau/diaspora that referenced this pull request May 21, 2017
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.

closes diaspora#7441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants