discourse/plugins/discourse-solved/lib/discourse_solved/topic_view_serializer_extension.rb
Sérgio Saquetim dfc0798a6e
DEV: Enhance how the Solve plugin displays the accepted answer (#33757)
Enhanced the `solved` plugin with comprehensive improvements to solution
handling and UI components:

- Use the `PostQuotedContent` core component for rendering accepted
answers
- Added `@tracked` state management for solution acceptance UI
- Refactored `acceptPost` and `unacceptPost` functions with better error
handling
- Updated topic models to safely track accepted solutions
- Added MessageBus integration for secure message publishing
- Improved test coverage adding MessageBus verification and system tests
for accepting/unaccepting answers.
2025-07-23 12:01:35 -03:00

16 lines
389 B
Ruby

# frozen_string_literal: true
module DiscourseSolved::TopicViewSerializerExtension
extend ActiveSupport::Concern
prepended { attributes :accepted_answer }
def include_accepted_answer?
SiteSetting.solved_enabled? && object.topic.solved.present? &&
object.topic.solved.answer_post.present?
end
def accepted_answer
object.topic.accepted_answer_post_info
end
end