summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-02-07 13:56:50 +0100
committerPawel Chojnacki <pawel@chojnacki.ws>2017-02-13 15:38:00 +0100
commite31b982a13413151dd7317ee15aadcbde0f72edb (patch)
tree55b7be7cccfefc2e3e9d51bb13359f83df9076c9 /app
parent027a4bd274d7060e35cfe225765c917d7de25b31 (diff)
downloadgitlab-ce-e31b982a13413151dd7317ee15aadcbde0f72edb.tar.gz
Make deploy key not show in User's keys list
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 867e61af56a..1649bf04eaa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -51,7 +51,12 @@ class User < ActiveRecord::Base
has_one :namespace, -> { where type: nil }, dependent: :destroy, foreign_key: :owner_id
# Profile
- has_many :keys, dependent: :destroy
+ has_many :keys, -> do
+ type = Key.arel_table[:type]
+ where(type.not_eq('DeployKey').or(type.eq(nil)))
+ end, dependent: :destroy
+ has_many :deploy_keys, -> { where(type: 'DeployKey') }, dependent: :destroy
+
has_many :emails, dependent: :destroy
has_many :personal_access_tokens, dependent: :destroy
has_many :identities, dependent: :destroy, autosave: true