0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/plugins/discourse-solved/spec/serializers
overgrow 8cb3e97e47
FIX: Show solved status on topic titles loaded directly (#41186)
### What & why
The solved status checkmark next to a topic **title** renders
inconsistently: it shows when you
reach a solved topic from a topic list, but is **missing on a direct
load / hard refresh** of the
same topic (the accepted-answer accordion is unaffected).

The `after-topic-status` connector gates the title tick on
`topic.has_accepted_answer || topic.accepted_answer`.
`has_accepted_answer` is added (via
`TopicAnswerMixin`) only to the topic **list** serializers, **not**
`TopicViewSerializer`, which
serializes only `accepted_answers` (plural, for the accordion). So on a
direct topic load neither
flag is present and the connector renders nothing — the tick only
appears when the topic was
reached from a list (whose serializer carries the flag on the cached
record).

### Fix
Expose `has_accepted_answer` on `TopicViewSerializer` too (mirroring the
mixin), so the title
indicator is consistent regardless of navigation path. No front-end
change.

### Tests
Adds `#has_accepted_answer` specs to `topic_view_serializer_spec.rb`
(true when solved, false when
not, omitted when `solved_enabled` is off).
2026-06-25 15:28:24 +02:00
..
discourse_solved DEV: Allow multiple solutions in solved plugin (#39806) 2026-05-28 07:12:28 -05:00
topic_answer_mixin_spec.rb
topic_view_serializer_spec.rb FIX: Show solved status on topic titles loaded directly (#41186) 2026-06-25 15:28:24 +02:00
user_card_serializer_spec.rb DEV: Allow multiple solutions in solved plugin (#39806) 2026-05-28 07:12:28 -05:00
user_summary_serializer_spec.rb DEV: Allow multiple solutions in solved plugin (#39806) 2026-05-28 07:12:28 -05:00