AO3-7556 Fix 500 when trying to /comments/add_comment_reply on nothing - #6021
Open
danderson wants to merge 1 commit into
Open
AO3-7556 Fix 500 when trying to /comments/add_comment_reply on nothing#6021danderson wants to merge 1 commit into
danderson wants to merge 1 commit into
Conversation
danderson
force-pushed
the
push-yvtzqvwxoumx
branch
5 times, most recently
from
September 11, 2026 04:18
a7a53eb to
1ec84e2
Compare
danderson
marked this pull request as draft
September 11, 2026 04:19
Contributor
Author
|
Okay, rubocop and I are getting into a fight over fixing all the lints in the couple controllers this change simplifies. Marking as draft while I figure all those lints out, will mark it ready again when I'm no longer pushing fixups. |
danderson
force-pushed
the
push-yvtzqvwxoumx
branch
2 times, most recently
from
September 11, 2026 04:26
2aae4f8 to
82b1734
Compare
danderson
marked this pull request as ready for review
September 11, 2026 04:35
danderson
force-pushed
the
push-yvtzqvwxoumx
branch
from
September 11, 2026 04:54
82b1734 to
62cd9f0
Compare
Since several comment routes have this behavior, hoist it out into a before_action, and add tests for all of them. Signed-off-by: David Anderson <dave@natulte.net>
danderson
force-pushed
the
push-yvtzqvwxoumx
branch
from
September 11, 2026 05:13
62cd9f0 to
17b9fb2
Compare
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.
Since several comment routes have this behavior, hoist it out into a before_action, and add tests for all of them.
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-7556
Purpose
Fixes a 500 when trying to reply to a comment without providing a commentable ID. The user is redirected back from whence they came, with a flash error explaining the problem.
While implementing this I noticed that there are now 4 routes in the comments controller that have this behavior, with different error messages. So I hoisted the behavior into a common before_action, with per-route translation strings.
The refactor dedents a bunch of code, so I suggest reviewing the diff with whitespace changes ignored, to make the diff highlight the right pieces.
References
Similar fix to #5996 (AO3-7561), just on a different route.
Credit
David Anderson (he/him)