Inconsistency in code for watching first post

(Joshua Rosenfeld) #1

After submitting this PR I discovered an inconsistency with watching first post that I am not sure how to resolve.

Watching first post exists in two primary locations: the notification level dropdown on category pages, and the user preferences page.

The User Preferences page appears to be a handlebars template which uses the watching-first-post for the class, following what appears to be the Discourse convention of using hyphens for CSS classes.

The notification level dropdown appears to come from JavaScript which uses watching_first_post for the class, following what appears to be the Discourse convention of using underscores for translation files.

Which is correct? At the moment, to target the watching first post icon in all locations, two selectors are needed, which seems less than ideal. Can this be resolved so the icons share the same CSS class, without breaking CSS or translation conventions?

(Jeff Atwood) #2

Perhaps @eviltrout can comment, this was his feature as I recall?

(Robin Ward) #3

Hyphens are definitely the way to go for CSS classes. Are you comfortable making a PR for this? If not I can fix it.

(Joshua Rosenfeld) #4

I looked into making a PR but that’s when I ran into the inconsistency…

If I change line 12 in the JavaScript so that the key uses hyphens not underscores under - that will change the CSS class but also break translations. Are you OK with me changing the client-en.yml file so it also uses hyphens not underscores?

If yes, I can absolutely submit a PR. If not, then I don’t know how to submit the PR without modifying the translation keys.

(Robin Ward) #5

No, I definitely would not want to rename our translation keys for this. I’m okay with dashes everywhere in our codebase for this feature except for the CSS. I’ve changed it here:

The class name should use dashes now instead of underscores.

(Joshua Rosenfeld) #6

Thanks Robin - I wouldn’t have had a clue where to start to fix this one. Have a :gift_heart:!

(Robin Ward) #7