Add param to Wiki REST endpoint to retrieve different page versions
What does this MR do and why?
This is additional work needed for #336792 (closed).
In #336792 (closed), we want to load pages async. Nevertheless, we can not only render the last version of the page, but also older ones.
The current REST endpoint only allows us to render the last version, so we need to add that functionality.
How to set up and validate locally
- We need an existing wiki with pages. Let's say that it is stored in
wiki
which belong to a project with id6
, and the page name ishome
- Execute the following to get that pages version:
page = wiki.find_page('home'); old_version = page.last_version.id
- Now, update the page:
wiki.update_page(page.page, content: 'New content', message: 'updated page')
- Check that when we ask the API without any other info we get the last version: http://127.0.0.1:3000/api/v4/projects/6/wikis/home
- The
content
in the response debería serNew content
- Now retrieve the old version of the page using
last_version
: http://127.0.0.1:3000/api/v4/projects/6/wikis/home?version=<last_version here> - Check that we get in
content
the old data in the page
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #336792 (closed)