mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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
This commit is contained in:
parent
c4428715b5
commit
c95f9dbf34
@ -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}}
|
||||
<tr>
|
||||
<td>{{round.round}}</td>
|
||||
<td>{{round.majority.html}}</td>
|
||||
<td>{{htmlSafe round.majority.html}}</td>
|
||||
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
@ -42,7 +45,7 @@ export default class PollResultsRankedChoiceComponent extends Component {
|
||||
<td>{{i18n "poll.ranked_choice.none"}}</td>
|
||||
<td>
|
||||
{{#each round.eliminated as |eliminated|}}
|
||||
{{eliminated.html}}
|
||||
{{htmlSafe eliminated.html}}
|
||||
{{/each}}
|
||||
</td>
|
||||
</tr>
|
||||
@ -59,9 +62,9 @@ export default class PollResultsRankedChoiceComponent extends Component {
|
||||
>{{this.rankedChoiceTiedText}}</span>
|
||||
<ul class="poll-results-ranked-choice-tied-candidates">
|
||||
{{#each @rankedChoiceOutcome.tied_candidates as |tied_candidate|}}
|
||||
<li
|
||||
class="poll-results-ranked-choice-tied-candidate"
|
||||
>{{tied_candidate.html}}</li>
|
||||
<li class="poll-results-ranked-choice-tied-candidate">{{htmlSafe
|
||||
tied_candidate.html
|
||||
}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{else}}
|
||||
|
Loading…
Reference in New Issue
Block a user