mirror of
https://github.com/discourse/discourse.git
synced 2026-08-10 04:58:31 -05:00
FIX: Use a default hashtag icon color for user with no permission (#21825)
One user can create a post or chat message with a hashtag they have permission to use, but then when other users look at that post they will see an empty space next to the hashtag because they do not have the permission to load the colors in CSS classes for the related category. This fixes the issue by adding a default color with a special CSS class if the user doesn't have permission to see the linked channel/category on the hashtag.
This commit is contained in:
@@ -25,8 +25,12 @@ export default class ChannelHashtagType extends HashtagTypeBase {
|
||||
}
|
||||
|
||||
generateIconHTML(hashtag) {
|
||||
const hashtagId = parseInt(hashtag.id, 10);
|
||||
const colorCssClass = !this.preloadedData.mapBy("id").includes(hashtagId)
|
||||
? "hashtag-missing"
|
||||
: `hashtag-color--${this.type}-${hashtag.id}`;
|
||||
return iconHTML(hashtag.icon, {
|
||||
class: `hashtag-color--${this.type}-${hashtag.id}`,
|
||||
class: colorCssClass,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user