A platform for community discussion. Free, open, simple.
FIX: Show queued post deletions in the review timeline (#45487)
Krzysztof Kotlarekb7d63facd95d
diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 487b5870869..af4b6d4666d 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -1286,6 +1286,7 @@ en:target_created_by: "Post created by %{username} · %{relativeDate}"target_deleted: "Post deleted"target_deleted_by: "Post deleted by %{username} · %{relativeDate}"+ queued_post_deleted_by: "Queued post deleted by %{username} · %{relativeDate}"flagged: "Flagged"flagged_as_by: "Flagged as %{flagReason} by %{username} · %{relativeDate}"claimed: "Claimed"diff --git a/frontend/discourse/app/components/reviewable/timeline.gjs b/frontend/discourse/app/components/reviewable/timeline.gjsindex 9ceebcb135c..6aa37167b6c 100644--- a/frontend/discourse/app/components/reviewable/timeline.gjs+++ b/frontend/discourse/app/components/reviewable/timeline.gjs@@ -13,7 +13,12 @@ import {penaltyPastTense,} from "discourse/lib/reviewable-penalty";import { sanitize } from "discourse/lib/text";-import { CLAIMED, UNCLAIMED } from "discourse/models/reviewable-history";+import { DELETED } from "discourse/models/reviewable";+import {+ CLAIMED,+ TRANSITIONED,+ UNCLAIMED,+} from "discourse/models/reviewable-history";import DButton from "discourse/ui-kit/d-button";import DDecoratedHtml from "discourse/ui-kit/d-decorated-html";import DInterpolatedTranslation from "discourse/ui-kit/d-interpolated-translation";@@ -188,7 +193,19 @@ export default class ReviewableTimeline extends Component {});this.args.historyEvents?.forEach((history) => {- if (history.reviewable_history_type === CLAIMED) {+ if (+ this.args.reviewable.type === "ReviewableQueuedPost" &&+ history.reviewable_history_type === TRANSITIONED &&+ history.status === DELETED+ ) {+ events.push({+ type: "queued_post_deleted",+ date: history.created_at,+ user: history.created_by,+ icon: "trash-can",+ titleKey: "review.timeline.queued_post_deleted_by",+ });+ } else if (history.reviewable_history_type === CLAIMED) {events.push({type: "claimed",date: history.created_at,diff --git a/frontend/discourse/app/models/reviewable-history.ts b/frontend/discourse/app/models/reviewable-history.tsindex 0d0be9df3df..5dcffd88822 100644--- a/frontend/discourse/app/models/reviewable-history.ts+++ b/frontend/discourse/app/models/reviewable-history.ts@@ -1,6 +1,7 @@import RestModel from "discourse/models/rest";import type User from "discourse/models/user";+export const TRANSITIONED = 1 as const;export const CLAIMED = 3 as const;export const UNCLAIMED = 4 as const;diff --git a/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs b/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjsindex c1b4c3d89a5..e2f5bd0e949 100644--- a/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs+++ b/frontend/discourse/tests/integration/components/reviewable/timeline-test.gjs@@ -5,7 +5,12 @@ import { module, test } from "qunit";import ReviewableTimeline from "discourse/components/reviewable/timeline";import UserCardContents from "discourse/components/user-card-contents";import DMenus from "discourse/float-kit/components/d-menus";-import { CLAIMED, UNCLAIMED } from "discourse/models/reviewable-history";+import { DELETED, PENDING } from "discourse/models/reviewable";+import {+ CLAIMED,+ TRANSITIONED,+ UNCLAIMED,+} from "discourse/models/reviewable-history";import { setupRenderingTest } from "discourse/tests/helpers/component-test";import pretender, { response } from "discourse/tests/helpers/create-pretender";@@ -107,6 +112,49 @@ module("Integration | Component | Reviewable | Timeline", function (hooks) {assert.dom(".timeline-event__icon .d-icon-user-xmark").exists();});+ test("renders a queued post deletion with its actor and timestamp", async function (assert) {+ const reviewable = { type: "ReviewableQueuedPost", status: DELETED };+ const deletedAt = "2026-10-29T02:24:51.539Z";+ const historyEvents = [+ {+ reviewable_history_type: 0,+ status: PENDING,+ created_at: "2026-10-29T02:12:49.741Z",+ created_by: { id: -1, username: "system" },+ },+ {+ reviewable_history_type: TRANSITIONED,+ status: DELETED,+ created_at: deletedAt,+ created_by: { id: 303494, username: "author" },+ },+ ];++ await render(+ <template>+ <ReviewableTimeline+ @historyEvents={{historyEvents}}+ @reviewable={{reviewable}}+ />+ </template>+ );++ assert.dom(".timeline-event").exists({ count: 1 }, "renders the deletion");+ assert+ .dom(".timeline-event__title")+ .includesText("Queued post deleted by author", "identifies the actor");+ assert+ .dom(".timeline-event__title a")+ .hasAttribute("href", "/u/author", "links to the actor's profile");+ assert+ .dom(".timeline-event .relative-date")+ .hasAttribute(+ "data-time",+ String(new Date(deletedAt).getTime()),+ "uses the deletion timestamp"+ );+ });+test("renders the notes of the reviewable currently passed in", async function (assert) {const reviewable = tracked({reviewable_scores: [],