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
Boxiang Sun
gitlab-ce
Commits
59a330f4
Commit
59a330f4
authored
Apr 18, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove assigned_(issues|merge_requests) methods from the issuable
parent
d910a777
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
10 deletions
+4
-10
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+1
-1
app/models/user.rb
app/models/user.rb
+2
-5
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-2
spec/services/members/authorized_destroy_service_spec.rb
spec/services/members/authorized_destroy_service_spec.rb
+1
-2
No files found.
app/helpers/issuables_helper.rb
View file @
59a330f4
...
@@ -194,7 +194,7 @@ module IssuablesHelper
...
@@ -194,7 +194,7 @@ module IssuablesHelper
def
assigned_issuables_count
(
assignee
,
issuable_type
,
state
)
def
assigned_issuables_count
(
assignee
,
issuable_type
,
state
)
params
=
{
assignee_id:
assignee
.
id
,
state:
state
}
params
=
{
assignee_id:
assignee
.
id
,
state:
state
}
Object
::
const_get
(
"
#{
issuable_type
.
to_s
.
camelize
}
Finder"
).
new
(
current_user
,
params
).
execute
.
count
Object
.
const_get
(
"
#{
issuable_type
.
to_s
.
camelize
}
Finder"
).
new
(
current_user
,
params
).
execute
.
count
end
end
def
sidebar_gutter_collapsed?
def
sidebar_gutter_collapsed?
...
...
app/models/user.rb
View file @
59a330f4
...
@@ -99,9 +99,6 @@ class User < ActiveRecord::Base
...
@@ -99,9 +99,6 @@ class User < ActiveRecord::Base
has_many
:award_emoji
,
dependent: :destroy
has_many
:award_emoji
,
dependent: :destroy
has_many
:triggers
,
dependent: :destroy
,
class_name:
'Ci::Trigger'
,
foreign_key: :owner_id
has_many
:triggers
,
dependent: :destroy
,
class_name:
'Ci::Trigger'
,
foreign_key: :owner_id
has_many
:assigned_issues
,
dependent: :nullify
,
foreign_key: :assignee_id
,
class_name:
"Issue"
has_many
:assigned_merge_requests
,
dependent: :nullify
,
foreign_key: :assignee_id
,
class_name:
"MergeRequest"
# Issues that a user owns are expected to be moved to the "ghost" user before
# Issues that a user owns are expected to be moved to the "ghost" user before
# the user is destroyed. If the user owns any issues during deletion, this
# the user is destroyed. If the user owns any issues during deletion, this
# should be treated as an exceptional condition.
# should be treated as an exceptional condition.
...
@@ -893,13 +890,13 @@ class User < ActiveRecord::Base
...
@@ -893,13 +890,13 @@ class User < ActiveRecord::Base
def
assigned_open_merge_request_count
(
force:
false
)
def
assigned_open_merge_request_count
(
force:
false
)
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_merge_request_count'
],
force:
force
)
do
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_merge_request_count'
],
force:
force
)
do
assigned_merge_requests
.
opened
.
count
MergeRequestsFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
).
execute
.
count
end
end
end
end
def
assigned_open_issues_count
(
force:
false
)
def
assigned_open_issues_count
(
force:
false
)
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_issues_count'
],
force:
force
)
do
Rails
.
cache
.
fetch
([
'users'
,
id
,
'assigned_open_issues_count'
],
force:
force
)
do
assigned_issues
.
opened
.
count
IssuesFinder
.
new
(
self
,
assignee_id:
self
.
id
,
state:
'opened'
).
execute
.
count
end
end
end
end
...
...
spec/models/user_spec.rb
View file @
59a330f4
...
@@ -24,9 +24,7 @@ describe User, models: true do
...
@@ -24,9 +24,7 @@ describe User, models: true do
it
{
is_expected
.
to
have_many
(
:recent_events
).
class_name
(
'Event'
)
}
it
{
is_expected
.
to
have_many
(
:recent_events
).
class_name
(
'Event'
)
}
it
{
is_expected
.
to
have_many
(
:issues
).
dependent
(
:restrict_with_exception
)
}
it
{
is_expected
.
to
have_many
(
:issues
).
dependent
(
:restrict_with_exception
)
}
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:notes
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:assigned_issues
).
dependent
(
:nullify
)
}
it
{
is_expected
.
to
have_many
(
:merge_requests
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:merge_requests
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:assigned_merge_requests
).
dependent
(
:nullify
)
}
it
{
is_expected
.
to
have_many
(
:identities
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:identities
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:spam_logs
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:spam_logs
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:todos
).
dependent
(
:destroy
)
}
it
{
is_expected
.
to
have_many
(
:todos
).
dependent
(
:destroy
)
}
...
...
spec/services/members/authorized_destroy_service_spec.rb
View file @
59a330f4
require
'spec_helper'
require
'spec_helper'
describe
Members
::
AuthorizedDestroyService
,
services:
true
do
describe
Members
::
AuthorizedDestroyService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:member_user
)
{
create
(
:user
)
}
let
(
:member_user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group_project
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
let
(
:group_project
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
def
number_of_assigned_issuables
(
user
)
def
number_of_assigned_issuables
(
user
)
user
.
assigned_issues
.
count
+
user
.
assigned_merge_requests
.
count
Issue
.
assigned_to
(
user
).
count
+
MergeRequest
.
assigned_to
(
user
)
.
count
end
end
context
'Group member'
do
context
'Group member'
do
...
...
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