Refactor Site ID Verification to Use Admins Sites Table and Fix Broken Revert Feature by Replacing link_to Helper with button_to #922
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR refactors site ID verification by replacing the
site_id
parameter check with a direct lookup in theadmins_sites
table, where user site access is stored.Additionally, this pull request replaces the
link_to
helper withbutton_to
in the Previous Versions partial to ensure the correct HTTP method is used. Previously,link_to
began forcing aGET
request, butbutton_to
generates a form that submits aPOST
request with "_method"=>"put" that overrides the request method toPUT
in Rails. To avoid the button forms conflicting with the main page form, the Previous Versions partial is now rendered outside of it.This pull request also fixes a bug wherein the Save and Continue button was redirecting users to the Content page due to the Save and Continue button missing the
site_id
parameter. The site ID refactor resolves this issue.Because the site ID verification within the edit page view no longer uses the
site_id
parameter, this was removed in the Content nodes and the Page Search nodes. Thesite_id
parameter is still used when selecting a site from the multisite dropdown.Testing
Site ID Verification
Page Version Revert
Save and Continue