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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
96d093e5
Commit
96d093e5
authored
Mar 31, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'email-full-url'
parents
0191857f
e08d947e
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
117 additions
and
64 deletions
+117
-64
CHANGELOG
CHANGELOG
+1
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+18
-6
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+18
-7
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+12
-0
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+1
-1
app/views/notify/_note_message.html.haml
app/views/notify/_note_message.html.haml
+1
-1
app/views/notify/new_issue_email.html.haml
app/views/notify/new_issue_email.html.haml
+1
-1
app/views/notify/new_merge_request_email.html.haml
app/views/notify/new_merge_request_email.html.haml
+1
-1
app/views/projects/_dropdown.html.haml
app/views/projects/_dropdown.html.haml
+1
-1
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+53
-37
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+1
-1
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
...els/project_services/gitlab_issue_tracker_service_spec.rb
+9
-8
No files found.
CHANGELOG
View file @
96d093e5
...
@@ -48,6 +48,7 @@ v 7.10.0 (unreleased)
...
@@ -48,6 +48,7 @@ v 7.10.0 (unreleased)
- Prevent note form from being cleared when submitting failed.
- Prevent note form from being cleared when submitting failed.
- Improve file icons rendering on tree (Sullivan Sénéchal)
- Improve file icons rendering on tree (Sullivan Sénéchal)
- API: Add pagination to project events
- API: Add pagination to project events
- Get issue links in notification mail to work again.
v 7.9.0
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.
- Send EmailsOnPush email when branch or tag is created or deleted.
...
...
app/helpers/issues_helper.rb
View file @
96d093e5
...
@@ -13,23 +13,35 @@ module IssuesHelper
...
@@ -13,23 +13,35 @@ module IssuesHelper
OpenStruct
.
new
(
id:
0
,
title:
'None (backlog)'
,
name:
'Unassigned'
)
OpenStruct
.
new
(
id:
0
,
title:
'None (backlog)'
,
name:
'Unassigned'
)
end
end
def
url_for_project_issues
(
project
=
@project
)
def
url_for_project_issues
(
project
=
@project
,
options
=
{}
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
options
[
:only_path
]
project
.
issues_tracker
.
project_path
else
project
.
issues_tracker
.
project_url
project
.
issues_tracker
.
project_url
end
end
end
def
url_for_new_issue
(
project
=
@project
)
def
url_for_new_issue
(
project
=
@project
,
options
=
{}
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
options
[
:only_path
]
project
.
issues_tracker
.
new_issue_path
else
project
.
issues_tracker
.
new_issue_url
project
.
issues_tracker
.
new_issue_url
end
end
end
def
url_for_issue
(
issue_iid
,
project
=
@project
)
def
url_for_issue
(
issue_iid
,
project
=
@project
,
options
=
{}
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
options
[
:only_path
]
project
.
issues_tracker
.
issue_path
(
issue_iid
)
else
project
.
issues_tracker
.
issue_url
(
issue_iid
)
project
.
issues_tracker
.
issue_url
(
issue_iid
)
end
end
end
def
title_for_issue
(
issue_iid
,
project
=
@project
)
def
title_for_issue
(
issue_iid
,
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
96d093e5
...
@@ -20,8 +20,13 @@
...
@@ -20,8 +20,13 @@
class
GitlabIssueTrackerService
<
IssueTrackerService
class
GitlabIssueTrackerService
<
IssueTrackerService
include
Rails
.
application
.
routes
.
url_helpers
include
Rails
.
application
.
routes
.
url_helpers
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
default_url_options
[
:host
]
=
Gitlab
.
config
.
gitlab
.
host
default_url_options
[
:protocol
]
=
Gitlab
.
config
.
gitlab
.
protocol
default_url_options
[
:port
]
=
Gitlab
.
config
.
gitlab
.
port
unless
Gitlab
.
config
.
gitlab_on_standard_port?
default_url_options
[
:script_name
]
=
Gitlab
.
config
.
gitlab
.
relative_url_root
prop_accessor
:title
,
:description
,
:project_url
,
:issues_url
,
:new_issue_url
def
default?
def
default?
true
true
...
@@ -32,20 +37,26 @@ class GitlabIssueTrackerService < IssueTrackerService
...
@@ -32,20 +37,26 @@ class GitlabIssueTrackerService < IssueTrackerService
end
end
def
project_url
def
project_url
"
#{
gitlab_url
}#{
namespace_project_issues_path
(
project
.
namespace
,
project
)
}
"
namespace_project_issues_url
(
project
.
namespace
,
project
)
end
end
def
new_issue_url
def
new_issue_url
"
#{
gitlab_url
}#{
new_namespace_project_issue_path
(
namespace_id:
project
.
namespace
,
project_id:
project
)
}
"
new_namespace_project_issue_url
(
namespace_id:
project
.
namespace
,
project_id:
project
)
end
end
def
issue_url
(
iid
)
def
issue_url
(
iid
)
"
#{
gitlab_url
}#{
namespace_project_issue_path
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
iid
)
}
"
namespace_project_issue_url
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
iid
)
end
end
private
def
project_path
namespace_project_issues_path
(
project
.
namespace
,
project
)
end
def
new_issue_path
new_namespace_project_issue_path
(
namespace_id:
project
.
namespace
,
project_id:
project
)
end
def
gitlab_url
def
issue_path
(
iid
)
Gitlab
.
config
.
gitlab
.
relative_url_root
.
chomp
(
"/"
)
if
Gitlab
.
config
.
gitlab
.
relative_url_root
namespace_project_issue_path
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
iid
)
end
end
end
end
app/models/project_services/issue_tracker_service.rb
View file @
96d093e5
...
@@ -34,6 +34,18 @@ class IssueTrackerService < Service
...
@@ -34,6 +34,18 @@ class IssueTrackerService < Service
self
.
issues_url
.
gsub
(
':id'
,
iid
.
to_s
)
self
.
issues_url
.
gsub
(
':id'
,
iid
.
to_s
)
end
end
def
project_path
project_url
end
def
new_issue_path
new_issue_url
end
def
issue_path
(
iid
)
issue_url
(
iid
)
end
def
fields
def
fields
[
[
{
type:
'text'
,
name:
'description'
,
placeholder:
description
},
{
type:
'text'
,
name:
'description'
,
placeholder:
description
},
...
...
app/views/layouts/nav/_project.html.haml
View file @
96d093e5
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
-
if
project_nav_tab?
:issues
-
if
project_nav_tab?
:issues
=
nav_link
(
controller: :issues
)
do
=
nav_link
(
controller: :issues
)
do
=
link_to
url_for_project_issues
,
title:
'Issues'
,
class:
'shortcuts-issues'
do
=
link_to
url_for_project_issues
(
@project
,
only_path:
true
)
,
title:
'Issues'
,
class:
'shortcuts-issues'
do
%i
.fa.fa-exclamation-circle
%i
.fa.fa-exclamation-circle
%span
%span
Issues
Issues
...
...
app/views/notify/_note_message.html.haml
View file @
96d093e5
%div
%div
=
replace_image_links_with_base64
(
markdown
(
@note
.
note
),
@note
.
project
)
=
replace_image_links_with_base64
(
markdown
(
@note
.
note
,
reference_only_path:
false
),
@note
.
project
)
app/views/notify/new_issue_email.html.haml
View file @
96d093e5
-
if
@issue
.
description
-
if
@issue
.
description
=
replace_image_links_with_base64
(
markdown
(
@issue
.
description
),
@issue
.
project
)
=
replace_image_links_with_base64
(
markdown
(
@issue
.
description
,
reference_only_path:
false
),
@issue
.
project
)
-
if
@issue
.
assignee_id
.
present?
-
if
@issue
.
assignee_id
.
present?
%p
%p
...
...
app/views/notify/new_merge_request_email.html.haml
View file @
96d093e5
...
@@ -6,4 +6,4 @@
...
@@ -6,4 +6,4 @@
Assignee:
#{
@merge_request
.
author_name
}
→
#{
@merge_request
.
assignee_name
}
Assignee:
#{
@merge_request
.
author_name
}
→
#{
@merge_request
.
assignee_name
}
-
if
@merge_request
.
description
-
if
@merge_request
.
description
=
replace_image_links_with_base64
(
markdown
(
@merge_request
.
description
),
@merge_request
.
project
)
=
replace_image_links_with_base64
(
markdown
(
@merge_request
.
description
,
reference_only_path:
false
),
@merge_request
.
project
)
app/views/projects/_dropdown.html.haml
View file @
96d093e5
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
%ul
.dropdown-menu
%ul
.dropdown-menu
-
if
@project
.
issues_enabled
&&
can?
(
current_user
,
:write_issue
,
@project
)
-
if
@project
.
issues_enabled
&&
can?
(
current_user
,
:write_issue
,
@project
)
%li
%li
=
link_to
url_for_new_issue
,
title:
"New Issue"
do
=
link_to
url_for_new_issue
(
@project
,
only_path:
true
)
,
title:
"New Issue"
do
New issue
New issue
-
if
@project
.
merge_requests_enabled
&&
can?
(
current_user
,
:write_merge_request
,
@project
)
-
if
@project
.
merge_requests_enabled
&&
can?
(
current_user
,
:write_merge_request
,
@project
)
%li
%li
...
...
lib/gitlab/markdown.rb
View file @
96d093e5
...
@@ -32,12 +32,12 @@ module Gitlab
...
@@ -32,12 +32,12 @@ module Gitlab
module
Markdown
module
Markdown
include
IssuesHelper
include
IssuesHelper
attr_reader
:html_options
attr_reader
:
options
,
:
html_options
# Public: Parse the provided text with GitLab-Flavored Markdown
# Public: Parse the provided text with GitLab-Flavored Markdown
#
#
# text - the source text
# text - the source text
# project -
extra options for the reference links as given to link_to
# project -
the project
# html_options - extra options for the reference links as given to link_to
# html_options - extra options for the reference links as given to link_to
def
gfm
(
text
,
project
=
@project
,
html_options
=
{})
def
gfm
(
text
,
project
=
@project
,
html_options
=
{})
gfm_with_options
(
text
,
{},
project
,
html_options
)
gfm_with_options
(
text
,
{},
project
,
html_options
)
...
@@ -46,9 +46,10 @@ module Gitlab
...
@@ -46,9 +46,10 @@ module Gitlab
# Public: Parse the provided text with GitLab-Flavored Markdown
# Public: Parse the provided text with GitLab-Flavored Markdown
#
#
# text - the source text
# text - the source text
# options - parse_tasks: true - render tasks
# options - parse_tasks - render tasks
# - xhtml: true - output XHTML instead of HTML
# - xhtml - output XHTML instead of HTML
# project - extra options for the reference links as given to link_to
# - reference_only_path - Use relative path for reference links
# project - the project
# html_options - extra options for the reference links as given to link_to
# html_options - extra options for the reference links as given to link_to
def
gfm_with_options
(
text
,
options
=
{},
project
=
@project
,
html_options
=
{})
def
gfm_with_options
(
text
,
options
=
{},
project
=
@project
,
html_options
=
{})
return
text
if
text
.
nil?
return
text
if
text
.
nil?
...
@@ -58,6 +59,13 @@ module Gitlab
...
@@ -58,6 +59,13 @@ module Gitlab
# for gsub calls to work as we need them to.
# for gsub calls to work as we need them to.
text
=
text
.
dup
.
to_str
text
=
text
.
dup
.
to_str
options
.
reverse_merge!
(
parse_tasks:
false
,
xhtml:
false
,
reference_only_path:
true
)
@options
=
options
@html_options
=
html_options
@html_options
=
html_options
# Extract pre blocks so they are not altered
# Extract pre blocks so they are not altered
...
@@ -113,12 +121,13 @@ module Gitlab
...
@@ -113,12 +121,13 @@ module Gitlab
markdown_pipeline
=
HTML
::
Pipeline
::
Gitlab
.
new
(
filters
).
pipeline
markdown_pipeline
=
HTML
::
Pipeline
::
Gitlab
.
new
(
filters
).
pipeline
result
=
markdown_pipeline
.
call
(
text
,
markdown_context
)
result
=
markdown_pipeline
.
call
(
text
,
markdown_context
)
saveoptions
=
0
save_options
=
0
if
options
[
:xhtml
]
if
options
[
:xhtml
]
saveoptions
|=
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
save
_
options
|=
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
end
end
text
=
result
[
:output
].
to_html
(
save_with:
saveoptions
)
text
=
result
[
:output
].
to_html
(
save_with:
save
_
options
)
if
options
[
:parse_tasks
]
if
options
[
:parse_tasks
]
text
=
parse_tasks
(
text
)
text
=
parse_tasks
(
text
)
...
@@ -229,33 +238,37 @@ module Gitlab
...
@@ -229,33 +238,37 @@ module Gitlab
end
end
def
reference_user
(
identifier
,
project
=
@project
,
_
=
nil
)
def
reference_user
(
identifier
,
project
=
@project
,
_
=
nil
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
class:
"gfm gfm-project_member
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-project_member
#{
html_options
[
:class
]
}
"
)
)
if
identifier
==
"all"
if
identifier
==
"all"
link_to
(
"@all"
,
namespace_project_url
(
project
.
namespace
,
project
),
options
)
link_to
(
"@all"
,
namespace_project_url
(
project
.
namespace
,
project
,
only_path:
options
[
:reference_only_path
]),
link_options
)
elsif
namespace
=
Namespace
.
find_by
(
path:
identifier
)
elsif
namespace
=
Namespace
.
find_by
(
path:
identifier
)
url
=
url
=
if
namespace
.
type
==
"Group"
if
namespace
.
type
==
"Group"
group_url
(
identifier
)
group_url
(
identifier
,
only_path:
options
[
:reference_only_path
]
)
else
else
user_url
(
identifier
)
user_url
(
identifier
,
only_path:
options
[
:reference_only_path
]
)
end
end
link_to
(
"@
#{
identifier
}
"
,
url
,
options
)
link_to
(
"@
#{
identifier
}
"
,
url
,
link_
options
)
end
end
end
end
def
reference_label
(
identifier
,
project
=
@project
,
_
=
nil
)
def
reference_label
(
identifier
,
project
=
@project
,
_
=
nil
)
if
label
=
project
.
labels
.
find_by
(
id:
identifier
)
if
label
=
project
.
labels
.
find_by
(
id:
identifier
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
class:
"gfm gfm-label
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-label
#{
html_options
[
:class
]
}
"
)
)
link_to
(
link_to
(
render_colored_label
(
label
),
render_colored_label
(
label
),
namespace_project_issues_path
(
project
.
namespace
,
project
,
label_name:
label
.
name
),
namespace_project_issues_path
(
project
.
namespace
,
project
,
label_name:
label
.
name
),
options
link_
options
)
)
end
end
end
end
...
@@ -263,14 +276,14 @@ module Gitlab
...
@@ -263,14 +276,14 @@ module Gitlab
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
if
project
.
default_issues_tracker?
if
project
.
default_issues_tracker?
if
project
.
issue_exists?
identifier
if
project
.
issue_exists?
identifier
url
=
url_for_issue
(
identifier
,
project
)
url
=
url_for_issue
(
identifier
,
project
,
only_path:
options
[
:reference_only_path
]
)
title
=
title_for_issue
(
identifier
,
project
)
title
=
title_for_issue
(
identifier
,
project
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
"Issue:
#{
title
}
"
,
title:
"Issue:
#{
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
)
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
link_
options
)
end
end
else
else
if
project
.
external_issue_tracker
.
present?
if
project
.
external_issue_tracker
.
present?
...
@@ -280,44 +293,46 @@ module Gitlab
...
@@ -280,44 +293,46 @@ module Gitlab
end
end
end
end
def
reference_merge_request
(
identifier
,
project
=
@project
,
def
reference_merge_request
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
prefix_text
=
nil
)
if
merge_request
=
project
.
merge_requests
.
find_by
(
iid:
identifier
)
if
merge_request
=
project
.
merge_requests
.
find_by
(
iid:
identifier
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
"Merge Request:
#{
merge_request
.
title
}
"
,
title:
"Merge Request:
#{
merge_request
.
title
}
"
,
class:
"gfm gfm-merge_request
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-merge_request
#{
html_options
[
:class
]
}
"
)
)
url
=
namespace_project_merge_request_url
(
project
.
namespace
,
project
,
url
=
namespace_project_merge_request_url
(
project
.
namespace
,
project
,
merge_request
)
merge_request
,
link_to
(
"
#{
prefix_text
}
!
#{
identifier
}
"
,
url
,
options
)
only_path:
options
[
:reference_only_path
])
link_to
(
"
#{
prefix_text
}
!
#{
identifier
}
"
,
url
,
link_options
)
end
end
end
end
def
reference_snippet
(
identifier
,
project
=
@project
,
_
=
nil
)
def
reference_snippet
(
identifier
,
project
=
@project
,
_
=
nil
)
if
snippet
=
project
.
snippets
.
find_by
(
id:
identifier
)
if
snippet
=
project
.
snippets
.
find_by
(
id:
identifier
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
"Snippet:
#{
snippet
.
title
}
"
,
title:
"Snippet:
#{
snippet
.
title
}
"
,
class:
"gfm gfm-snippet
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-snippet
#{
html_options
[
:class
]
}
"
)
)
link_to
(
link_to
(
"$
#{
identifier
}
"
,
"$
#{
identifier
}
"
,
namespace_project_snippet_url
(
project
.
namespace
,
project
,
snippet
),
namespace_project_snippet_url
(
project
.
namespace
,
project
,
snippet
,
options
only_path:
options
[
:reference_only_path
]),
link_options
)
)
end
end
end
end
def
reference_commit
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
def
reference_commit
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
if
project
.
valid_repo?
&&
commit
=
project
.
repository
.
commit
(
identifier
)
if
project
.
valid_repo?
&&
commit
=
project
.
repository
.
commit
(
identifier
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
commit
.
link_title
,
title:
commit
.
link_title
,
class:
"gfm gfm-commit
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-commit
#{
html_options
[
:class
]
}
"
)
)
prefix_text
=
"
#{
prefix_text
}
@"
if
prefix_text
prefix_text
=
"
#{
prefix_text
}
@"
if
prefix_text
link_to
(
link_to
(
"
#{
prefix_text
}#{
identifier
}
"
,
"
#{
prefix_text
}#{
identifier
}
"
,
namespace_project_commit_url
(
project
.
namespace
,
project
,
commit
),
namespace_project_commit_url
(
project
.
namespace
,
project
,
commit
,
options
only_path:
options
[
:reference_only_path
]),
link_options
)
)
end
end
end
end
...
@@ -332,7 +347,7 @@ module Gitlab
...
@@ -332,7 +347,7 @@ module Gitlab
from
=
project
.
repository
.
commit
(
from_id
)
&&
from
=
project
.
repository
.
commit
(
from_id
)
&&
to
=
project
.
repository
.
commit
(
to_id
)
to
=
project
.
repository
.
commit
(
to_id
)
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
"Commits
#{
from_id
}
through
#{
to_id
}
"
,
title:
"Commits
#{
from_id
}
through
#{
to_id
}
"
,
class:
"gfm gfm-commit_range
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-commit_range
#{
html_options
[
:class
]
}
"
)
)
...
@@ -340,22 +355,23 @@ module Gitlab
...
@@ -340,22 +355,23 @@ module Gitlab
link_to
(
link_to
(
"
#{
prefix_text
}#{
identifier
}
"
,
"
#{
prefix_text
}#{
identifier
}
"
,
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
from_id
,
to:
to_id
),
namespace_project_compare_url
(
project
.
namespace
,
project
,
options
from:
from_id
,
to:
to_id
,
only_path:
options
[
:reference_only_path
]),
link_options
)
)
end
end
end
end
def
reference_external_issue
(
identifier
,
project
=
@project
,
def
reference_external_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
prefix_text
=
nil
)
url
=
url_for_issue
(
identifier
,
project
,
only_path:
options
[
:reference_only_path
])
url
=
url_for_issue
(
identifier
,
project
)
title
=
project
.
external_issue_tracker
.
title
title
=
project
.
external_issue_tracker
.
title
options
=
html_options
.
merge
(
link_
options
=
html_options
.
merge
(
title:
"Issue in
#{
title
}
"
,
title:
"Issue in
#{
title
}
"
,
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-issue
#{
html_options
[
:class
]
}
"
)
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
options
)
link_to
(
"
#{
prefix_text
}
#
#{
identifier
}
"
,
url
,
link_
options
)
end
end
# Turn list items that start with "[ ]" into HTML checkbox inputs.
# Turn list items that start with "[ ]" into HTML checkbox inputs.
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
96d093e5
...
@@ -651,7 +651,7 @@ describe GitlabMarkdownHelper do
...
@@ -651,7 +651,7 @@ describe GitlabMarkdownHelper do
end
end
it
"should leave ref-like href of 'manual' links untouched"
do
it
"should leave ref-like href of 'manual' links untouched"
do
expect
(
markdown
(
"why not [inspect !
#{
merge_request
.
iid
}
](http://example.tld/#!
#{
merge_request
.
iid
}
)"
)).
to
eq
(
"<p>why not <a href=
\"
http://example.tld/#!
#{
merge_request
.
iid
}
\"
>inspect </a><a class=
\"
gfm gfm-merge_request
\"
href=
\"
#{
namespace_project_merge_request_
url
(
project
.
namespace
,
project
,
merge_request
)
}
\"
title=
\"
Merge Request:
#{
merge_request
.
title
}
\"
>!
#{
merge_request
.
iid
}
</a><a href=
\"
http://example.tld/#!
#{
merge_request
.
iid
}
\"
></a></p>
\n
"
)
expect
(
markdown
(
"why not [inspect !
#{
merge_request
.
iid
}
](http://example.tld/#!
#{
merge_request
.
iid
}
)"
)).
to
eq
(
"<p>why not <a href=
\"
http://example.tld/#!
#{
merge_request
.
iid
}
\"
>inspect </a><a class=
\"
gfm gfm-merge_request
\"
href=
\"
#{
namespace_project_merge_request_
path
(
project
.
namespace
,
project
,
merge_request
)
}
\"
title=
\"
Merge Request:
#{
merge_request
.
title
}
\"
>!
#{
merge_request
.
iid
}
</a><a href=
\"
http://example.tld/#!
#{
merge_request
.
iid
}
\"
></a></p>
\n
"
)
end
end
it
"should leave ref-like src of images untouched"
do
it
"should leave ref-like src of images untouched"
do
...
...
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
View file @
96d093e5
...
@@ -31,6 +31,7 @@ describe GitlabIssueTrackerService do
...
@@ -31,6 +31,7 @@ describe GitlabIssueTrackerService do
context
'with absolute urls'
do
context
'with absolute urls'
do
before
do
before
do
GitlabIssueTrackerService
.
default_url_options
[
:script_name
]
=
"/gitlab/root"
@service
=
project
.
create_gitlab_issue_tracker_service
(
active:
true
)
@service
=
project
.
create_gitlab_issue_tracker_service
(
active:
true
)
end
end
...
@@ -39,15 +40,15 @@ describe GitlabIssueTrackerService do
...
@@ -39,15 +40,15 @@ describe GitlabIssueTrackerService do
end
end
it
'should give the correct path'
do
it
'should give the correct path'
do
expect
(
@service
.
project_url
).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
project_url
).
to
eq
(
"
http://localhost/gitlab/root
/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
new_issue_url
).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
new_issue_url
).
to
eq
(
"
http://localhost/gitlab/root
/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
issue_url
(
432
)).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues/432"
)
expect
(
@service
.
issue_url
(
432
)).
to
eq
(
"
http://localhost/gitlab/root
/
#{
project
.
path_with_namespace
}
/issues/432"
)
end
end
end
end
context
'with
enabled
relative urls'
do
context
'with relative urls'
do
before
do
before
do
Settings
.
gitlab
.
stub
(
:relative_url_root
).
and_return
(
"/gitlab/root"
)
GitlabIssueTrackerService
.
default_url_options
[
:script_name
]
=
"/gitlab/root"
@service
=
project
.
create_gitlab_issue_tracker_service
(
active:
true
)
@service
=
project
.
create_gitlab_issue_tracker_service
(
active:
true
)
end
end
...
@@ -56,9 +57,9 @@ describe GitlabIssueTrackerService do
...
@@ -56,9 +57,9 @@ describe GitlabIssueTrackerService do
end
end
it
'should give the correct path'
do
it
'should give the correct path'
do
expect
(
@service
.
project_
url
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
project_
path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
new_issue_
url
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
new_issue_
path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
issue_
url
(
432
)).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
expect
(
@service
.
issue_
path
(
432
)).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
end
end
end
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