Add group name classes to tag page so groups can be hidden with CSS (PR #8118)


You’ve signed the CLA, awesomerobot. Thank you! This pull request is ready for review.

will this work with unicode usernames?

@gschlager can you review? Maybe there is a general helper we can use here for this type of "make username name CSS friendly thing?

I think most (if not all) unicode characters are usable as CSS class names. Even the characters I’m replacing here can technically be used in class names if you escape them.

A “convert string to a safe CSS class name” helper might be a good idea… but I’m not sure if this comes up often enough? This is the first time I can recall where we weren’t already limiting special characters and/or a dasherized url-friendly slug isn’t available.

      const groupName = groupName

Here groupName being in the function params is considered already declared as mutable and doesn’t needs a new declaration

I don’t see a problem with Unicode usernames. All this does is remove a bunch of special characters which aren’t allowed in usernames / group names anyway. Might make sense to move it in a reusable method though, because there’s already a second use case for it: Add unique class to custom field wrappers by awesomerobot · Pull Request #8193 · discourse/discourse · GitHub

1 Like

Sorry, didn’t realize that my commit message didn’t specifically say tag group names. We allow special characters for those.