A platform for community discussion. Free, open, simple.
UX: Show that topic was deleted in review queue (#37497)
Kris643ab82df590
diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex a7962ccaaaf..537a80c56b6 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3559,6 +3559,7 @@ en:deleted_post: "(deleted post)"post_number_with_topic_title: "post #%{post_number} - %{title}"new_post_in_topic: "new post in %{title}"+ new_post_in_deleted_topic: "new post in a deleted topic"user_requires_approval: "%{username} requires approval"default_item: "reviewable item #%{reviewable_id}"diff --git a/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs b/frontend/discourse/app/components/reviewable-refresh/topic-link.gjsindex ecc1d86bf8e..7aaa418bbe7 100644--- a/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs+++ b/frontend/discourse/app/components/reviewable-refresh/topic-link.gjs@@ -58,9 +58,7 @@ import { i18n } from "discourse-i18n";<ReviewableTags @tags={{@reviewable.topic_tags}} /></div></div>- {{else if (has-block)}}- {{yield}}- {{else}}+ {{else if @reviewable.removed_topic_id}}<span class="title-text">{{i18n "review.topics.deleted"}}<LinkTo@@ -68,6 +66,8 @@ import { i18n } from "discourse-i18n";@models={{array "-" @reviewable.removed_topic_id}}>{{i18n "review.topics.original"}}</LinkTo></span>+ {{else if (has-block)}}+ {{yield}}{{/if}}</div></template>diff --git a/frontend/discourse/app/lib/reviewable-types/queued-post.js b/frontend/discourse/app/lib/reviewable-types/queued-post.jsindex 874e955f430..d1fb8a82724 100644--- a/frontend/discourse/app/lib/reviewable-types/queued-post.js+++ b/frontend/discourse/app/lib/reviewable-types/queued-post.js@@ -17,12 +17,14 @@ export default class extends ReviewableTypeBase {title = emojiUnescape(title);if (this.reviewable.is_new_topic) {return htmlSafe(title);- } else {+ } else if (title) {return htmlSafe(i18n("user_menu.reviewable.new_post_in_topic", {title,}));+ } else {+ return i18n("user_menu.reviewable.new_post_in_deleted_topic");}}diff --git a/frontend/discourse/tests/integration/components/reviewable-refresh/topic-link-test.gjs b/frontend/discourse/tests/integration/components/reviewable-refresh/topic-link-test.gjsindex a6d249eca63..342d2263bbe 100644--- a/frontend/discourse/tests/integration/components/reviewable-refresh/topic-link-test.gjs+++ b/frontend/discourse/tests/integration/components/reviewable-refresh/topic-link-test.gjs@@ -87,5 +87,26 @@ module(.dom(".title-text").doesNotExist("does not render default deleted topic message");});++ test("renders deleted topic message over block content when removed_topic_id is present", async function (assert) {+ const reviewable = {+ removed_topic_id: 999,+ };++ await render(+ <template>+ <ReviewableTopicLink @reviewable={{reviewable}}>+ <span class="custom-fallback">Custom fallback content</span>+ </ReviewableTopicLink>+ </template>+ );++ assert+ .dom("span.title-text")+ .containsText("[Topic Deleted]", "shows deleted topic message");+ assert+ .dom(".custom-fallback")+ .doesNotExist("does not render the block content");+ });});diff --git a/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js b/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.jsindex d6651319ece..f1504d70c55 100644--- a/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js+++ b/frontend/discourse/tests/unit/lib/reviewable-types/queued-post-test.js@@ -55,4 +55,21 @@ module("Unit | Reviewable Items | queued-post", function (hooks) {"contains the payload title escaped and correctly unescapes emojis");});++ test("description falls back for deleted topic", function (assert) {+ const reviewable = getReviewable({+ topic_fancy_title: null,+ });+ delete reviewable.payload_title;+ const director = createRenderDirector(+ reviewable,+ "ReviewableQueuedPost",+ this.siteSettings+ );+ assert.deepEqual(+ director.description,+ i18n("user_menu.reviewable.new_post_in_deleted_topic"),+ "shows deleted topic fallback when no title is available"+ );+ });});