From c95f9dbf34e01fcb129ee0a5654814f8414c5e88 Mon Sep 17 00:00:00 2001 From: Robert <35533304+merefield@users.noreply.github.com> Date: Wed, 28 Aug 2024 14:48:50 +0100 Subject: [PATCH] FIX: poll ensure ranked choice results can handle options with rich text and links (#28195) cf. https://meta.discourse.org/t/links-in-ranked-choice-polls-do-not-render-correctly-in-results-view/319098 --- .../components/poll-results-ranked-choice.gjs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs index 77b37731e84..9d717d0d0ae 100644 --- a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs +++ b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs @@ -1,13 +1,16 @@ import Component from "@glimmer/component"; +import { htmlSafe } from "@ember/template"; import i18n from "discourse-common/helpers/i18n"; import I18n from "discourse-i18n"; export default class PollResultsRankedChoiceComponent extends Component { get rankedChoiceWinnerText() { - return I18n.t("poll.ranked_choice.winner", { - count: this.args.rankedChoiceOutcome.round_activity.length, - winner: this.args.rankedChoiceOutcome.winning_candidate.html, - }); + return htmlSafe( + I18n.t("poll.ranked_choice.winner", { + count: this.args.rankedChoiceOutcome.round_activity.length, + winner: this.args.rankedChoiceOutcome.winning_candidate.html, + }) + ); } get rankedChoiceTiedText() { @@ -33,7 +36,7 @@ export default class PollResultsRankedChoiceComponent extends Component { {{#if round.majority}}