mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 08:30:12 +08:00
3ff6f6a5e1
Users who can access the review queue can claim a pending reviewable(s) which means that the claimed reviewable(s) can only be handled by the user who claimed it. Currently, we show claimed reviewables in the user menu, but this can be annoying for other reviewers because they can't do anything about a reviewable claimed by someone. So this PR makes sure that we only show in the user menu reviewables that are claimed by nobody or claimed by the current user. Internal topic: t/77235.
57 lines
999 B
Ruby
57 lines
999 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ReviewablePerformResultSerializer < ApplicationSerializer
|
|
|
|
attributes(
|
|
:success,
|
|
:transition_to,
|
|
:transition_to_id,
|
|
:created_post_id,
|
|
:created_post_topic_id,
|
|
:remove_reviewable_ids,
|
|
:version,
|
|
:reviewable_count,
|
|
:unseen_reviewable_count
|
|
)
|
|
|
|
def success
|
|
object.success?
|
|
end
|
|
|
|
def transition_to_id
|
|
Reviewable.statuses[transition_to]
|
|
end
|
|
|
|
def version
|
|
object.reviewable.version
|
|
end
|
|
|
|
def created_post_id
|
|
object.created_post.id
|
|
end
|
|
|
|
def include_created_post_id?
|
|
object.created_post.present?
|
|
end
|
|
|
|
def created_post_topic_id
|
|
object.created_post_topic.id
|
|
end
|
|
|
|
def include_created_post_topic_id?
|
|
object.created_post_topic.present?
|
|
end
|
|
|
|
def reviewable_count
|
|
scope.user.reviewable_count
|
|
end
|
|
|
|
def unseen_reviewable_count
|
|
Reviewable.unseen_reviewable_count(scope.user)
|
|
end
|
|
|
|
def include_unseen_reviewable_count?
|
|
scope.user.redesigned_user_menu_enabled?
|
|
end
|
|
end
|