Skip to content

AO3-7556 Fix 500 when trying to /comments/add_comment_reply on nothing - #6021

Open
danderson wants to merge 1 commit into
otwcode:masterfrom
danderson:push-yvtzqvwxoumx
Open

AO3-7556 Fix 500 when trying to /comments/add_comment_reply on nothing#6021
danderson wants to merge 1 commit into
otwcode:masterfrom
danderson:push-yvtzqvwxoumx

Conversation

@danderson

Copy link
Copy Markdown
Contributor

Since several comment routes have this behavior, hoist it out into a before_action, and add tests for all of them.

Pull Request Checklist

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)

@danderson
danderson force-pushed the push-yvtzqvwxoumx branch 5 times, most recently from a7a53eb to 1ec84e2 Compare September 11, 2026 04:18
@danderson
danderson marked this pull request as draft September 11, 2026 04:19
@danderson

Copy link
Copy Markdown
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
danderson force-pushed the push-yvtzqvwxoumx branch 2 times, most recently from 2aae4f8 to 82b1734 Compare September 11, 2026 04:26
@danderson
danderson marked this pull request as ready for review September 11, 2026 04:35
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants