-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #30143 - passing root_url without section to documentation_url #7754
Fixes #30143 - passing root_url without section to documentation_url #7754
Conversation
Issues: #30143 |
app/controllers/links_controller.rb
Outdated
if section.empty? | ||
"https://theforeman.org/documentation.html##{SETTINGS[:version].short}" | ||
options[:root_url] || "https://theforeman.org/documentation.html##{SETTINGS[:version].short}" | ||
else | ||
root_url + section | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://theforeman.org/documentation.html
is an old url that doesn't exist anymore, it redirects to the quickstart guide.
I believe this whole condition should just be: root_url + section
without checking if the section is empty (since that would just return the root_url).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to create a default url, so the user will not be redirected to 404 page, if some pages did move. Especially for stale plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but right now if the section is empty it points to a stale url, while the base works just fine. And this function doesn't work for plugins anyways?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch @tbrisker !
I would be ok with removing the section,
or replacing it with another url, e.g: https://theforeman.org/manuals/`version`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking to @tbrisker, it looks like leftovers of our old documentation site structure. Now we can redirect to https://theforeman.org/manuals/#{SETTINGS[:version].short}/index.html
. Meaning we can simplify the method to always return root_url + section
(in case the section is empty - it will fall back to root_url
, which is fine.
app/controllers/links_controller.rb
Outdated
if section.empty? | ||
"https://theforeman.org/documentation.html##{SETTINGS[:version].short}" | ||
options[:root_url] || "https://theforeman.org/documentation.html##{SETTINGS[:version].short}" | ||
else | ||
root_url + section | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking to @tbrisker, it looks like leftovers of our old documentation site structure. Now we can redirect to https://theforeman.org/manuals/#{SETTINGS[:version].short}/index.html
. Meaning we can simplify the method to always return root_url + section
(in case the section is empty - it will fall back to root_url
, which is fine.
79a6663
to
295e2f5
Compare
Thanks @ShimShtein @tbrisker ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test failure related
Failed on:
Trying to use a ternary instead, e.g: |
295e2f5
to
804c80d
Compare
The issue is in the |
@tbrisker @ShimShtein should we refactor to pass only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to change method signatures - they are used by the theme
app/controllers/links_controller.rb
Outdated
else | ||
root_url + section | ||
end | ||
section ? root_url + section : root_url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
section ? root_url + section : root_url | |
root_url + (section || '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated!
804c80d
to
b44fc5f
Compare
b44fc5f
to
b42d8b9
Compare
rebased, ready for another round :) |
b42d8b9
to
b565547
Compare
b565547
to
a50c0b9
Compare
sorry, my fix got reverted on the rebase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APJ, thanks @LaViro !
documentation_url
expect section to be providedalso when only using
root_url