diff options
Diffstat (limited to 'app/serializers/admin/abuse_report_details_entity.rb')
-rw-r--r-- | app/serializers/admin/abuse_report_details_entity.rb | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/app/serializers/admin/abuse_report_details_entity.rb b/app/serializers/admin/abuse_report_details_entity.rb index 3efb8508e5e..8a67aabda9e 100644 --- a/app/serializers/admin/abuse_report_details_entity.rb +++ b/app/serializers/admin/abuse_report_details_entity.rb @@ -8,17 +8,21 @@ module Admin expose :details, merge: true do |report| UserEntity.represent(report.user, only: [:name, :username, :avatar_url, :email, :created_at, :last_activity_on]) end + expose :path do |report| user_path(report.user) end + expose :admin_path do |report| admin_user_path(report.user) end + expose :plan do |report| if Gitlab::CurrentSettings.current_application_settings.try(:should_check_namespace_plan?) report.user.namespace&.actual_plan&.title end end + expose :verification_state do expose :email do |report| report.user.confirmed? @@ -30,6 +34,7 @@ module Admin report.user.credit_card_validation.present? end end + expose :credit_card, if: ->(report) { report.user.credit_card_validation&.holder_name } do expose :name do |report| report.user.credit_card_validation.holder_name @@ -41,55 +46,38 @@ module Admin card_match_admin_user_path(report.user) if Gitlab.ee? end end - expose :other_reports do |report| - AbuseReportEntity.represent(report.other_reports_for_user, only: [:created_at, :category, :report_path]) + + expose :past_closed_reports do |report| + AbuseReportEntity.represent(report.past_closed_reports_for_user, only: [:created_at, :category, :report_path]) + end + + expose :similar_open_reports, if: ->(report) { report.open? } do |report| + ReportedContentEntity.represent(report.similar_open_reports_for_user) end + expose :most_used_ip do |report| AuthenticationEvent.most_used_ip_address_for_user(report.user) end + expose :last_sign_in_ip do |report| report.user.last_sign_in_ip end + expose :snippets_count do |report| report.user.snippets.count end + expose :groups_count do |report| report.user.groups.count end + expose :notes_count do |report| report.user.notes.count end end - 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 - - expose :report do - 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 - - # 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 + expose :report do |report| + ReportedContentEntity.represent(report) end end end |