summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-07-27 15:29:39 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-07-27 15:29:39 +0000
commitac0cbe69706a2d3013d37adda7514824a2d06ed4 (patch)
tree7730163984394f4e79711c609a2d1da2bb4f807e /app/models/user.rb
parent9981814514742a2ee507d4dcc2fd71099fd96585 (diff)
parent5ebccab1eb74f7bf9f7f9d4f2d9a56fb81754cbe (diff)
downloadgitlab-ce-ac0cbe69706a2d3013d37adda7514824a2d06ed4.tar.gz
Merge branch 'feature/gpg-signed-commits' into 'master'
GPG signed commits Closes #20268 See merge request !9546
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index c26be6d05a2..6e66c587a1f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -76,6 +76,7 @@ class User < ActiveRecord::Base
where(type.not_eq('DeployKey').or(type.eq(nil)))
end, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :deploy_keys, -> { where(type: 'DeployKey') }, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
+ has_many :gpg_keys
has_many :emails, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :personal_access_tokens, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
@@ -157,6 +158,7 @@ class User < ActiveRecord::Base
before_save :ensure_authentication_token, :ensure_incoming_email_token
before_save :ensure_user_rights_and_limits, if: :external_changed?
after_save :ensure_namespace_correct
+ after_commit :update_invalid_gpg_signatures, on: :update, if: -> { previous_changes.key?('email') }
after_initialize :set_projects_limit
after_destroy :post_destroy_hook
@@ -512,6 +514,10 @@ class User < ActiveRecord::Base
end
end
+ def update_invalid_gpg_signatures
+ gpg_keys.each(&:update_invalid_gpg_signatures)
+ end
+
# Returns the groups a user has access to
def authorized_groups
union = Gitlab::SQL::Union