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
ff046c72
Commit
ff046c72
authored
Oct 17, 2013
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fallback to internal issue tracker if config is invalid.
parent
e9142c6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+8
-3
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+33
-0
No files found.
app/helpers/issues_helper.rb
View file @
ff046c72
...
...
@@ -16,7 +16,7 @@ module IssuesHelper
def
url_for_project_issues
return
""
if
@project
.
nil?
if
@project
.
used_default_issues_tracker?
if
@project
.
used_default_issues_tracker?
||
config_disabled?
project_issues_path
(
@project
)
else
url
=
Gitlab
.
config
.
issues_tracker
[
@project
.
issues_tracker
][
"project_url"
]
...
...
@@ -28,7 +28,7 @@ module IssuesHelper
def
url_for_new_issue
return
""
if
@project
.
nil?
if
@project
.
used_default_issues_tracker?
if
@project
.
used_default_issues_tracker?
||
config_disabled?
url
=
new_project_issue_path
project_id:
@project
else
url
=
Gitlab
.
config
.
issues_tracker
[
@project
.
issues_tracker
][
"new_issue_url"
]
...
...
@@ -40,7 +40,7 @@ module IssuesHelper
def
url_for_issue
(
issue_iid
)
return
""
if
@project
.
nil?
if
@project
.
used_default_issues_tracker?
if
@project
.
used_default_issues_tracker?
||
config_disabled?
url
=
project_issue_url
project_id:
@project
,
id:
issue_iid
else
url
=
Gitlab
.
config
.
issues_tracker
[
@project
.
issues_tracker
][
"issues_url"
]
...
...
@@ -59,4 +59,9 @@ module IssuesHelper
""
end
end
def
config_disabled?
return
false
if
Gitlab
.
config
.
issues_tracker
&&
Gitlab
.
config
.
issues_tracker
.
values
.
any?
true
end
end
spec/helpers/issues_helper_spec.rb
View file @
ff046c72
...
...
@@ -47,6 +47,17 @@ describe IssuesHelper do
url_for_project_issues
.
should
eq
""
end
describe
"when external tracker was enabled and then config removed"
do
before
do
@project
=
ext_project
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
nil
)
end
it
"should return path to internal tracker"
do
url_for_project_issues
.
should
match
(
polymorphic_path
([
@project
]))
end
end
end
describe
:url_for_issue
do
...
...
@@ -75,6 +86,17 @@ describe IssuesHelper do
url_for_issue
(
issue
.
iid
).
should
eq
""
end
describe
"when external tracker was enabled and then config removed"
do
before
do
@project
=
ext_project
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
nil
)
end
it
"should return internal path"
do
url_for_issue
(
issue
.
iid
).
should
match
(
polymorphic_path
([
@project
,
issue
]))
end
end
end
describe
:url_for_new_issue
do
...
...
@@ -101,6 +123,17 @@ describe IssuesHelper do
url_for_new_issue
.
should
eq
""
end
describe
"when external tracker was enabled and then config removed"
do
before
do
@project
=
ext_project
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
nil
)
end
it
"should return internal path"
do
url_for_new_issue
.
should
match
(
new_project_issue_path
(
@project
))
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