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:
authorPatricio Cano <suprnova32@gmail.com>2016-07-28 03:03:06 +0300
committerPatricio Cano <suprnova32@gmail.com>2016-08-15 21:17:58 +0300
commit95419679f23f0628d1885dd9656cc159e9d55ea9 (patch)
tree4ec924b2f7dfbfd9e0390065d430c9daff8984bb /app/models/user_agent_detail.rb
parent640e485c6aa19f8fca1be7fc45e7f65da4469fbd (diff)
Lay the ground works to submit information to Akismet
- New concern `AkismetSubmittable` to allow issues and other `Spammable` models to be submitted to Akismet. - New model `UserAgentDetail` to store information needed for Akismet. - Services needed for their creation and tests.
Diffstat (limited to 'app/models/user_agent_detail.rb')
-rw-r--r--app/models/user_agent_detail.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/user_agent_detail.rb b/app/models/user_agent_detail.rb
new file mode 100644
index 00000000000..6d76dff20e3
--- /dev/null
+++ b/app/models/user_agent_detail.rb
@@ -0,0 +1,16 @@
+class UserAgentDetail < ActiveRecord::Base
+ belongs_to :subject, polymorphic: true
+
+ validates :user_agent,
+ presence: true
+ validates :ip_address,
+ presence: true
+ validates :subject_id,
+ presence: true
+ validates :subject_type,
+ presence: true
+
+ def submittable?
+ user_agent.present? && ip_address.present?
+ end
+end