BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a7d8a7bd
Commit
a7d8a7bd
authored
May 22, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings
Closes #1676
parent
f042b085
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
38 deletions
+49
-38
CHANGELOG
CHANGELOG
+1
-0
ability.rb
app/models/ability.rb
+27
-0
_dropdown.html.haml
app/views/projects/_dropdown.html.haml
+0
-37
show.html.haml
app/views/projects/milestones/show.html.haml
+1
-1
project.feature
features/project/project.feature
+6
-0
project.rb
features/steps/project/project.rb
+8
-0
project.rb
features/steps/shared/project.rb
+6
-0
No files found.
CHANGELOG
View file @
a7d8a7bd
Please view this file on the master branch, on stable branches it's out of date.
v 7.12.0 (unreleased)
- Disable "New Issue" and "New Merge Request" buttons when features are disabled in project settings (Stan Hu)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
- Disabled expansion of top/bottom blobs for new file diffs
- Update Asciidoctor gem to version 1.5.2. (Jakub Jirutka)
...
...
app/models/ability.rb
View file @
a7d8a7bd
...
...
@@ -101,6 +101,22 @@ class Ability
rules
-=
project_archived_rules
end
unless
project
.
issues_enabled
rules
-=
named_abilities
(
'issue'
)
end
unless
project
.
merge_requests_enabled
rules
-=
named_abilities
(
'merge_request'
)
end
unless
project
.
snippets_enabled
rules
-=
named_abilities
(
'snippet'
)
end
unless
project
.
wiki_enabled
rules
-=
named_abilities
(
'wiki'
)
end
rules
end
end
...
...
@@ -272,5 +288,16 @@ class Ability
abilities
end
end
private
def
named_abilities
(
name
)
[
:"read_
#{
name
}
"
,
:"write_
#{
name
}
"
,
:"modify_
#{
name
}
"
,
:"admin_
#{
name
}
"
]
end
end
end
app/views/projects/_dropdown.html.haml
deleted
100644 → 0
View file @
f042b085
-
if
current_user
.dropdown.pull-right
%a
.dropdown-toggle.btn.btn-sm
{
href:
'#'
,
"data-toggle"
=>
"dropdown"
}
%i
.fa.fa-bars
%ul
.dropdown-menu
-
if
@project
.
issues_enabled
&&
can?
(
current_user
,
:write_issue
,
@project
)
%li
=
link_to
url_for_new_issue
(
@project
,
only_path:
true
),
title:
"New Issue"
do
%i
.fa.fa-fw.fa-exclamation-circle
New issue
-
if
@project
.
merge_requests_enabled
&&
can?
(
current_user
,
:write_merge_request
,
@project
)
%li
=
link_to
new_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
),
title:
"New Merge Request"
do
%i
.fa.fa-fw.fa-tasks
New merge request
-
if
@project
.
snippets_enabled
&&
can?
(
current_user
,
:write_snippet
,
@project
)
%li
=
link_to
new_namespace_project_snippet_path
(
@project
.
namespace
,
@project
),
title:
"New Snippet"
do
%i
.fa.fa-fw.fa-file-text-o
New snippet
-
if
can?
(
current_user
,
:admin_project_member
,
@project
)
%li
=
link_to
namespace_project_project_members_path
(
@project
.
namespace
,
@project
),
title:
"New project member"
do
%i
.fa.fa-fw.fa-users
New project member
-
if
can?
current_user
,
:push_code
,
@project
%li
.divider
%li
=
link_to
new_namespace_project_branch_path
(
@project
.
namespace
,
@project
)
do
%i
.fa.fa-fw.fa-code-fork
New branch
%li
=
link_to
new_namespace_project_tag_path
(
@project
.
namespace
,
@project
)
do
%i
.fa.fa-fw.fa-tag
New tag
app/views/projects/milestones/show.html.haml
View file @
a7d8a7bd
...
...
@@ -61,7 +61,7 @@
Participants
%span
.badge
=
@users
.
count
-
if
@project
.
issues_enabled
-
if
can?
(
current_user
,
:write_issue
,
@project
)
.pull-right
=
link_to
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
{
milestone_id:
@milestone
.
id
}),
class:
"btn btn-grouped"
,
title:
"New Issue"
do
%i
.fa.fa-plus
...
...
features/project/project.feature
View file @
a7d8a7bd
...
...
@@ -62,3 +62,9 @@ Feature: Project
And
I add project tags
And
I save project
Then
I should see project tags
Scenario
:
I
should not see
"New Issue"
or
"New Merge Request"
buttons
Given
I disable issues and merge requests in project
When
I visit project
"Shop"
page
Then
I should not see
"New Issue"
button
And
I should not see
"New Merge Request"
button
features/steps/project/project.rb
View file @
a7d8a7bd
...
...
@@ -102,4 +102,12 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step
'I should see project tags'
do
expect
(
find_field
(
'Tags'
).
value
).
to
eq
'tag1, tag2'
end
step
'I should not see "New Issue" button'
do
page
.
should_not
have_link
'New Issue'
end
step
'I should not see "New Merge Request" button'
do
page
.
should_not
have_link
'New Merge Request'
end
end
features/steps/shared/project.rb
View file @
a7d8a7bd
...
...
@@ -14,6 +14,12 @@ module SharedProject
@project
.
team
<<
[
@user
,
:master
]
end
step
'I disable issues and merge requests in project'
do
@project
.
issues_enabled
=
false
@project
.
merge_requests_enabled
=
false
@project
.
save
end
# Add another user to project "Shop"
step
'I add a user to project "Shop"'
do
@project
=
Project
.
find_by
(
name:
"Shop"
)
...
...
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