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
662a3ff3
Commit
662a3ff3
authored
Oct 04, 2019
by
Nick Thomas
Committed by
Mayra Cabrera
Oct 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some unused code from the VisibleApprovable concern
parent
a8bab018
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
82 deletions
+0
-82
ee/app/models/concerns/visible_approvable.rb
ee/app/models/concerns/visible_approvable.rb
+0
-10
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+0
-23
ee/spec/models/visible_approvable_spec.rb
ee/spec/models/visible_approvable_spec.rb
+0
-30
ee/spec/presenters/merge_request_presenter_spec.rb
ee/spec/presenters/merge_request_presenter_spec.rb
+0
-19
No files found.
ee/app/models/concerns/visible_approvable.rb
View file @
662a3ff3
...
...
@@ -22,21 +22,11 @@ module VisibleApprovable
approvers
end
def
all_approvers_including_groups
approval_state
.
approvers
end
def
approvers_from_groups
groups
=
approval_state
.
wrapped_approval_rules
.
flat_map
(
&
:groups
)
User
.
joins
(
:group_members
).
where
(
members:
{
source_id:
groups
})
end
def
reset_approval_cache!
approvals
.
reset
approved_by_users
.
reset
approval_rules
.
reset
clear_memoization
(
:all_approvers_including_groups
)
clear_memoization
(
:approval_state
)
end
end
ee/spec/models/merge_request_spec.rb
View file @
662a3ff3
...
...
@@ -548,29 +548,6 @@ describe MergeRequest do
end
end
describe
'#all_approvers_including_groups'
do
it
'returns correct set of users'
do
user
=
create
:user
user1
=
create
:user
user2
=
create
:user
create
:user
project
=
create
:project
group
=
create
:group
group
.
add_maintainer
user
create
:approver_group
,
target:
project
,
group:
group
merge_request
=
create
:merge_request
,
target_project:
project
,
source_project:
project
group1
=
create
:group
group1
.
add_maintainer
user1
create
:approver_group
,
target:
merge_request
,
group:
group1
create
(
:approver
,
user:
user2
,
target:
merge_request
)
expect
(
merge_request
.
all_approvers_including_groups
).
to
match_array
([
user1
,
user2
])
end
end
describe
'#approver_group_ids='
do
it
'create approver_groups'
do
group
=
create
:group
...
...
ee/spec/models/visible_approvable_spec.rb
View file @
662a3ff3
...
...
@@ -74,18 +74,6 @@ describe VisibleApprovable do
end
end
describe
'#all_approvers_including_groups'
do
let!
(
:group
)
{
create
(
:group_with_members
)
}
let!
(
:approver
)
{
create
(
:user
)
}
let!
(
:rule
)
{
create
(
:approval_project_rule
,
project:
project
,
groups:
[
group
],
users:
[
approver
])
}
subject
{
resource
.
all_approvers_including_groups
}
it
'returns all approvers (groups and users)'
do
is_expected
.
to
match_array
(
group
.
users
+
[
approver
])
end
end
describe
'#authors_can_approve?'
do
subject
{
resource
.
authors_can_approve?
}
...
...
@@ -99,22 +87,4 @@ describe VisibleApprovable do
is_expected
.
to
be
true
end
end
describe
'#reset_approval_cache!'
do
before
do
approver
=
create
(
:user
)
project
.
add_developer
(
approver
)
create
(
:approval_project_rule
,
project:
project
,
users:
[
approver
])
end
subject
{
resource
.
reset_approval_cache!
}
it
'clears the all_approvers_including_groups cache'
do
resource
.
all_approvers_including_groups
.
first
.
destroy!
subject
expect
(
resource
.
all_approvers_including_groups
).
to
be_empty
end
end
end
ee/spec/presenters/merge_request_presenter_spec.rb
View file @
662a3ff3
...
...
@@ -83,25 +83,6 @@ describe MergeRequestPresenter do
it
{
is_expected
.
to
eq
(
expose_path
(
"/api/v4/projects/
#{
merge_request
.
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/unapprove"
))
}
end
describe
'#all_approvers_including_groups with approval_rule enabled'
do
let!
(
:private_group
)
{
create
(
:group_with_members
,
:private
)
}
let!
(
:public_group
)
{
create
(
:group_with_members
)
}
let!
(
:approver
)
{
create
(
:user
)
}
let!
(
:approval_rule
)
{
create
(
:approval_merge_request_rule
,
merge_request:
merge_request
,
users:
[
approver
],
groups:
[
private_group
,
public_group
])
}
before
do
project
.
add_developer
(
approver
)
end
subject
{
described_class
.
new
(
merge_request
,
current_user:
user
).
all_approvers_including_groups
}
it
do
approvers
=
[
public_group
.
users
,
private_group
.
users
,
approver
].
flatten
-
[
user
]
is_expected
.
to
match_array
(
approvers
)
end
end
describe
'#suggested_approvers'
do
subject
{
described_class
.
new
(
merge_request
,
current_user:
user
).
suggested_approvers
}
...
...
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