mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-07 14:36:07 +08:00
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.
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
|