2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-03 12:03:01 -05:00
|
|
|
class ReviewablePerformResultSerializer < ApplicationSerializer
|
|
|
|
|
|
|
|
attributes(
|
|
|
|
:success,
|
|
|
|
:transition_to,
|
|
|
|
:transition_to_id,
|
|
|
|
:created_post_id,
|
|
|
|
:created_post_topic_id,
|
|
|
|
:remove_reviewable_ids,
|
2019-04-05 10:34:02 -04:00
|
|
|
:version,
|
2022-08-03 01:57:59 -04:00
|
|
|
:reviewable_count,
|
|
|
|
:unseen_reviewable_count
|
2019-01-03 12:03:01 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2019-04-05 10:34:02 -04:00
|
|
|
|
|
|
|
def reviewable_count
|
2022-08-03 01:57:59 -04:00
|
|
|
scope.user.reviewable_count
|
|
|
|
end
|
|
|
|
|
|
|
|
def unseen_reviewable_count
|
2022-11-30 18:09:57 -05:00
|
|
|
Reviewable.unseen_reviewable_count(scope.user)
|
2022-08-03 01:57:59 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def include_unseen_reviewable_count?
|
|
|
|
scope.user.redesigned_user_menu_enabled?
|
2019-04-05 10:34:02 -04:00
|
|
|
end
|
2019-01-03 12:03:01 -05:00
|
|
|
end
|