mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 02:20:41 +08:00
b58867b6e9
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
19 lines
539 B
Ruby
19 lines
539 B
Ruby
require_dependency 'reviewable_score_type_serializer'
|
|
|
|
class ReviewableScoreSerializer < ApplicationSerializer
|
|
|
|
attributes :id, :score, :agree_stats
|
|
has_one :user, serializer: BasicUserSerializer, root: 'users'
|
|
has_one :score_type, serializer: ReviewableScoreTypeSerializer
|
|
has_one :reviewable_conversation, serializer: ReviewableConversationSerializer
|
|
|
|
def agree_stats
|
|
{
|
|
agreed: user.user_stat.flags_agreed,
|
|
disagreed: user.user_stat.flags_disagreed,
|
|
ignored: user.user_stat.flags_ignored
|
|
}
|
|
end
|
|
|
|
end
|