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
66ebb206
Commit
66ebb206
authored
Jan 08, 2018
by
Christiaan Van den Poel
Committed by
Phil Hughes
Jan 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disables the shortcut to the issue boards when issues are disabled
parent
15f7f52b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
18 deletions
+90
-18
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+4
-0
app/controllers/projects/boards_controller.rb
app/controllers/projects/boards_controller.rb
+1
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+0
-4
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+7
-5
changelogs/unreleased/41244-issue-board-shortcut-working-while-no-issues.yml
...ed/41244-issue-board-shortcut-working-while-no-issues.yml
+5
-0
spec/controllers/projects/boards_controller_spec.rb
spec/controllers/projects/boards_controller_spec.rb
+10
-0
spec/features/boards/keyboard_shortcut_spec.rb
spec/features/boards/keyboard_shortcut_spec.rb
+27
-9
spec/features/issues/keyboard_shortcut_spec.rb
spec/features/issues/keyboard_shortcut_spec.rb
+36
-0
No files found.
app/controllers/projects/application_controller.rb
View file @
66ebb206
...
@@ -86,4 +86,8 @@ class Projects::ApplicationController < ApplicationController
...
@@ -86,4 +86,8 @@ class Projects::ApplicationController < ApplicationController
def
require_pages_enabled!
def
require_pages_enabled!
not_found
unless
@project
.
pages_available?
not_found
unless
@project
.
pages_available?
end
end
def
check_issues_available!
return
render_404
unless
@project
.
feature_available?
(
:issues
,
current_user
)
end
end
end
app/controllers/projects/boards_controller.rb
View file @
66ebb206
...
@@ -2,6 +2,7 @@ class Projects::BoardsController < Projects::ApplicationController
...
@@ -2,6 +2,7 @@ class Projects::BoardsController < Projects::ApplicationController
include
BoardsResponses
include
BoardsResponses
include
IssuableCollections
include
IssuableCollections
before_action
:check_issues_available!
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:authorize_read_board!
,
only:
[
:index
,
:show
]
before_action
:assign_endpoint_vars
before_action
:assign_endpoint_vars
...
...
app/controllers/projects/issues_controller.rb
View file @
66ebb206
...
@@ -194,10 +194,6 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -194,10 +194,6 @@ class Projects::IssuesController < Projects::ApplicationController
render_404
unless
can?
(
current_user
,
:push_code
,
@project
)
&&
@issue
.
can_be_worked_on?
(
current_user
)
render_404
unless
can?
(
current_user
,
:push_code
,
@project
)
&&
@issue
.
can_be_worked_on?
(
current_user
)
end
end
def
check_issues_available!
return
render_404
unless
@project
.
feature_available?
(
:issues
,
current_user
)
end
def
render_issue_json
def
render_issue_json
if
@issue
.
valid?
if
@issue
.
valid?
render
json:
serializer
.
represent
(
@issue
)
render
json:
serializer
.
represent
(
@issue
)
...
...
app/views/layouts/nav/sidebar/_project.html.haml
View file @
66ebb206
...
@@ -299,6 +299,7 @@
...
@@ -299,6 +299,7 @@
Charts
Charts
-# Shortcut to Issues > New Issue
-# Shortcut to Issues > New Issue
-
if
project_nav_tab?
(
:issues
)
%li
.hidden
%li
.hidden
=
link_to
new_project_issue_path
(
@project
),
class:
'shortcuts-new-issue'
do
=
link_to
new_project_issue_path
(
@project
),
class:
'shortcuts-new-issue'
do
Create a new issue
Create a new issue
...
@@ -316,5 +317,6 @@
...
@@ -316,5 +317,6 @@
Commits
Commits
-# Shortcut to issue boards
-# Shortcut to issue boards
-
if
project_nav_tab?
(
:issues
)
%li
.hidden
%li
.hidden
=
link_to
'Issue Boards'
,
project_boards_path
(
@project
),
title:
'Issue Boards'
,
class:
'shortcuts-issue-boards'
=
link_to
'Issue Boards'
,
project_boards_path
(
@project
),
title:
'Issue Boards'
,
class:
'shortcuts-issue-boards'
changelogs/unreleased/41244-issue-board-shortcut-working-while-no-issues.yml
0 → 100644
View file @
66ebb206
---
title
:
disables shortcut to issue boards when issues are not enabled
merge_request
:
16020
author
:
Christiaan Van den Poel
type
:
fixed
spec/controllers/projects/boards_controller_spec.rb
View file @
66ebb206
...
@@ -55,6 +55,16 @@ describe Projects::BoardsController do
...
@@ -55,6 +55,16 @@ describe Projects::BoardsController do
end
end
end
end
context
'issues are disabled'
do
let
(
:project
)
{
create
(
:project
,
:issues_disabled
)
}
it
'returns a not found 404 response'
do
list_boards
expect
(
response
).
to
have_gitlab_http_status
(
404
)
end
end
def
list_boards
(
format: :html
)
def
list_boards
(
format: :html
)
get
:index
,
namespace_id:
project
.
namespace
,
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
,
project_id:
project
,
...
...
spec/features/boards/keyboard_shortcut_spec.rb
View file @
66ebb206
require
'rails_helper'
require
'rails_helper'
describe
'Issue Boards shortcut'
,
:js
do
describe
'Issue Boards shortcut'
,
:js
do
context
'issues are enabled'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
before
do
...
@@ -17,4 +18,21 @@ describe 'Issue Boards shortcut', :js do
...
@@ -17,4 +18,21 @@ describe 'Issue Boards shortcut', :js do
wait_for_requests
wait_for_requests
end
end
end
context
'issues are not enabled'
do
let
(
:project
)
{
create
(
:project
,
:issues_disabled
)
}
before
do
sign_in
(
create
(
:admin
))
visit
project_path
(
project
)
end
it
'does not take user to the issue board index'
do
find
(
'body'
).
native
.
send_keys
(
'gb'
)
expect
(
page
).
to
have_selector
(
"body[data-page='projects:show']"
)
end
end
end
end
spec/features/issues/keyboard_shortcut_spec.rb
0 → 100644
View file @
66ebb206
require
'rails_helper'
describe
'Issues shortcut'
,
:js
do
context
'New Issue shortcut'
do
context
'issues are enabled'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
sign_in
(
create
(
:admin
))
visit
project_path
(
project
)
end
it
'takes user to the new issue page'
do
find
(
'body'
).
native
.
send_keys
(
'i'
)
expect
(
page
).
to
have_selector
(
'#new_issue'
)
end
end
context
'issues are not enabled'
do
let
(
:project
)
{
create
(
:project
,
:issues_disabled
)
}
before
do
sign_in
(
create
(
:admin
))
visit
project_path
(
project
)
end
it
'does not take user to the new issue page'
do
find
(
'body'
).
native
.
send_keys
(
'i'
)
expect
(
page
).
to
have_selector
(
"body[data-page='projects:show']"
)
end
end
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