-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Conversation
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207.
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"); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Merged as fc28d6a Thank you 🍪 |
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207. closes diaspora#7441
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207. closes diaspora#7441
Fixes diaspora#7438. The regression has possibly been introduced by diaspora#7207. closes diaspora#7441
Fixes #7438. The regression has possibly been introduced by #7207.