mirror of
https://ghfast.top/https://github.com/discourse/discourse-solved.git
synced 2026-07-16 11:47:13 +08: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.
16 lines
389 B
Ruby
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
|