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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
93115197
Commit
93115197
authored
Mar 28, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t delete deploy key when user who created it is deleted
parent
7bca902a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
app/models/user.rb
app/models/user.rb
+2
-5
spec/models/user_spec.rb
spec/models/user_spec.rb
+1
-1
No files found.
app/models/user.rb
View file @
93115197
...
@@ -82,11 +82,8 @@ class User < ActiveRecord::Base
...
@@ -82,11 +82,8 @@ class User < ActiveRecord::Base
has_one
:namespace
,
->
{
where
(
type:
nil
)
},
dependent: :destroy
,
foreign_key: :owner_id
,
inverse_of: :owner
,
autosave:
true
# rubocop:disable Cop/ActiveRecordDependent
has_one
:namespace
,
->
{
where
(
type:
nil
)
},
dependent: :destroy
,
foreign_key: :owner_id
,
inverse_of: :owner
,
autosave:
true
# rubocop:disable Cop/ActiveRecordDependent
# Profile
# Profile
has_many
:keys
,
->
do
has_many
:keys
,
->
{
where
(
type:
[
'Key'
,
nil
])
},
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
type
=
Key
.
arel_table
[
:type
]
has_many
:deploy_keys
,
->
{
where
(
type:
'DeployKey'
)
},
dependent: :nullify
# rubocop:disable Cop/ActiveRecordDependent
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
:gpg_keys
has_many
:emails
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:emails
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
...
...
spec/models/user_spec.rb
View file @
93115197
...
@@ -25,7 +25,7 @@ describe User do
...
@@ -25,7 +25,7 @@ describe User do
it
{
is_expected
.
to
have_many
(
:group_members
)
}
it
{
is_expected
.
to
have_many
(
:group_members
)
}
it
{
is_expected
.
to
have_many
(
:groups
)
}
it
{
is_expected
.
to
have_many
(
:groups
)
}
it
{
is_expected
.
to
have_many
(
:keys
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:keys
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:deploy_keys
).
dependent
(
:
destro
y
)
}
it
{
is_expected
.
to
have_many
(
:deploy_keys
).
dependent
(
:
nullif
y
)
}
it
{
is_expected
.
to
have_many
(
:events
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:events
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:issues
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:issues
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
...
...
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