Ao3-7219 persist work preference after comment#5798
Draft
Dame-Zoom-A-Lot wants to merge 4 commits intootwcode:masterfrom
Draft
Ao3-7219 persist work preference after comment#5798Dame-Zoom-A-Lot wants to merge 4 commits intootwcode:masterfrom
Dame-Zoom-A-Lot wants to merge 4 commits intootwcode:masterfrom
Conversation
5 tasks
Dame-Zoom-A-Lot
commented
May 10, 2026
| anchor: "comment_#{comment.id}" | ||
| } | ||
| end | ||
| default_options = if comment.ultimate_parent.is_a?(Tag) |
Contributor
Author
There was a problem hiding this comment.
rubocop formatting changes
Contributor
Author
|
Setting to draft mode while I add tests to default_rails_actions_spec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7219
Purpose
Fix the bug where users who had "show the whole work by default" enabled were getting redirected to the full work view after commenting.
This was happening because of this line in the
redirect_to_all_commentsfunctionWe also had bugs earlier in the code when setting
options[:view_full_work]In
show_commentsandadd_comment_reply,options[:view_full_work]always evaluates as truthy regardless of whether it's 'true', or 'false', since params get evaluated as string values.I simplified the logic by basing redirects on the previous page (referer) rather than the view_full_work param.
Based on manual test + looking at the code, I'm assuming that there's 3 ways to create / edit / delete a comment
/works/:id)/works/:id/chapters/:id)/comments/:id)I was concerned that by updating the logic so we no longer rely on
params[:view_full_work], I'd break the flow from when a user deletes a comment from the comment view.But I confirmed that we never set the
view_full_workparam when a user is navigated to to thecommentspath in both of the below cases:Threadon a comment box, which navigates to thecomments/:idpathcomments/:idpathWe also did not set the
view_full_workparam when a user switched from entire work view to chapter view.Since the
view_full_workparam is set unpredictably, and inconsistently, I believe it would be more maintainable if we consolidate all the logic to the redirect function and go off of where the user last was instead.Testing Instructions
Please see Jira ticket - most recent test instructions are here with screenshots
References
This replaces an original PR: #5524
@Bilka2 thank you for your careful review. I agreed with your comment that the routing logic in the original PR was too convoluted, and that the simplest solution is to take the user back to where they were to begin with.
I was going to work off of my old PR, but it was so old that just starting from a clean slate was easier.
Credit
What name and pronouns should we use to credit you in the Archive of Our Own's Release Notes?
Zooms (any)
If you have a Jira account, please include the same name in the "Full name"
field on your Jira profile, so we can assign you the issues you're working on.
Please note that if you do not fill in this section, we will use your GitHub account name and
they/them pronouns.