summaryrefslogtreecommitdiff
path: root/app/helpers/issues_helper.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-07-31 10:23:50 +0200
committerDouwe Maan <douwe@selenight.nl>2017-07-31 10:23:50 +0200
commit95f9d6d83bcb7a9f45601f828c34301e536fc195 (patch)
treeed5447c85eb35ac9b7a363dd5a83514578c2fb3e /app/helpers/issues_helper.rb
parentc92881c394a482bdb6d3f0f0a5f3cc95d5eed1fc (diff)
parent6fe736f2c927340ed8cf827080db781f7c8adcdf (diff)
downloadgitlab-ce-95f9d6d83bcb7a9f45601f828c34301e536fc195.tar.gz
Merge branch 'master' into issue-discussions-refactor
# Conflicts: # app/controllers/concerns/notes_actions.rb # spec/features/task_lists_spec.rb # spec/support/features/issuable_slash_commands_shared_examples.rb
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r--app/helpers/issues_helper.rb26
1 files changed, 23 insertions, 3 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 034b4451b56..853ce827061 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -17,10 +17,10 @@ module IssuesHelper
return '' if project.nil?
url =
- if options[:only_path]
- project.issues_tracker.issue_path(issue_iid)
+ if options[:internal]
+ url_for_internal_issue(issue_iid, project, options)
else
- project.issues_tracker.issue_url(issue_iid)
+ url_for_tracker_issue(issue_iid, project, options)
end
# Ensure we return a valid URL to prevent possible XSS.
@@ -29,6 +29,24 @@ module IssuesHelper
''
end
+ def url_for_tracker_issue(issue_iid, project, options)
+ if options[:only_path]
+ project.issues_tracker.issue_path(issue_iid)
+ else
+ project.issues_tracker.issue_url(issue_iid)
+ end
+ end
+
+ def url_for_internal_issue(issue_iid, project = @project, options = {})
+ helpers = Gitlab::Routing.url_helpers
+
+ if options[:only_path]
+ helpers.namespace_project_issue_path(namespace_id: project.namespace, project_id: project, id: issue_iid)
+ else
+ helpers.namespace_project_issue_url(namespace_id: project.namespace, project_id: project, id: issue_iid)
+ end
+ end
+
def bulk_update_milestone_options
milestones = @project.milestones.active.reorder(due_date: :asc, title: :asc).to_a
milestones.unshift(Milestone::None)
@@ -158,4 +176,6 @@ module IssuesHelper
# Required for Banzai::Filter::IssueReferenceFilter
module_function :url_for_issue
+ module_function :url_for_internal_issue
+ module_function :url_for_tracker_issue
end