DEV: Display unsolved icon only on the topic list (#330)

…in the new topic-status implementation (using the next `@context` from https://github.com/discourse/discourse/pull/30940)

This roughly matches the old implementation (but there it was displayed in some places but not in others mostly because of implementation details/bugs)
This commit is contained in:
Jarek Radosz 2025-01-23 04:21:46 +01:00 committed by GitHub
parent c929f49f3d
commit c8ac2c7002
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 24 deletions

View File

@ -1,27 +1,24 @@
import Component from "@glimmer/component"; import { and, eq, or } from "truth-helpers";
import { service } from "@ember/service";
import { or } from "truth-helpers";
import icon from "discourse/helpers/d-icon"; import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n"; import { i18n } from "discourse-i18n";
export default class SolvedStatus extends Component { const SolvedStatus = <template>
@service siteSettings; {{~#if
(or @outletArgs.topic.has_accepted_answer @outletArgs.topic.accepted_answer)
<template> ~}}
{{~#if <span
(or title={{i18n "topic_statuses.solved.help"}}
@outletArgs.topic.has_accepted_answer @outletArgs.topic.accepted_answer class="topic-status"
) >{{icon "far-square-check"}}</span>
~}} {{~else if
<span (and
title={{i18n "topic_statuses.solved.help"}} @outletArgs.topic.can_have_answer (eq @outletArgs.context "topic-list")
class="topic-status" )
>{{icon "far-square-check"}}</span> ~}}
{{~else if @outletArgs.topic.can_have_answer~}} <span
<span title={{i18n "solved.has_no_accepted_answer"}}
title={{i18n "solved.has_no_accepted_answer"}} class="topic-status"
class="topic-status" >{{icon "far-square"}}</span>
>{{icon "far-square"}}</span> {{~/if~}}
{{~/if~}} </template>;
</template> export default SolvedStatus;
}