summaryrefslogtreecommitdiff
path: root/app/models/application_setting
diff options
context:
space:
mode:
authortauriedavis <taurie@gitlab.com>2018-05-25 16:17:57 -0700
committerBob Van Landuyt <bob@vanlanduyt.co>2018-06-04 22:22:11 +0200
commit285ffb223896f2226531be2ba10933414194155c (patch)
treecd6faec94ab2e4f65b0ed48f458b580b2853fac9 /app/models/application_setting
parent35ba75f6b93c77f078ab2cf538a256f8aa534eb3 (diff)
downloadgitlab-ce-285ffb223896f2226531be2ba10933414194155c.tar.gz
Messaging on terms page when user already accepted46585-gdpr-terms-acceptance
We show a blue flash banner if the user already accepted, and show a button allowing them to continue to the application.
Diffstat (limited to 'app/models/application_setting')
-rw-r--r--app/models/application_setting/term.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/application_setting/term.rb b/app/models/application_setting/term.rb
index e8ce0ccbb71..3b1dfe7e4ef 100644
--- a/app/models/application_setting/term.rb
+++ b/app/models/application_setting/term.rb
@@ -1,6 +1,7 @@
class ApplicationSetting
class Term < ActiveRecord::Base
include CacheMarkdownField
+ has_many :term_agreements
validates :terms, presence: true
@@ -9,5 +10,10 @@ class ApplicationSetting
def self.latest
order(:id).last
end
+
+ def accepted_by_user?(user)
+ user.accepted_term_id == id ||
+ term_agreements.accepted.where(user: user).exists?
+ end
end
end