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
26ac53b3
Commit
26ac53b3
authored
Jul 22, 2019
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure SubmoduleHelper works outside view context
parent
65b16f98
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
40 deletions
+58
-40
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+8
-4
changelogs/unreleased/dm-submodule-helper-routing.yml
changelogs/unreleased/dm-submodule-helper-routing.yml
+5
-0
spec/helpers/submodule_helper_spec.rb
spec/helpers/submodule_helper_spec.rb
+45
-36
No files found.
app/helpers/submodule_helper.rb
View file @
26ac53b3
...
...
@@ -34,8 +34,8 @@ module SubmoduleHelper
project
.
sub!
(
/\.git\z/
,
''
)
if
self_url?
(
url
,
namespace
,
project
)
[
namespace_project_path
(
namespace
,
project
),
namespace_project_tree_path
(
namespace
,
project
,
submodule_item_id
)]
[
url_helpers
.
namespace_project_path
(
namespace
,
project
),
url_helpers
.
namespace_project_tree_path
(
namespace
,
project
,
submodule_item_id
)]
elsif
relative_self_url?
(
url
)
relative_self_links
(
url
,
submodule_item_id
,
repository
.
project
)
elsif
github_dot_com_url?
(
url
)
...
...
@@ -99,8 +99,8 @@ module SubmoduleHelper
begin
[
namespace_project_path
(
target_namespace_path
,
submodule_base
),
namespace_project_tree_path
(
target_namespace_path
,
submodule_base
,
commit
)
url_helpers
.
namespace_project_path
(
target_namespace_path
,
submodule_base
),
url_helpers
.
namespace_project_tree_path
(
target_namespace_path
,
submodule_base
,
commit
)
]
rescue
ActionController
::
UrlGenerationError
[
nil
,
nil
]
...
...
@@ -118,4 +118,8 @@ module SubmoduleHelper
rescue
URI
::
InvalidURIError
nil
end
def
url_helpers
Gitlab
::
Routing
.
url_helpers
end
end
changelogs/unreleased/dm-submodule-helper-routing.yml
0 → 100644
View file @
26ac53b3
---
title
:
Fix bug that caused diffs not to show on MRs with changes to submodules
merge_request
:
author
:
type
:
fixed
spec/helpers/submodule_helper_spec.rb
View file @
26ac53b3
This diff is collapsed.
Click to expand it.
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