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: perform agree_and_keep action only if possible. #13967

Merged
merged 3 commits into from Sep 6, 2021

Conversation

vinothkannans
Copy link
Member

While deleting spammers from flag modal it's trying to perform agree_and_keep action where it's not possible (or already performed).

While deleting spammers from flag modal it's trying to perform `agree_and_keep` action where it's not possible (or already performed).
@tgxworld
Copy link
Contributor

tgxworld commented Aug 6, 2021

We need a test here :)

@vinothkannans vinothkannans marked this pull request as ready for review August 13, 2021 05:14
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/flag-delete-spammer-does-not-work-anymore/192748/10

ReviewableFlaggedPost.where(target_created_by: user).find_each do |reviewable|
reviewable.perform(@actor, :agree_and_keep)
reviewable.perform(@actor, :agree_and_keep) if reviewable.actions_for(guardian).has?(:agree_and_keep)
Copy link
Member

Choose a reason for hiding this comment

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

Could this still fail if @actor doesn't have enough permissions, even if the system user can agree with the flag? Maybe we should check using @guardian instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's done.

Copy link
Member

@romanrizzi romanrizzi left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks!

@vinothkannans vinothkannans merged commit 0c77782 into main Sep 6, 2021
@vinothkannans vinothkannans deleted the delete_spammer branch September 6, 2021 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants