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
5595d737
Commit
5595d737
authored
Oct 05, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small refactor and fix for RuboCop
parent
bd8e3606
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+3
-6
db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
...05130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
+4
-2
No files found.
app/models/gpg_signature.rb
View file @
5595d737
...
...
@@ -22,14 +22,11 @@ class GpgSignature < ActiveRecord::Base
validates
:gpg_key_primary_keyid
,
presence:
true
def
self
.
with_key_and_subkeys
(
gpg_key
)
return
none
unless
gpg_key
t
=
arel_table
subkey_ids
=
gpg_key
&
.
subkeys
&
.
pluck
(
:id
)
subkey_ids
=
gpg_key
.
subkeys
.
pluck
(
:id
)
where
(
t
[
:gpg_key_id
].
eq
(
gpg_key
&
.
id
).
or
(
t
[
:gpg_key_subkey_id
].
in
(
subkey_ids
)
arel_table
[
:gpg_key_id
].
eq
(
gpg_key
.
id
).
or
(
arel_table
[
:gpg_key_subkey_id
].
in
(
subkey_ids
)
)
)
end
...
...
db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb
View file @
5595d737
...
...
@@ -8,11 +8,13 @@ class ScheduleCreateGpgKeySubkeysFromGpgKeys < ActiveRecord::Migration
class
GpgKey
<
ActiveRecord
::
Base
self
.
table_name
=
'gpg_keys'
include
EachBatch
end
def
up
GpgKey
.
select
(
:id
).
in_batches
do
|
relation
|
jobs
=
relation
.
pluck
(
:id
).
map
do
|
id
|
GpgKey
.
select
(
:id
).
each_batch
do
|
gpg_keys
|
jobs
=
gpg_keys
.
pluck
(
:id
).
map
do
|
id
|
[
'CreateGpgKeySubkeysFromGpgKeys'
,
[
id
]]
end
...
...
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