mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-03-09 14:37:15 +00:00
FIX: Use both possible *_answer
attributes (#329)
…and simplify other conditions (`can_have_answer` is true only if `solved_enabled` and `empty_box_on_unsolved` are also true)
This commit is contained in:
parent
e6cda87505
commit
c929f49f3d
@ -1,6 +1,6 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { service } from "@ember/service";
|
||||
import { and } from "truth-helpers";
|
||||
import { or } from "truth-helpers";
|
||||
import icon from "discourse/helpers/d-icon";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
@ -8,18 +8,16 @@ export default class SolvedStatus extends Component {
|
||||
@service siteSettings;
|
||||
|
||||
<template>
|
||||
{{~#if @outletArgs.topic.has_accepted_answer~}}
|
||||
{{~#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
|
||||
this.siteSettings.solved_enabled
|
||||
this.siteSettings.empty_box_on_unsolved
|
||||
)
|
||||
~}}
|
||||
{{~else if @outletArgs.topic.can_have_answer~}}
|
||||
<span
|
||||
title={{i18n "solved.has_no_accepted_answer"}}
|
||||
class="topic-status"
|
||||
|
@ -216,11 +216,16 @@ export default {
|
||||
"raw-view:topic-status",
|
||||
(Superclass) =>
|
||||
class extends Superclass {
|
||||
@discourseComputed("topic.{has_accepted_answer,can_have_answer}")
|
||||
@discourseComputed(
|
||||
"topic.{has_accepted_answer,accepted_answer,can_have_answer}"
|
||||
)
|
||||
statuses() {
|
||||
const results = super.statuses;
|
||||
|
||||
if (this.topic.has_accepted_answer) {
|
||||
if (
|
||||
this.topic.has_accepted_answer ||
|
||||
this.topic.accepted_answer
|
||||
) {
|
||||
results.push({
|
||||
openTag: "span",
|
||||
closeTag: "span",
|
||||
@ -228,11 +233,7 @@ export default {
|
||||
icon: "far-square-check",
|
||||
key: "solved",
|
||||
});
|
||||
} else if (
|
||||
this.topic.can_have_answer &&
|
||||
this.siteSettings.solved_enabled &&
|
||||
this.siteSettings.empty_box_on_unsolved
|
||||
) {
|
||||
} else if (this.topic.can_have_answer) {
|
||||
results.push({
|
||||
openTag: "span",
|
||||
closeTag: "span",
|
||||
|
Loading…
x
Reference in New Issue
Block a user