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:
Martin Brennan
2023-06-07 10:15:39 +10:00
committed by GitHub
parent af74cf5c77
commit 69eecf92d0
6 changed files with 79 additions and 4 deletions

View File

@@ -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>`;
}
}