mirror of
				https://github.com/discourse/discourse-solved.git
				synced 2025-10-31 06:28:53 +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 Component from "@glimmer/component"; | ||||||
| import { service } from "@ember/service"; | import { service } from "@ember/service"; | ||||||
| import { and } from "truth-helpers"; | 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"; | ||||||
| 
 | 
 | ||||||
| @ -8,18 +8,16 @@ export default class SolvedStatus extends Component { | |||||||
|   @service siteSettings; |   @service siteSettings; | ||||||
| 
 | 
 | ||||||
|   <template> |   <template> | ||||||
|     {{~#if @outletArgs.topic.has_accepted_answer~}} |     {{~#if | ||||||
|  |       (or | ||||||
|  |         @outletArgs.topic.has_accepted_answer @outletArgs.topic.accepted_answer | ||||||
|  |       ) | ||||||
|  |     ~}} | ||||||
|       <span |       <span | ||||||
|         title={{i18n "topic_statuses.solved.help"}} |         title={{i18n "topic_statuses.solved.help"}} | ||||||
|         class="topic-status" |         class="topic-status" | ||||||
|       >{{icon "far-square-check"}}</span> |       >{{icon "far-square-check"}}</span> | ||||||
|     {{~else if |     {{~else if @outletArgs.topic.can_have_answer~}} | ||||||
|       (and |  | ||||||
|         @outletArgs.topic.can_have_answer |  | ||||||
|         this.siteSettings.solved_enabled |  | ||||||
|         this.siteSettings.empty_box_on_unsolved |  | ||||||
|       ) |  | ||||||
|     ~}} |  | ||||||
|       <span |       <span | ||||||
|         title={{i18n "solved.has_no_accepted_answer"}} |         title={{i18n "solved.has_no_accepted_answer"}} | ||||||
|         class="topic-status" |         class="topic-status" | ||||||
|  | |||||||
| @ -216,11 +216,16 @@ export default { | |||||||
|           "raw-view:topic-status", |           "raw-view:topic-status", | ||||||
|           (Superclass) => |           (Superclass) => | ||||||
|             class extends Superclass { |             class extends Superclass { | ||||||
|               @discourseComputed("topic.{has_accepted_answer,can_have_answer}") |               @discourseComputed( | ||||||
|  |                 "topic.{has_accepted_answer,accepted_answer,can_have_answer}" | ||||||
|  |               ) | ||||||
|               statuses() { |               statuses() { | ||||||
|                 const results = super.statuses; |                 const results = super.statuses; | ||||||
| 
 | 
 | ||||||
|                 if (this.topic.has_accepted_answer) { |                 if ( | ||||||
|  |                   this.topic.has_accepted_answer || | ||||||
|  |                   this.topic.accepted_answer | ||||||
|  |                 ) { | ||||||
|                   results.push({ |                   results.push({ | ||||||
|                     openTag: "span", |                     openTag: "span", | ||||||
|                     closeTag: "span", |                     closeTag: "span", | ||||||
| @ -228,11 +233,7 @@ export default { | |||||||
|                     icon: "far-square-check", |                     icon: "far-square-check", | ||||||
|                     key: "solved", |                     key: "solved", | ||||||
|                   }); |                   }); | ||||||
|                 } else if ( |                 } else if (this.topic.can_have_answer) { | ||||||
|                   this.topic.can_have_answer && |  | ||||||
|                   this.siteSettings.solved_enabled && |  | ||||||
|                   this.siteSettings.empty_box_on_unsolved |  | ||||||
|                 ) { |  | ||||||
|                   results.push({ |                   results.push({ | ||||||
|                     openTag: "span", |                     openTag: "span", | ||||||
|                     closeTag: "span", |                     closeTag: "span", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user