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
86f6f5a9
Commit
86f6f5a9
authored
Aug 15, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'redmine-fix'
parents
7de26f19
0d9f8494
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
2 deletions
+68
-2
CHANGELOG-EE
CHANGELOG-EE
+3
-0
app/models/project.rb
app/models/project.rb
+4
-0
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+15
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+46
-0
No files found.
CHANGELOG-EE
View file @
86f6f5a9
v 7.2.0
- Improve Redmine integration
v 7.1.0
- Synchronize LDAP-enabled GitLab administrators with an LDAP group (Marvin Frick, sponsored by SinnerSchrader)
- Synchronize SSH keys with LDAP (Oleg Girko (Jolla) and Marvin Frick (SinnerSchrader))
...
...
app/models/project.rb
View file @
86f6f5a9
...
...
@@ -338,6 +338,10 @@ class Project < ActiveRecord::Base
self
.
issues_tracker
==
"jira"
end
def
redmine_tracker?
self
.
issues_tracker
==
"redmine"
end
# For compatibility with old code
def
code
path
...
...
lib/gitlab/markdown.rb
View file @
86f6f5a9
...
...
@@ -192,8 +192,10 @@ module Gitlab
link_to
(
"#
#{
identifier
}
"
,
url
,
options
)
end
else
reference_jira_issue
(
identifier
,
project
)
if
project
.
jira_tracker?
elsif
project
.
redmine_tracker?
reference_redmine_issue
(
identifier
,
project
)
elsif
project
.
jira_tracker?
reference_jira_issue
(
identifier
,
project
)
end
end
...
...
@@ -239,5 +241,16 @@ module Gitlab
)
link_to
(
"
#{
identifier
}
"
,
url
,
options
)
end
def
reference_redmine_issue
(
identifier
,
project
=
@project
)
url
=
url_for_issue
(
identifier
)
title
=
Gitlab
.
config
.
issues_tracker
[
project
.
issues_tracker
][
"title"
]
options
=
html_options
.
merge
(
title:
"Issue in
#{
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
)
link_to
(
"rm#
#{
identifier
}
"
,
url
,
options
)
end
end
end
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
86f6f5a9
...
...
@@ -229,6 +229,52 @@ describe GitlabMarkdownHelper do
end
end
describe
"referencing a Redmine issue"
do
let
(
:actual
)
{
"Reference to Redmine #
#{
issue
.
iid
}
"
}
let
(
:expected
)
{
"http://redmine.example/issues/
#{
issue
.
iid
}
"
}
let
(
:reference
)
{
"#
#{
issue
.
iid
}
"
}
before
do
issue_tracker_config
=
{
"redmine"
=>
{
"title"
=>
"Redmine tracker"
,
"issues_url"
=>
"http://redmine.example/issues/:id"
}
}
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
issue_tracker_config
)
@project
.
stub
(
:issues_tracker
).
and_return
(
"redmine"
)
@project
.
stub
(
:issues_tracker_id
).
and_return
(
"REDMINE"
)
end
it
"should link using a valid id"
do
gfm
(
actual
).
should
match
(
expected
)
end
it
"should link with adjacent text"
do
# Wrap the reference in parenthesis
gfm
(
actual
.
gsub
(
reference
,
"(
#{
reference
}
)"
)).
should
match
(
expected
)
# Append some text to the end of the reference
gfm
(
actual
.
gsub
(
reference
,
"
#{
reference
}
, right?"
)).
should
match
(
expected
)
end
it
"should keep whitespace intact"
do
actual
=
"Referenced
#{
reference
}
already."
expected
=
/Referenced <a.+>[^\s]+<\/a> already/
gfm
(
actual
).
should
match
(
expected
)
end
it
"should not link with an invalid id"
do
# Modify the reference string so it's still parsed, but is invalid
invalid_reference
=
actual
.
gsub
(
/(\d+)$/
,
"r45"
)
gfm
(
invalid_reference
).
should
==
invalid_reference
end
it
"should include a title attribute"
do
title
=
"Issue in Redmine tracker"
gfm
(
actual
).
should
match
(
/title="
#{
title
}
"/
)
end
it
"should include standard gfm classes"
do
gfm
(
actual
).
should
match
(
/class="\s?gfm gfm-issue\s?"/
)
end
end
describe
"referencing a merge request"
do
let
(
:object
)
{
merge_request
}
let
(
:reference
)
{
"!
#{
merge_request
.
iid
}
"
}
...
...
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