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
ce9cbde6
Commit
ce9cbde6
authored
Apr 13, 2022
by
Francisco Javier López
Committed by
Markus Koller
Apr 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with wiki async loading and relative url
parent
ef8d8c27
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
2 deletions
+30
-2
app/helpers/wiki_helper.rb
app/helpers/wiki_helper.rb
+1
-1
ee/app/helpers/ee/wiki_helper.rb
ee/app/helpers/ee/wiki_helper.rb
+1
-1
ee/spec/helpers/ee/wiki_helper_spec.rb
ee/spec/helpers/ee/wiki_helper_spec.rb
+4
-0
spec/helpers/wiki_helper_spec.rb
spec/helpers/wiki_helper_spec.rb
+4
-0
spec/support/shared_examples/helpers/wiki_helpers_shared_examples.rb
...t/shared_examples/helpers/wiki_helpers_shared_examples.rb
+20
-0
No files found.
app/helpers/wiki_helper.rb
View file @
ce9cbde6
...
...
@@ -136,7 +136,7 @@ module WikiHelper
end
def
wiki_page_render_api_endpoint
(
page
)
api_v4_projects_wikis_path
(
wiki_page_render_api_endpoint_params
(
page
))
expose_path
(
api_v4_projects_wikis_path
(
wiki_page_render_api_endpoint_params
(
page
)
))
end
def
wiki_markup_hash_by_name_id
...
...
ee/app/helpers/ee/wiki_helper.rb
View file @
ce9cbde6
...
...
@@ -18,7 +18,7 @@ module EE
def
wiki_page_render_api_endpoint
(
page
)
return
super
if
page
.
wiki
.
is_a?
(
ProjectWiki
)
api_v4_groups_wikis_path
(
wiki_page_render_api_endpoint_params
(
page
))
expose_path
(
api_v4_groups_wikis_path
(
wiki_page_render_api_endpoint_params
(
page
)
))
end
end
end
ee/spec/helpers/ee/wiki_helper_spec.rb
View file @
ce9cbde6
...
...
@@ -10,4 +10,8 @@ RSpec.describe WikiHelper do
expect
(
helper
.
wiki_attachment_upload_url
).
to
end_with
(
"/api/v4/groups/
#{
@wiki
.
group
.
id
}
/wikis/attachments"
)
end
end
it_behaves_like
'wiki endpoint helpers'
do
let_it_be
(
:page
)
{
create
(
:wiki_page
,
wiki:
create
(
:group_wiki
))
}
end
end
spec/helpers/wiki_helper_spec.rb
View file @
ce9cbde6
...
...
@@ -145,4 +145,8 @@ RSpec.describe WikiHelper do
expect
(
subject
).
to
include
(
'wiki-directory-nest-level'
=>
0
)
end
end
it_behaves_like
'wiki endpoint helpers'
do
let_it_be
(
:page
)
{
create
(
:wiki_page
)
}
end
end
spec/support/shared_examples/helpers/wiki_helpers_shared_examples.rb
0 → 100644
View file @
ce9cbde6
# frozen_string_literal: true
RSpec
.
shared_examples
'wiki endpoint helpers'
do
let
(
:resource_path
)
{
page
.
wiki
.
container
.
class
.
to_s
.
pluralize
.
downcase
}
let
(
:url
)
{
"/api/v4/
#{
resource_path
}
/
#{
page
.
wiki
.
container
.
id
}
/wikis/
#{
page
.
slug
}
?version=
#{
page
.
version
.
id
}
"
}
it
'returns the full endpoint url'
do
expect
(
helper
.
wiki_page_render_api_endpoint
(
page
)).
to
end_with
(
url
)
end
context
'when relative url is set'
do
let
(
:relative_url
)
{
"/gitlab
#{
url
}
"
}
it
'returns the full endpoint url with the relative path'
do
stub_config_setting
(
relative_url_root:
'/gitlab'
)
expect
(
helper
.
wiki_page_render_api_endpoint
(
page
)).
to
end_with
(
relative_url
)
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