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
fe9389ba
Commit
fe9389ba
authored
Apr 06, 2018
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide new mr from dropdown for archived projects
parent
12dd2b0c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
1 deletion
+100
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+12
-0
app/views/layouts/header/_new_dropdown.haml
app/views/layouts/header/_new_dropdown.haml
+1
-1
spec/features/projects/show/user_sees_collaboration_links_spec.rb
...tures/projects/show/user_sees_collaboration_links_spec.rb
+87
-0
No files found.
app/helpers/merge_requests_helper.rb
View file @
fe9389ba
...
...
@@ -138,6 +138,18 @@ module MergeRequestsHelper
end
end
def
merge_request_source_project_for_project
(
project
=
@project
)
unless
can?
(
current_user
,
:create_merge_request_in
,
project
)
return
nil
end
if
can?
(
current_user
,
:create_merge_request_from
,
project
)
project
else
current_user
.
fork_of
(
project
)
end
end
def
merge_params_ee
(
merge_request
)
{}
end
...
...
app/views/layouts/header/_new_dropdown.haml
View file @
fe9389ba
...
...
@@ -20,7 +20,7 @@
-
if
@project
&
.
persisted?
-
create_project_issue
=
can?
(
current_user
,
:create_issue
,
@project
)
-
merge_project
=
can?
(
current_user
,
:create_merge_request
,
@project
)
?
@project
:
(
current_user
&&
current_user
.
fork_of
(
@project
)
)
-
merge_project
=
merge_request_source_project_for_project
(
@project
)
-
create_project_snippet
=
can?
(
current_user
,
:create_project_snippet
,
@project
)
-
if
create_project_issue
||
merge_project
||
create_project_snippet
%li
.dropdown-bold-header
This project
...
...
spec/features/projects/show/user_sees_collaboration_links_spec.rb
0 → 100644
View file @
fe9389ba
require
'spec_helper'
describe
'Projects > Show > Collaboration links'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
end
it
'shows all the expected links'
do
visit
project_path
(
project
)
# The navigation bar
page
.
within
(
'.header-new'
)
do
aggregate_failures
'dropdown links in the navigation bar'
do
expect
(
page
).
to
have_link
(
'New issue'
)
expect
(
page
).
to
have_link
(
'New merge request'
)
expect
(
page
).
to
have_link
(
'New snippet'
,
href:
new_project_snippet_path
(
project
))
end
end
# The project header
page
.
within
(
'.project-home-panel'
)
do
aggregate_failures
'dropdown links in the project home panel'
do
expect
(
page
).
to
have_link
(
'New issue'
)
expect
(
page
).
to
have_link
(
'New merge request'
)
expect
(
page
).
to
have_link
(
'New snippet'
)
expect
(
page
).
to
have_link
(
'New file'
)
expect
(
page
).
to
have_link
(
'New branch'
)
expect
(
page
).
to
have_link
(
'New tag'
)
end
end
# The dropdown above the tree
page
.
within
(
'.repo-breadcrumb'
)
do
aggregate_failures
'dropdown links above the repo tree'
do
expect
(
page
).
to
have_link
(
'New file'
)
expect
(
page
).
to
have_link
(
'Upload file'
)
expect
(
page
).
to
have_link
(
'New directory'
)
expect
(
page
).
to
have_link
(
'New branch'
)
expect
(
page
).
to
have_link
(
'New tag'
)
end
end
# The Web IDE
expect
(
page
).
to
have_link
(
'Web IDE'
)
end
it
'hides the links when the project is archived'
do
project
.
update!
(
archived:
true
)
visit
project_path
(
project
)
page
.
within
(
'.header-new'
)
do
aggregate_failures
'dropdown links'
do
expect
(
page
).
not_to
have_link
(
'New issue'
)
expect
(
page
).
not_to
have_link
(
'New merge request'
)
expect
(
page
).
not_to
have_link
(
'New snippet'
,
href:
new_project_snippet_path
(
project
))
end
end
page
.
within
(
'.project-home-panel'
)
do
aggregate_failures
'dropdown links'
do
expect
(
page
).
not_to
have_link
(
'New issue'
)
expect
(
page
).
not_to
have_link
(
'New merge request'
)
expect
(
page
).
not_to
have_link
(
'New snippet'
)
expect
(
page
).
not_to
have_link
(
'New file'
)
expect
(
page
).
not_to
have_link
(
'New branch'
)
expect
(
page
).
not_to
have_link
(
'New tag'
)
end
end
page
.
within
(
'.repo-breadcrumb'
)
do
aggregate_failures
'dropdown links'
do
expect
(
page
).
not_to
have_link
(
'New file'
)
expect
(
page
).
not_to
have_link
(
'Upload file'
)
expect
(
page
).
not_to
have_link
(
'New directory'
)
expect
(
page
).
not_to
have_link
(
'New branch'
)
expect
(
page
).
not_to
have_link
(
'New tag'
)
end
end
expect
(
page
).
not_to
have_link
(
'Web IDE'
)
end
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