blob: 0e86a1434f88dfda50a5fc379b913f0bfb5c6473 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# frozen_string_literal: true
module Admin
class ReportedContentEntity < Grape::Entity
include RequestAwareEntity
expose :id
expose :status
expose :message
expose :created_at, as: :reported_at
expose :category
expose :report_type, as: :type
expose :reported_content, as: :content
expose :reported_from_url, as: :url
expose :screenshot_path, as: :screenshot
expose :reporter, if: ->(report) { report.reporter } do
expose :details, merge: true do |report|
UserEntity.represent(report.reporter, only: [:name, :username, :avatar_url])
end
expose :path do |report|
user_path(report.reporter)
end
end
# Kept for backwards compatibility.
# TODO: See https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/167?work_item_iid=443
# In 16.4 remove or re-use this field after frontend has migrated to using moderate_user_path
expose :update_path do |report|
admin_abuse_report_path(report)
end
expose :moderate_user_path do |report|
moderate_user_admin_abuse_report_path(report)
end
end
end
|