Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/abuse_report.rb')
-rw-r--r--app/models/abuse_report.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb
index bf25c539830..872dedf07b1 100644
--- a/app/models/abuse_report.rb
+++ b/app/models/abuse_report.rb
@@ -6,6 +6,8 @@ class AbuseReport < ApplicationRecord
include Gitlab::FileTypeDetection
include WithUploads
include Gitlab::Utils::StrongMemoize
+ include Mentionable
+ include Noteable
MAX_CHAR_LIMIT_URL = 512
MAX_FILE_SIZE = 1.megabyte
@@ -23,6 +25,9 @@ class AbuseReport < ApplicationRecord
has_many :abuse_events, class_name: 'Abuse::Event', inverse_of: :abuse_report
+ has_many :notes, as: :noteable
+ has_many :user_mentions, class_name: 'Abuse::Reports::UserMention'
+
validates :reporter, presence: true, on: :create
validates :user, presence: true, on: :create
validates :message, presence: true
@@ -158,6 +163,10 @@ class AbuseReport < ApplicationRecord
Project.find_by_full_path(route_hash.values_at(:namespace_id, :project_id).join('/'))
end
+ def group
+ Group.find_by_full_path(route_hash[:group_id])
+ end
+
def route_hash
match = Rails.application.routes.recognize_path(reported_from_url)
return {} if match[:unmatched_route].present?
@@ -200,7 +209,7 @@ class AbuseReport < ApplicationRecord
format(_('contains URLs that exceed the %{limit} character limit'), limit: MAX_CHAR_LIMIT_URL)
)
end
- rescue ::Gitlab::UrlBlocker::BlockedUrlError
+ rescue ::Gitlab::HTTP_V2::UrlBlocker::BlockedUrlError
errors.add(:links_to_spam, _('only supports valid HTTP(S) URLs'))
end