mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:31:56 +08:00
bde0ef865f
If you click a (?) icon beside the reviewable status a pop up will appear with expanded informatio that explains how the reviewable got its score, and how it compares to system thresholds.
39 lines
711 B
Ruby
39 lines
711 B
Ruby
# frozen_string_literal: true
|
|
require_dependency 'reviewable_score_explanation_serializer'
|
|
|
|
class ReviewableExplanationSerializer < ApplicationSerializer
|
|
attributes(
|
|
:id,
|
|
:total_score,
|
|
:scores,
|
|
:min_score_visibility,
|
|
:hide_post_score
|
|
)
|
|
|
|
has_many :scores, serializer: ReviewableScoreExplanationSerializer, embed: :objects
|
|
|
|
def id
|
|
object[:reviewable].id
|
|
end
|
|
|
|
def hide_post_score
|
|
Reviewable.score_required_to_hide_post
|
|
end
|
|
|
|
def spam_silence_score
|
|
Reviewable.spam_score_to_silence_new_user
|
|
end
|
|
|
|
def min_score_visibility
|
|
Reviewable.min_score_for_priority
|
|
end
|
|
|
|
def total_score
|
|
object[:reviewable].score
|
|
end
|
|
|
|
def scores
|
|
object[:scores]
|
|
end
|
|
end
|