2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/app/serializers/reviewable_perform_result_serializer.rb
Alan Guo Xiang Tan 35f660e3a1
DEV: Remove unused transition_to and transition_to_id from reviewable serializer (#37135)
What is the problem?

The `ReviewablePerformResultSerializer` includes `transition_to` and
`transition_to_id` attributes in API responses, but these values are
not consumed by any frontend code. The frontend only uses
`remove_reviewable_ids`, `reviewable_count`, `unseen_reviewable_count`,
and `completed_message` from the perform result.

What is the solution?

Remove the unused `transition_to` and `transition_to_id` attributes
from `ReviewablePerformResultSerializer`, along with the
`transition_to_id` method. Update corresponding test expectations.
2026-01-15 15:04:53 +08:00

45 lines
796 B
Ruby

# frozen_string_literal: true
class ReviewablePerformResultSerializer < ApplicationSerializer
attributes(
:success,
:created_post_id,
:created_post_topic_id,
:remove_reviewable_ids,
:version,
:reviewable_count,
:unseen_reviewable_count,
)
def success
object.success?
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
end