Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when accepting appeal for sensitive posts deleted in the meantime #32037

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

ClearlyClaire
Copy link
Contributor

When a moderator tries to accept an appeal for a mark-statuses-as-sensitive action but the statuses have been suspended in the meantime, the controller would error out because it is trying to undo the change on the status, creating a StatusEdit in the process.

This would fail with:

ActiveRecord::RecordInvalid: Validation failed: Status must exist

Because of the default scope on Status.

An alternative could be to unscope the default scope in StatusEdit's belongs_to

@ClearlyClaire ClearlyClaire added bug Something isn't working to backport PR needed to be backported labels Sep 23, 2024
@ClearlyClaire ClearlyClaire requested a review from a team September 23, 2024 14:37
Copy link
Contributor

@mjankowski mjankowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the coverage here go on the services spec and add this edge case ... or is there some outcome/aspect of this that's really only visible at the controller level despite the change being in the service?

Gargron
Gargron previously approved these changes Sep 23, 2024
@ClearlyClaire
Copy link
Contributor Author

ClearlyClaire commented Sep 24, 2024

Could the coverage here go on the services spec and add this edge case ... or is there some outcome/aspect of this that's really only visible at the controller level despite the change being in the service?

This can definitely go in the service spec.

EDIT: done

@ClearlyClaire ClearlyClaire requested a review from a team September 24, 2024 13:38
Co-authored-by: David Roetzel <david@roetzel.de>
@ClearlyClaire ClearlyClaire added this pull request to the merge queue Sep 24, 2024
Merged via the queue into main with commit c36a76b Sep 24, 2024
29 checks passed
@ClearlyClaire ClearlyClaire deleted the fixes/appeal-deleted-sensitive-post branch September 24, 2024 15:55
@ClearlyClaire ClearlyClaire removed the to backport PR needed to be backported label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants