A platform for community discussion. Free, open, simple.
UX: don't escape PM excerpts in the review queue refresh, decorate HTML (#36084)
Kris976847550ac9
diff --git a/frontend/discourse/app/components/reviewable-refresh/timeline.gjs b/frontend/discourse/app/components/reviewable-refresh/timeline.gjsindex c0afbe07291..1b929b5ba7e 100644--- a/frontend/discourse/app/components/reviewable-refresh/timeline.gjs+++ b/frontend/discourse/app/components/reviewable-refresh/timeline.gjs@@ -5,6 +5,7 @@ import { action } from "@ember/object";import { service } from "@ember/service";import { htmlSafe } from "@ember/template";import DButton from "discourse/components/d-button";+import DecoratedHtml from "discourse/components/decorated-html";import InterpolatedTranslation from "discourse/components/interpolated-translation";import ReviewableFlagReason from "discourse/components/reviewable-refresh/flag-reason";import ReviewableNoteForm from "discourse/components/reviewable-refresh/note-form";@@ -14,6 +15,7 @@ import icon from "discourse/helpers/d-icon";import formatDate from "discourse/helpers/format-date";import { ajax } from "discourse/lib/ajax";import { popupAjaxError } from "discourse/lib/ajax-error";+import { bind } from "discourse/lib/decorators";import escape from "discourse/lib/escape";import { and, eq } from "discourse/truth-helpers";import { i18n } from "discourse-i18n";@@ -25,6 +27,7 @@ import { i18n } from "discourse-i18n";* @component ReviewableTimeline*/export default class ReviewableTimeline extends Component {+ @service appEvents;@service currentUser;@service store;@@ -97,7 +100,7 @@ export default class ReviewableTimeline extends Component {score.reviewable_conversation.conversation_posts.length > 0) {const firstPost = score.reviewable_conversation.conversation_posts[0];- flaggedDescription += `<p>${escape(firstPost.excerpt)} (<a href="${escape(+ flaggedDescription += `<p>${firstPost.excerpt} (<a href="${escape(score.reviewable_conversation.permalink)}">${i18n("review.timeline.view_conversation")}</a>)</p>`;}@@ -214,6 +217,15 @@ export default class ReviewableTimeline extends Component {}}+ @bind+ decorate(element, helper) {+ this.appEvents.trigger(+ "decorate-non-stream-cooked-element",+ element,+ helper+ );+ }+<template><div class="reviewable-timeline">@@ -250,9 +262,11 @@ export default class ReviewableTimeline extends Component {</InterpolatedTranslation></div>{{#if event.description}}- <div class="timeline-event__description">- {{htmlSafe event.description}}- </div>+ <DecoratedHtml+ @className="timeline-event__description"+ @html={{event.description}}+ @decorate={{this.decorate}}+ />{{/if}}</div>