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
c5de2ce7
Commit
c5de2ce7
authored
Mar 24, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return full URLs from GitLabIssueTrackerService.
parent
28592ae4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
CHANGELOG
CHANGELOG
+1
-0
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+9
-10
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+2
-2
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
...els/project_services/gitlab_issue_tracker_service_spec.rb
+7
-7
No files found.
CHANGELOG
View file @
c5de2ce7
...
...
@@ -46,6 +46,7 @@ v 7.10.0 (unreleased)
- Refactor issue filtering
- AJAX selectbox for issue assignee and author filters
- Fix issue with missing options in issue filtering dropdown if selected one
- Get issue links in notification mail to work again.
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
c5de2ce7
...
...
@@ -20,8 +20,13 @@
class
GitlabIssueTrackerService
<
IssueTrackerService
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?
true
...
...
@@ -32,20 +37,14 @@ class GitlabIssueTrackerService < IssueTrackerService
end
def
project_url
"
#{
gitlab_url
}#{
namespace_project_issues_path
(
project
.
namespace
,
project
)
}
"
namespace_project_issues_url
(
project
.
namespace
,
project
)
end
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
def
issue_url
(
iid
)
"
#{
gitlab_url
}#{
namespace_project_issue_path
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
iid
)
}
"
end
private
def
gitlab_url
Gitlab
.
config
.
gitlab
.
relative_url_root
.
chomp
(
"/"
)
if
Gitlab
.
config
.
gitlab
.
relative_url_root
namespace_project_issue_url
(
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
iid
)
end
end
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
c5de2ce7
...
...
@@ -522,7 +522,7 @@ describe GitlabMarkdownHelper do
# First issue link
expect
(
groups
[
1
]).
to
match
(
/href="
#{
namespace_project_issue_
path
(
project
.
namespace
,
project
,
issues
[
0
])
}
"/
)
to
match
(
/href="
#{
namespace_project_issue_
url
(
project
.
namespace
,
project
,
issues
[
0
])
}
"/
)
expect
(
groups
[
1
]).
to
match
(
/#
#{
issues
[
0
].
iid
}
$/
)
# Internal commit link
...
...
@@ -531,7 +531,7 @@ describe GitlabMarkdownHelper do
# Second issue link
expect
(
groups
[
3
]).
to
match
(
/href="
#{
namespace_project_issue_
path
(
project
.
namespace
,
project
,
issues
[
1
])
}
"/
)
to
match
(
/href="
#{
namespace_project_issue_
url
(
project
.
namespace
,
project
,
issues
[
1
])
}
"/
)
expect
(
groups
[
3
]).
to
match
(
/#
#{
issues
[
1
].
iid
}
$/
)
# Trailing commit link
...
...
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
View file @
c5de2ce7
...
...
@@ -39,15 +39,15 @@ describe GitlabIssueTrackerService do
end
it
'should give the correct path'
do
expect
(
@service
.
project_url
).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
new_issue_url
).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
issue_url
(
432
)).
to
eq
(
"/
#{
project
.
path_with_namespace
}
/issues/432"
)
expect
(
@service
.
project_url
).
to
eq
(
"
http://localhost
/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
new_issue_url
).
to
eq
(
"
http://localhost
/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
issue_url
(
432
)).
to
eq
(
"
http://localhost
/
#{
project
.
path_with_namespace
}
/issues/432"
)
end
end
context
'with enabled relative urls'
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
)
end
...
...
@@ -56,9 +56,9 @@ describe GitlabIssueTrackerService do
end
it
'should give the correct path'
do
expect
(
@service
.
project_url
).
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
.
issue_url
(
432
)).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
expect
(
@service
.
project_url
).
to
eq
(
"
http://localhost
/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
@service
.
new_issue_url
).
to
eq
(
"
http://localhost
/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
@service
.
issue_url
(
432
)).
to
eq
(
"
http://localhost
/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
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