summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-02-05 14:24:43 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-02-05 14:24:43 +0000
commit9edd95658308f3e0e8e6df6eb829555a3cb418d1 (patch)
tree9b5d96752c3eb767c603bdf12f381abc9604d0dd /app/models
parentbedfc7b103c25cd6b9aada350142549160e41a5e (diff)
parentf24705212791072a93edd4f7b1c530507b6a2c49 (diff)
downloadgitlab-ce-9edd95658308f3e0e8e6df6eb829555a3cb418d1.tar.gz
Merge branch 'persistent-callouts' into 'master'
Add backend for persistently dismissible callouts See merge request gitlab-org/gitlab-ce!16735
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb1
-rw-r--r--app/models/user_callout.rb13
2 files changed, 14 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index cad118f5502..a57ba3740c9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -135,6 +135,7 @@ class User < ActiveRecord::Base
has_many :assigned_merge_requests, dependent: :nullify, foreign_key: :assignee_id, class_name: "MergeRequest" # rubocop:disable Cop/ActiveRecordDependent
has_many :custom_attributes, class_name: 'UserCustomAttribute'
+ has_many :callouts, class_name: 'UserCallout'
has_many :uploads, as: :model, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
#
diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb
new file mode 100644
index 00000000000..e4b69382626
--- /dev/null
+++ b/app/models/user_callout.rb
@@ -0,0 +1,13 @@
+class UserCallout < ActiveRecord::Base
+ belongs_to :user
+
+ enum feature_name: {
+ gke_cluster_integration: 1
+ }
+
+ validates :user, presence: true
+ validates :feature_name,
+ presence: true,
+ uniqueness: { scope: :user_id },
+ inclusion: { in: UserCallout.feature_names.keys }
+end