Skip to content

WIP: Proof of concept using request.referer for cancel button

Nathan Friend requested to merge nfriend-request-referer-proof-of-concept into master

What does this MR do?

This is a proof of concept MR to get some backend feedback about using request.referer as a way to navigate "back" to the previous page when clicking the "Cancel" button on the Edit Release page.

Why would we want to do this?

There will soon be two ways to arrive at the Edit Release page:

  1. from the main Releases page
  2. from the "dedicated" Release page (see #32827 (closed))

Using request.referer instead of a static path allows the page to redirect the user back to their previous page when the "Cancel" button is clicked.

Additionally, since the Releases page is now paginated (!19912 (merged)), using request.referer allows the user to retain their pagination when clicking "Cancel" instead of being redirected back to page 1.

Known issues

If the user:

  1. navigates to the Edit Release page
  2. clicks on the "Edit Release" breadcrumb link (which points to the current page)
  3. clicks "Cancel"

the user will be "redirected" to the same page they are on (the Edit Release page).

Prior art

I couldn't find any other examples in our codebase where we do something similar, which is why I'm a little hesitant about this option.

Going forward

Our plan is to combine the Tags and Release creation/edit pages into one, which will result in a similar situation - a single form will be accessed from different locations (i.e. from the Releases page or the Tags page) - so we'll need the ability to intelligently route the user back to the correct location on save. My thought is that request.referer could be used for this purpose as well.

Edited by Nathan Friend

Merge request reports