mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-07-04 12:52:17 +00:00
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.
17 lines
389 B
Ruby
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
|