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