Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
084cc718
Commit
084cc718
authored
Jul 05, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use after_commit instead of AfterCommitQueue
parent
e79e2ae1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
app/models/gpg_key.rb
app/models/gpg_key.rb
+3
-9
app/models/user.rb
app/models/user.rb
+2
-3
No files found.
app/models/gpg_key.rb
View file @
084cc718
class
GpgKey
<
ActiveRecord
::
Base
class
GpgKey
<
ActiveRecord
::
Base
include
AfterCommitQueue
KEY_PREFIX
=
'-----BEGIN PGP PUBLIC KEY BLOCK-----'
.
freeze
KEY_PREFIX
=
'-----BEGIN PGP PUBLIC KEY BLOCK-----'
.
freeze
belongs_to
:user
belongs_to
:user
...
@@ -31,8 +29,8 @@ class GpgKey < ActiveRecord::Base
...
@@ -31,8 +29,8 @@ class GpgKey < ActiveRecord::Base
unless:
->
{
errors
.
has_key?
(
:key
)
}
unless:
->
{
errors
.
has_key?
(
:key
)
}
before_validation
:extract_fingerprint
,
:extract_primary_keyid
before_validation
:extract_fingerprint
,
:extract_primary_keyid
after_c
reate
:update_invalid_gpg_signatures_after_
create
after_c
ommit
:update_invalid_gpg_signatures
,
on: :
create
after_c
reate
:notify_user
after_c
ommit
:notify_user
,
on: :create
def
key
=
(
value
)
def
key
=
(
value
)
value
.
strip!
unless
value
.
blank?
value
.
strip!
unless
value
.
blank?
...
@@ -75,10 +73,6 @@ class GpgKey < ActiveRecord::Base
...
@@ -75,10 +73,6 @@ class GpgKey < ActiveRecord::Base
end
end
def
notify_user
def
notify_user
run_after_commit
{
NotificationService
.
new
.
new_gpg_key
(
self
)
}
NotificationService
.
new
.
new_gpg_key
(
self
)
end
def
update_invalid_gpg_signatures_after_create
run_after_commit
{
update_invalid_gpg_signatures
}
end
end
end
end
app/models/user.rb
View file @
084cc718
...
@@ -13,7 +13,6 @@ class User < ActiveRecord::Base
...
@@ -13,7 +13,6 @@ class User < ActiveRecord::Base
include
IgnorableColumn
include
IgnorableColumn
include
FeatureGate
include
FeatureGate
include
CreatedAtFilterable
include
CreatedAtFilterable
include
AfterCommitQueue
DEFAULT_NOTIFICATION_LEVEL
=
:participating
DEFAULT_NOTIFICATION_LEVEL
=
:participating
...
@@ -156,10 +155,10 @@ class User < ActiveRecord::Base
...
@@ -156,10 +155,10 @@ class User < ActiveRecord::Base
before_validation
:set_public_email
,
if: :public_email_changed?
before_validation
:set_public_email
,
if: :public_email_changed?
after_update
:update_emails_with_primary_email
,
if: :email_changed?
after_update
:update_emails_with_primary_email
,
if: :email_changed?
after_update
:update_invalid_gpg_signatures
,
if: :email_changed?
before_save
:ensure_authentication_token
,
:ensure_incoming_email_token
before_save
:ensure_authentication_token
,
:ensure_incoming_email_token
before_save
:ensure_user_rights_and_limits
,
if: :external_changed?
before_save
:ensure_user_rights_and_limits
,
if: :external_changed?
after_save
:ensure_namespace_correct
after_save
:ensure_namespace_correct
after_commit
:update_invalid_gpg_signatures
,
on: :update
,
if:
->
{
previous_changes
.
key?
(
'email'
)
}
after_initialize
:set_projects_limit
after_initialize
:set_projects_limit
after_destroy
:post_destroy_hook
after_destroy
:post_destroy_hook
...
@@ -516,7 +515,7 @@ class User < ActiveRecord::Base
...
@@ -516,7 +515,7 @@ class User < ActiveRecord::Base
end
end
def
update_invalid_gpg_signatures
def
update_invalid_gpg_signatures
run_after_commit
{
gpg_keys
.
each
(
&
:update_invalid_gpg_signatures
)
}
gpg_keys
.
each
(
&
:update_invalid_gpg_signatures
)
end
end
# Returns the groups a user has access to
# Returns the groups a user has access to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment