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
46b1664b
Commit
46b1664b
authored
Feb 03, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reference extractor needs to take into account external issue tracker.
parent
3b525558
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
app/models/concerns/mentionable.rb
app/models/concerns/mentionable.rb
+4
-3
lib/gitlab/reference_extractor.rb
lib/gitlab/reference_extractor.rb
+15
-11
No files found.
app/models/concerns/mentionable.rb
View file @
46b1664b
...
...
@@ -64,9 +64,10 @@ module Mentionable
return
[]
if
text
.
blank?
ext
=
Gitlab
::
ReferenceExtractor
.
new
ext
.
analyze
(
text
,
p
)
(
ext
.
issues_for
+
ext
.
merge_requests_for
+
ext
.
commits_for
).
uniq
-
[
local_reference
]
(
ext
.
issues_for
(
p
)
+
ext
.
merge_requests_for
(
p
)
+
ext
.
commits_for
(
p
)
).
uniq
-
[
local_reference
]
end
# Create a cross-reference Note for each GFM reference to another Mentionable found in +mentionable_text+.
...
...
lib/gitlab/reference_extractor.rb
View file @
46b1664b
...
...
@@ -23,17 +23,13 @@ module Gitlab
end
def
issues_for
(
project
=
nil
)
if
project
&&
project
.
jira_tracker?
issues
.
uniq
.
map
do
|
jira_identifier
|
JiraIssue
.
new
(
jira_identifier
[
:id
])
issues
.
uniq
.
map
do
|
entry
|
if
should_lookup?
(
project
,
entry
[
:project
])
entry
[
:project
].
issues
.
where
(
iid:
entry
[
:id
]).
first
elsif
external_jira_reference?
(
project
,
entry
[
:project
])
JiraIssue
.
new
(
entry
[
:id
],
entry
[
:project
])
end
else
issues
.
map
do
|
entry
|
if
should_lookup?
(
project
,
entry
[
:project
])
entry
[
:project
].
issues
.
where
(
iid:
entry
[
:id
]).
first
end
end
.
reject
(
&
:nil?
)
end
end
.
reject
(
&
:nil?
)
end
def
merge_requests_for
(
project
=
nil
)
...
...
@@ -70,7 +66,15 @@ module Gitlab
if
entry_project
.
nil?
false
else
project
.
nil?
||
project
.
id
==
entry_project
.
id
project
.
nil?
||
entry_project
.
default_issues_tracker?
end
end
def
external_jira_reference?
(
project
,
entry_project
)
if
project
.
id
==
entry_project
.
id
project
&&
project
.
jira_tracker?
else
entry_project
&&
entry_project
.
jira_tracker?
end
end
end
...
...
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