Fix emojis not showing in commit messages #5168
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5150
This fixes the issue where emojis were not showing up in the commit messages in the file tree, and on the commit view.
I was looking at two approaches for this:
I went with the second approach and would like some feedback on that. I went this route instead of modifying the code that generates the commit link, since it looked like I would need to make a new processor in
modules/markup/html.go
to facilitate adding thehas-emoji
class to these links. And that seemed like overkill for this small use case.It seems natural for emojify to work on children of the
has-emoji
elements, but it doesn't. (Deprecated, and only used to work by ID). So this will look at the children of eachhas-emoji
element and insert emojis into any children that are links.I only added emojis to links because I was worried about potential performance impacts if an element has a lot of children. If you think that's still a concern though then maybe we should go with the first approach?
Thanks for your consideration and feedback!