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
ab12b379
Commit
ab12b379
authored
Aug 01, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec failures with app/helpers/namespaces_helper.rb
parent
883d1dab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+14
-6
No files found.
app/helpers/namespaces_helper.rb
View file @
ab12b379
...
...
@@ -16,18 +16,15 @@ module NamespacesHelper
end
if
extra_group
&&
extra_group
.
is_a?
(
Group
)
# Many importers create a temporary Group, so use the real
# group if one exists by that name to prevent duplicates.
unless
extra_group
.
persisted?
existing_group
=
Group
.
find_by
(
name:
extra_group
.
name
)
extra_group
=
existing_group
if
existing_group
&
.
persisted?
end
extra_group
=
dedup_extra_group
(
extra_group
)
if
Ability
.
allowed?
(
current_user
,
:read_group
,
extra_group
)
# Assign the value to an invalid primary ID so that the select box works
extra_group
.
id
=
-
1
unless
extra_group
.
persisted?
selected_id
=
extra_group
.
id
if
selected
==
:extra_group
groups
|=
[
extra_group
]
else
selected_id
=
current_user
.
namespace
.
id
end
end
...
...
@@ -55,6 +52,17 @@ module NamespacesHelper
private
# Many importers create a temporary Group, so use the real
# group if one exists by that name to prevent duplicates.
def
dedup_extra_group
(
extra_group
)
unless
extra_group
.
persisted?
existing_group
=
Group
.
find_by
(
name:
extra_group
.
name
)
extra_group
=
existing_group
if
existing_group
&
.
persisted?
end
extra_group
end
def
options_for_group
(
namespaces
,
display_path
:,
type
:)
group_label
=
type
.
pluralize
elements
=
namespaces
.
sort_by
(
&
:human_name
).
map!
do
|
n
|
...
...
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