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
c50f2e15
Commit
c50f2e15
authored
Apr 18, 2016
by
Douglas Barbosa Alexandre
Committed by
Yorick Peterse
Apr 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GitHub project's link on import page when provider has a custom URL
parent
fd4c8333
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
CHANGELOG
CHANGELOG
+1
-0
app/helpers/import_helper.rb
app/helpers/import_helper.rb
+18
-0
app/views/import/github/status.html.haml
app/views/import/github/status.html.haml
+2
-2
spec/helpers/import_helper_spec.rb
spec/helpers/import_helper_spec.rb
+25
-0
No files found.
CHANGELOG
View file @
c50f2e15
...
...
@@ -97,6 +97,7 @@ v 8.7.0 (unreleased)
- Fix emoji catgories in the emoji picker
- Execute system web hooks on push to the project
- Allow enable/disable push events for system hooks
- Fix GitHub project's link in the import page when provider has a custom URL
v 8.6.7 (unreleased)
- Fix vulnerability that made it possible to enumerate private projects belonging to group
...
...
app/helpers/import_helper.rb
0 → 100644
View file @
c50f2e15
module
ImportHelper
def
github_project_link
(
path_with_namespace
)
link_to
path_with_namespace
,
github_project_url
(
path_with_namespace
),
target:
'_blank'
end
private
def
github_project_url
(
path_with_namespace
)
"
#{
github_root_url
}
/
#{
path_with_namespace
}
"
end
def
github_root_url
return
@github_url
if
defined?
(
@github_url
)
provider
=
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
p
|
p
.
name
==
'github'
}
@github_url
=
provider
.
fetch
(
'url'
,
'https://github.com'
)
if
provider
end
end
app/views/import/github/status.html.haml
View file @
c50f2e15
...
...
@@ -26,7 +26,7 @@
-
@already_added_projects
.
each
do
|
project
|
%tr
{
id:
"project_#{project.id}"
,
class:
"#{project_status_css_class(project.import_status)}"
}
%td
=
link_to
project
.
import_source
,
"https://github.com/
#{
project
.
import_source
}
"
,
target:
"_blank"
=
github_project_link
(
project
.
import_source
)
%td
=
link_to
project
.
path_with_namespace
,
[
project
.
namespace
.
becomes
(
Namespace
),
project
]
%td
.job-status
...
...
@@ -43,7 +43,7 @@
-
@repos
.
each
do
|
repo
|
%tr
{
id:
"repo_#{repo.id}"
}
%td
=
link_to
repo
.
full_name
,
"https://github.com/
#{
repo
.
full_name
}
"
,
target:
"_blank"
=
github_project_link
(
repo
.
full_name
)
%td
.import-target
=
repo
.
full_name
%td
.import-actions.job-status
...
...
spec/helpers/import_helper_spec.rb
0 → 100644
View file @
c50f2e15
require
'rails_helper'
describe
ImportHelper
do
describe
'#github_project_link'
do
context
'when provider does not specify a custom URL'
do
it
'uses default GitHub URL'
do
allow
(
Gitlab
.
config
.
omniauth
).
to
receive
(
:providers
).
and_return
([
Settingslogic
.
new
(
'name'
=>
'github'
)])
expect
(
helper
.
github_project_link
(
'octocat/Hello-World'
)).
to
include
(
'href="https://github.com/octocat/Hello-World"'
)
end
end
context
'when provider specify a custom URL'
do
it
'uses custom URL'
do
allow
(
Gitlab
.
config
.
omniauth
).
to
receive
(
:providers
).
and_return
([
Settingslogic
.
new
(
'name'
=>
'github'
,
'url'
=>
'https://github.company.com'
)])
expect
(
helper
.
github_project_link
(
'octocat/Hello-World'
)).
to
include
(
'href="https://github.company.com/octocat/Hello-World"'
)
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