Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9249b48c
Commit
9249b48c
authored
May 19, 2020
by
andysoiron
Committed by
Andy Soiron
May 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup Banzai ExternalIssueReferenceFilter
parent
58ddbc5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
lib/banzai/filter/external_issue_reference_filter.rb
lib/banzai/filter/external_issue_reference_filter.rb
+10
-9
No files found.
lib/banzai/filter/external_issue_reference_filter.rb
View file @
9249b48c
...
...
@@ -54,6 +54,8 @@ module Banzai
doc
end
private
# Replace `JIRA-123` issue references in text with links to the referenced
# issue's details page.
#
...
...
@@ -63,21 +65,14 @@ module Banzai
# Returns a String with `JIRA-123` references replaced with links. All
# links have `gfm` and `gfm-issue` class names attached for styling.
def
issue_link_filter
(
text
,
link_content:
nil
)
project
=
context
[
:project
]
self
.
class
.
references_in
(
text
,
issue_reference_pattern
)
do
|
match
,
id
|
ExternalIssue
.
new
(
id
,
project
)
url
=
url_for_issue
(
id
,
project
,
only_path:
context
[
:only_path
])
title
=
"Issue in
#{
project
.
external_issue_tracker
.
title
}
"
klass
=
reference_class
(
:issue
)
data
=
data_attribute
(
project:
project
.
id
,
external_issue:
id
)
content
=
link_content
||
match
%(<a href="#{url}" #{data}
title="#{escape_once(title)}"
title="#{escape_once(
issue_
title)}"
class="#{klass}">#{content}</a>)
end
end
...
...
@@ -94,7 +89,13 @@ module Banzai
external_issues_cached
(
:external_issue_reference_pattern
)
end
private
def
project
context
[
:project
]
end
def
issue_title
"Issue in
#{
project
.
external_issue_tracker
.
title
}
"
end
def
external_issues_cached
(
attribute
)
cached_attributes
=
Gitlab
::
SafeRequestStore
[
:banzai_external_issues_tracker_attributes
]
||=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
{}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment