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
8f14f931
Commit
8f14f931
authored
Jul 06, 2018
by
Mark Chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary checks; Refactor
parent
f36a28e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
app/services/projects/autocomplete_service.rb
app/services/projects/autocomplete_service.rb
+3
-3
ee/app/services/groups/autocomplete_service.rb
ee/app/services/groups/autocomplete_service.rb
+5
-4
ee/spec/services/groups/autocomplete_service_spec.rb
ee/spec/services/groups/autocomplete_service_spec.rb
+0
-1
No files found.
app/services/projects/autocomplete_service.rb
View file @
8f14f931
...
...
@@ -27,13 +27,13 @@ module Projects
include_ancestor_groups:
true
).
execute
hashes
=
available_labels
.
as_json
(
only:
[
:title
,
:color
])
label_
hashes
=
available_labels
.
as_json
(
only:
[
:title
,
:color
])
if
target
&
.
respond_to?
(
:labels
)
already_set_labels
=
available_labels
&
target
.
labels
if
already_set_labels
.
present?
titles
=
already_set_labels
.
map
(
&
:title
)
hashes
.
each
do
|
hash
|
label_
hashes
.
each
do
|
hash
|
if
titles
.
include?
(
hash
[
'title'
])
hash
[
:set
]
=
true
end
...
...
@@ -41,7 +41,7 @@ module Projects
end
end
hashes
label_
hashes
end
def
commands
(
noteable
,
type
)
...
...
ee/app/services/groups/autocomplete_service.rb
View file @
8f14f931
...
...
@@ -8,13 +8,13 @@ module Groups
only_group_labels:
true
).
execute
hashes
=
available_labels
.
as_json
(
only:
[
:title
,
:color
])
label_
hashes
=
available_labels
.
as_json
(
only:
[
:title
,
:color
])
if
target
&
.
respond_to?
(
:labels
)
already_set_labels
=
available_labels
&
target
.
labels
if
already_set_labels
.
present?
titles
=
already_set_labels
.
map
(
&
:title
)
hashes
.
each
do
|
hash
|
label_
hashes
.
each
do
|
hash
|
if
titles
.
include?
(
hash
[
'title'
])
hash
[
:set
]
=
true
end
...
...
@@ -22,11 +22,12 @@ module Groups
end
end
hashes
label_
hashes
end
def
epics
# TODO: change to EpicsFinder once frontend supports epics from descendant groups
# TODO: change to EpicsFinder once frontend supports epics from external groups.
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/6837
DeclarativePolicy
.
user_scope
do
if
Ability
.
allowed?
(
current_user
,
:read_epic
,
group
)
group
.
epics
...
...
ee/spec/services/groups/autocomplete_service_spec.rb
View file @
8f14f931
...
...
@@ -11,7 +11,6 @@ describe Groups::AutocompleteService do
end
def
expect_labels_to_equal
(
labels
,
expected_labels
)
expect
(
labels
.
size
).
to
eq
(
expected_labels
.
size
)
extract_title
=
lambda
{
|
label
|
label
[
'title'
]
}
expect
(
labels
.
map
(
&
extract_title
)).
to
eq
(
expected_labels
.
map
(
&
extract_title
))
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