A platform for community discussion. Free, open, simple.
FIX: make topic optional in render-tags so reviewables can use discourseTags (#33181)
Kris8ac57fc272bc
diff --git a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.gjs b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.gjsindex 82c5e6d1a27..f615525794a 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-queued-post.gjs+++ b/app/assets/javascripts/discourse/app/components/reviewable-queued-post.gjs@@ -71,7 +71,7 @@ export default class ReviewableQueuedPost extends Component {{{highlightWatchedWords @reviewable.payload.title @reviewable}}</div>{{categoryBadge @reviewable.category}}- <ReviewableTags @tags={{@reviewable.payload.tags}} @tagName="" />+ <ReviewableTags @tags={{@reviewable.payload.tags}} />{{#if @reviewable.payload.via_email}}<a href {{on "click" this.showRawEmail}} class="show-raw-email">{{icon "envelope" title="post.via_email"}}diff --git a/app/assets/javascripts/discourse/app/components/reviewable-tags.gjs b/app/assets/javascripts/discourse/app/components/reviewable-tags.gjsindex b3701c7fbf7..937472851a4 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-tags.gjs+++ b/app/assets/javascripts/discourse/app/components/reviewable-tags.gjs@@ -1,12 +1,11 @@-import Component from "@ember/component";-import discourseTag from "discourse/helpers/discourse-tag";+import discourseTags from "discourse/helpers/discourse-tags";-export default class ReviewableTags extends Component {- <template>- {{#if this.tags}}- <div class="list-tags">- {{#each this.tags as |t|}}{{discourseTag t}}{{/each}}- </div>- {{/if}}- </template>-}+const ReviewableTags = <template>+ {{#if @tags}}+ <div class="list-tags">+ {{discourseTags @topic tags=@tags}}+ </div>+ {{/if}}+</template>;++export default ReviewableTags;diff --git a/app/assets/javascripts/discourse/app/components/reviewable-topic-link.gjs b/app/assets/javascripts/discourse/app/components/reviewable-topic-link.gjsindex 84760a0c8db..7a466abaaaa 100644--- a/app/assets/javascripts/discourse/app/components/reviewable-topic-link.gjs+++ b/app/assets/javascripts/discourse/app/components/reviewable-topic-link.gjs@@ -23,7 +23,10 @@ export default class ReviewableTopicLink extends Component {this.reviewable}}</a>{{categoryBadge this.reviewable.category}}- <ReviewableTags @tags={{this.reviewable.topic_tags}} @tagName="" />+ <ReviewableTags+ @topic={{this.reviewable.topic}}+ @tags={{this.reviewable.topic_tags}}+ />{{else if (has-block)}}{{yield}}{{else}}diff --git a/app/assets/javascripts/discourse/app/lib/render-tags.js b/app/assets/javascripts/discourse/app/lib/render-tags.jsindex bceba1bf706..bfa2484c20c 100644--- a/app/assets/javascripts/discourse/app/lib/render-tags.js+++ b/app/assets/javascripts/discourse/app/lib/render-tags.js@@ -25,15 +25,16 @@ export function clearTagsHtmlCallbacks() {}export default function (topic, params) {- let tags = topic.tags;+ let tags = topic?.tags || params?.tags;let buffer = "";let tagsForUser = null;let tagName;- const isPrivateMessage = topic.get("isPrivateMessage");++ const isPrivateMessage = topic?.get("isPrivateMessage");if (params) {if (params.mode === "list") {- tags = topic.get("visibleListTags");+ tags = topic?.get("visibleListTags");}if (params.tagsForUser) {tagsForUser = params.tagsForUser;@@ -57,7 +58,8 @@ export default function (topic, params) {};const callbackResults = [];- if (callbacks) {++ if (callbacks && topic) {callbacks.forEach((c) => {const html = c(topic, params);if (html) {@@ -85,7 +87,7 @@ export default function (topic, params) {}buffer += renderTag(tag, {- description: topic.tags_descriptions && topic.tags_descriptions[tag],+ description: topic?.tags_descriptions?.[tag],isPrivateMessage,tagsForUser,tagName,