Skip to content
Snippets Groups Projects
Commit 66ebb206 authored by Christiaan Van den Poel's avatar Christiaan Van den Poel Committed by Phil Hughes
Browse files

disables the shortcut to the issue boards when issues are disabled

parent 15f7f52b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -86,4 +86,8 @@ class Projects::ApplicationController < ApplicationController
def require_pages_enabled!
not_found unless @project.pages_available?
end
def check_issues_available!
return render_404 unless @project.feature_available?(:issues, current_user)
end
end
Loading
Loading
@@ -2,6 +2,7 @@ class Projects::BoardsController < Projects::ApplicationController
include BoardsResponses
include IssuableCollections
 
before_action :check_issues_available!
before_action :authorize_read_board!, only: [:index, :show]
before_action :assign_endpoint_vars
 
Loading
Loading
Loading
Loading
@@ -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)
end
 
def check_issues_available!
return render_404 unless @project.feature_available?(:issues, current_user)
end
def render_issue_json
if @issue.valid?
render json: serializer.represent(@issue)
Loading
Loading
Loading
Loading
@@ -299,9 +299,10 @@
Charts
 
-# Shortcut to Issues > New Issue
%li.hidden
= link_to new_project_issue_path(@project), class: 'shortcuts-new-issue' do
Create a new issue
- if project_nav_tab?(:issues)
%li.hidden
= link_to new_project_issue_path(@project), class: 'shortcuts-new-issue' do
Create a new issue
 
-# Shortcut to Pipelines > Jobs
- if project_nav_tab? :builds
Loading
Loading
@@ -316,5 +317,6 @@
Commits
 
-# Shortcut to issue boards
%li.hidden
= link_to 'Issue Boards', project_boards_path(@project), title: 'Issue Boards', class: 'shortcuts-issue-boards'
- if project_nav_tab?(:issues)
%li.hidden
= link_to 'Issue Boards', project_boards_path(@project), title: 'Issue Boards', class: 'shortcuts-issue-boards'
---
title: disables shortcut to issue boards when issues are not enabled
merge_request: 16020
author: Christiaan Van den Poel
type: fixed
Loading
Loading
@@ -55,6 +55,16 @@ describe Projects::BoardsController do
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)
get :index, namespace_id: project.namespace,
project_id: project,
Loading
Loading
require 'rails_helper'
 
describe 'Issue Boards shortcut', :js do
let(:project) { create(:project) }
context 'issues are enabled' do
let(:project) { create(:project) }
 
before do
create(:board, project: project)
before do
create(:board, project: project)
 
sign_in(create(:admin))
sign_in(create(:admin))
 
visit project_path(project)
visit project_path(project)
end
it 'takes user to issue board index' do
find('body').native.send_keys('gb')
expect(page).to have_selector('.boards-list')
wait_for_requests
end
end
 
it 'takes user to issue board index' do
find('body').native.send_keys('gb')
expect(page).to have_selector('.boards-list')
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')
 
wait_for_requests
expect(page).to have_selector("body[data-page='projects:show']")
end
end
end
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment