2015-12-15 14:51:16 +00:00
|
|
|
module Banzai
|
|
|
|
module Filter
|
2015-04-14 22:34:01 +00:00
|
|
|
# HTML filter that replaces issue references with links. References to
|
|
|
|
# issues that do not exist are ignored.
|
2015-04-03 00:46:43 +00:00
|
|
|
#
|
|
|
|
# This filter supports cross-project references.
|
2016-10-06 22:05:27 +00:00
|
|
|
#
|
|
|
|
# When external issues tracker like Jira is activated we should not
|
|
|
|
# use issue reference pattern, but we should still be able
|
|
|
|
# to reference issues from other GitLab projects.
|
2017-12-01 09:21:05 +00:00
|
|
|
class IssueReferenceFilter < IssuableReferenceFilter
|
2016-05-26 11:16:43 +00:00
|
|
|
self.reference_type = :issue
|
|
|
|
|
2015-11-16 20:56:28 +00:00
|
|
|
def self.object_class
|
|
|
|
Issue
|
2015-04-03 00:46:43 +00:00
|
|
|
end
|
|
|
|
|
2015-11-16 20:56:28 +00:00
|
|
|
def url_for_object(issue, project)
|
2017-07-10 07:38:42 +00:00
|
|
|
IssuesHelper.url_for_issue(issue.iid, project, only_path: context[:only_path], internal: true)
|
2015-04-03 00:46:43 +00:00
|
|
|
end
|
2016-06-01 15:39:12 +00:00
|
|
|
|
2016-09-27 15:13:08 +00:00
|
|
|
def projects_relation_for_paths(paths)
|
2016-06-01 15:39:12 +00:00
|
|
|
super(paths).includes(:gitlab_issue_tracker_service)
|
|
|
|
end
|
2017-12-01 09:21:05 +00:00
|
|
|
|
|
|
|
def parent_records(parent, ids)
|
|
|
|
parent.issues.where(iid: ids.to_a)
|
|
|
|
end
|
2015-04-03 00:46:43 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|