discourse-solved/lib/discourse_solved/topic_view_serializer_extension.rb
Sérgio Saquetim 5aed0b41c5
FEATURE: Real-time updates for accepted and unaccepted solutions
Introduce real-time message bus updates for accepted and unaccepted solutions, ensuring live synchronization across users.

Key changes:
- Publish solution acceptance/unacceptance updates via MessageBus.
- Refactor `accepted_answer_post_info` and related logic for cleaner handling of accepted answer data.
- Update both backend and frontend to support reactive updates when solutions are toggled.
- Add loading states for Accept/Unaccept buttons to enhance UX during async operations.
2025-06-24 01:08:02 -03:00

17 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