debian-mirror-gitlab/app/serializers/admin/abuse_report_entity.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1 KiB
Ruby
Raw Normal View History

2023-05-27 22:25:52 +05:30
# frozen_string_literal: true
module Admin
class AbuseReportEntity < Grape::Entity
2023-06-20 00:43:36 +05:30
include RequestAwareEntity
include MarkupHelper
2023-05-27 22:25:52 +05:30
expose :category
2023-06-20 00:43:36 +05:30
expose :created_at
2023-05-27 22:25:52 +05:30
expose :updated_at
expose :reported_user do |report|
2023-06-20 00:43:36 +05:30
UserEntity.represent(report.user, only: [:name, :created_at])
2023-05-27 22:25:52 +05:30
end
expose :reporter do |report|
UserEntity.represent(report.reporter, only: [:name])
end
2023-06-20 00:43:36 +05:30
expose :reported_user_path do |report|
user_path(report.user)
end
expose :reporter_path do |report|
user_path(report.reporter)
end
expose :user_blocked do |report|
report.user.blocked?
end
expose :block_user_path do |report|
block_admin_user_path(report.user)
end
expose :remove_report_path do |report|
admin_abuse_report_path(report)
end
expose :remove_user_and_report_path do |report|
admin_abuse_report_path(report, remove_user: true)
end
expose :message do |report|
markdown_field(report, :message)
end
2023-05-27 22:25:52 +05:30
end
end