summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-08-02 23:22:30 +0000
committerDouwe Maan <douwe@gitlab.com>2016-08-02 23:22:30 +0000
commitb69cc5239d87f5ad14870031147f06ca0ac4f938 (patch)
tree1d6548f2865eeba27efbbf79b4e963c4851fd709 /app/controllers
parent8c8bdb79e53d04f7a9dbb9ff8d575f1f9111b371 (diff)
parent901d4d2ca54d173f9c6b1f39c7548ef7fc9e8cd7 (diff)
downloadgitlab-ce-b69cc5239d87f5ad14870031147f06ca0ac4f938.tar.gz
Merge branch 'rs-external-issue-tracker-redirect' into 'master'
Redirect to external issue tracker from `/issues` Prior, in order to display the correct link to "Issues" in the project navigation, we were performing a check against the project to see if it used an external issue tracker, and if so, we used that URL. This was inefficient. Now, we simply _always_ link to `namespace_project_issues_path`, and then in the controller we redirect to the external tracker if it's present. This also removes the need for the `url_for_issue` helper. Bonus! :tada: See merge request !5608
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/issues_controller.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 7f5c3ff3d6a..660e0eba06f 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -5,6 +5,7 @@ class Projects::IssuesController < Projects::ApplicationController
include ToggleAwardEmoji
include IssuableCollections
+ before_action :redirect_to_external_issue_tracker, only: [:index, :new]
before_action :module_enabled
before_action :issue, only: [:edit, :update, :show, :referenced_merge_requests,
:related_branches, :can_create_branch]
@@ -201,6 +202,18 @@ class Projects::IssuesController < Projects::ApplicationController
return render_404 unless @project.issues_enabled && @project.default_issues_tracker?
end
+ def redirect_to_external_issue_tracker
+ external = @project.external_issue_tracker
+
+ return unless external
+
+ if action_name == 'new'
+ redirect_to external.new_issue_path
+ else
+ redirect_to external.issues_url
+ end
+ end
+
# Since iids are implemented only in 6.1
# user may navigate to issue page using old global ids.
#