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
Jérome Perrin
gitlab-ce
Commits
3715c1cf
Commit
3715c1cf
authored
Jul 17, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix external issue trackers redirect
parent
05329d4a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
11 deletions
+15
-11
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+1
-1
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+2
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+10
-6
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
...els/project_services/gitlab_issue_tracker_service_spec.rb
+1
-1
No files found.
app/controllers/projects/issues_controller.rb
View file @
3715c1cf
...
...
@@ -266,7 +266,7 @@ class Projects::IssuesController < Projects::ApplicationController
if
action_name
==
'new'
redirect_to
external
.
new_issue_path
else
redirect_to
external
.
project
_path
redirect_to
external
.
issue_tracker
_path
end
end
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
3715c1cf
...
...
@@ -23,7 +23,7 @@ class GitlabIssueTrackerService < IssueTrackerService
project_issue_url
(
project
,
id:
iid
)
end
def
project
_path
def
issue_tracker
_path
project_issues_path
(
project
)
end
...
...
app/models/project_services/issue_tracker_service.rb
View file @
3715c1cf
...
...
@@ -20,8 +20,8 @@ class IssueTrackerService < Service
self
.
issues_url
.
gsub
(
':id'
,
iid
.
to_s
)
end
def
project
_path
read_attribute
(
:project_url
)
def
issue_tracker
_path
project_url
end
def
new_issue_path
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
3715c1cf
...
...
@@ -7,14 +7,16 @@ describe Projects::IssuesController do
describe
"GET #index"
do
context
'external issue tracker'
do
let!
(
:service
)
do
create
(
:custom_issue_tracker_service
,
project:
project
,
title:
'Custom Issue Tracker'
,
project_url:
'http://test.com'
)
end
it
'redirects to the external issue tracker'
do
external
=
double
(
project_path:
'https://example.com/project'
)
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
external
)
controller
.
instance_variable_set
(
:@project
,
project
)
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
redirect_to
(
'https://example.com/project'
)
expect
(
response
).
to
redirect_to
(
service
.
issue_tracker_path
)
end
end
...
...
@@ -139,19 +141,21 @@ describe Projects::IssuesController do
end
context
'external issue tracker'
do
let!
(
:service
)
do
create
(
:custom_issue_tracker_service
,
project:
project
,
title:
'Custom Issue Tracker'
,
new_issue_url:
'http://test.com'
)
end
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:developer
]
end
it
'redirects to the external issue tracker'
do
external
=
double
(
new_issue_path:
'https://example.com/issues/new'
)
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
external
)
controller
.
instance_variable_set
(
:@project
,
project
)
get
:new
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
redirect_to
(
'http
s://example.com/issues/new
'
)
expect
(
response
).
to
redirect_to
(
'http
://test.com
'
)
end
end
end
...
...
spec/models/project_services/gitlab_issue_tracker_service_spec.rb
View file @
3715c1cf
...
...
@@ -43,7 +43,7 @@ describe GitlabIssueTrackerService, models: true do
end
it
'gives the correct path'
do
expect
(
service
.
project
_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
service
.
issue_tracker
_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues"
)
expect
(
service
.
new_issue_path
).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/new"
)
expect
(
service
.
issue_path
(
432
)).
to
eq
(
"/gitlab/root/
#{
project
.
path_with_namespace
}
/issues/432"
)
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