mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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:
@@ -31,6 +31,10 @@ export default class CategoryHashtagType extends HashtagTypeBase {
|
||||
}
|
||||
|
||||
generateIconHTML(hashtag) {
|
||||
return `<span class="hashtag-category-badge hashtag-color--${this.type}-${hashtag.id}"></span>`;
|
||||
const hashtagId = parseInt(hashtag.id, 10);
|
||||
const colorCssClass = !this.preloadedData.mapBy("id").includes(hashtagId)
|
||||
? "hashtag-missing"
|
||||
: `hashtag-color--${this.type}-${hashtag.id}`;
|
||||
return `<span class="hashtag-category-badge ${colorCssClass}"></span>`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user