summaryrefslogtreecommitdiff
path: root/app/models/concerns/spammable.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-02-10 11:41:22 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-02-20 16:28:13 +0100
commit5be8f03747eff470e3093e6a3f97c475ddba9a90 (patch)
tree02f675d7f8f439e5925df46f40d2f0c7b8d2a374 /app/models/concerns/spammable.rb
parentc89449e6110c2bdf6e1410bae3e7b7d807c5e305 (diff)
downloadgitlab-ce-5be8f03747eff470e3093e6a3f97c475ddba9a90.tar.gz
Improve performance of User Agent Detail
Diffstat (limited to 'app/models/concerns/spammable.rb')
-rw-r--r--app/models/concerns/spammable.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/concerns/spammable.rb b/app/models/concerns/spammable.rb
index 423ae98a60e..79adc77c9e4 100644
--- a/app/models/concerns/spammable.rb
+++ b/app/models/concerns/spammable.rb
@@ -22,6 +22,10 @@ module Spammable
delegate :ip_address, :user_agent, to: :user_agent_detail, allow_nil: true
end
+ def submittable_as_spam_by?(current_user)
+ current_user && current_user.admin? && submittable_as_spam?
+ end
+
def submittable_as_spam?
if user_agent_detail
user_agent_detail.submittable? && current_application_settings.akismet_enabled