summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-08-14 08:51:49 -0700
committerStan Hu <stanhu@gmail.com>2015-08-14 08:51:49 -0700
commitd416a9d62428bbb26c3c6bfb2e4a1f99d275e5ce (patch)
treee762177c9517a5ec9e8b35d0c1ae833c06e53d1c
parent58247662528e992e08cc905038bbdd47dfcc9ea9 (diff)
parent3483024d93b9ca56e0bddffbbd0aff5714eb2833 (diff)
downloadgitlab-ce-d416a9d62428bbb26c3c6bfb2e4a1f99d275e5ce.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/projects/issues_controller.rb2
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb37
3 files changed, 39 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index b5cf393c6a6..0445f244f79 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,7 @@ v 7.14.0 (unreleased)
- Fix file upload dialog for comment editing (Daniel Gerhardt)
- Set OmniAuth full_host parameter to ensure redirect URIs are correct (Stan Hu)
- Return comments in created order in merge request API (Stan Hu)
+ - Disable internal issue tracker controller if external tracker is used (Stan Hu)
- Expire Rails cache entries after two weeks to prevent endless Redis growth
- Add support for destroying project milestones (Stan Hu)
- Allow custom backup archive permissions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index bfafdeeb1fb..0f89f2e88cc 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -131,7 +131,7 @@ class Projects::IssuesController < Projects::ApplicationController
end
def module_enabled
- return render_404 unless @project.issues_enabled
+ return render_404 unless @project.issues_enabled && @project.default_issues_tracker?
end
# Since iids are implemented only in 6.1
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
new file mode 100644
index 00000000000..871b9219ca9
--- /dev/null
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -0,0 +1,37 @@
+require('spec_helper')
+
+describe Projects::IssuesController do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:issue) { create(:issue, project: project) }
+
+ before do
+ sign_in(user)
+ project.team << [user, :developer]
+ controller.instance_variable_set(:@project, project)
+ end
+
+ describe "GET #index" do
+ it "returns index" do
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+
+ expect(response.status).to eq(200)
+ end
+
+ it "returns 404 when issues are disabled" do
+ project.issues_enabled = false
+ project.save
+
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+ expect(response.status).to eq(404)
+ end
+
+ it "returns 404 when external issue tracker is enabled" do
+ allow(project).to receive(:default_issues_tracker?).and_return(false)
+
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+ expect(response.status).to eq(404)
+ end
+
+ end
+end