Revert "FEATURE: Count only approved flagged posts in user pages (#22799)" (#23962)

This reverts commit 5f0bc4557fb04928a8d38cba410d316a76f1bf8c.

Through extensive internal discussion we have decided to revert
this change, as it significantly impacted moderation flow for
some Discourse site moderators, especially around "something else"
flags. We need to re-approach how flags are counted holistically,
so to that end this change is being reverted.
This commit is contained in:
Martin Brennan
2023-10-18 11:38:17 +10:00
committed by GitHub
parent 30778e5fa4
commit e91d8feab3
6 changed files with 15 additions and 102 deletions

View File

@ -1194,6 +1194,13 @@ class User < ActiveRecord::Base
user_warnings.count
end
def flags_received_count
posts
.includes(:post_actions)
.where("post_actions.post_action_type_id" => PostActionType.flag_types_without_custom.values)
.count
end
def private_topics_count
topics_allowed.where(archetype: Archetype.private_message).count
end
@ -1520,14 +1527,8 @@ class User < ActiveRecord::Base
end
def number_of_flagged_posts
posts
.with_deleted
.includes(:post_actions)
.where("post_actions.post_action_type_id" => PostActionType.flag_types_without_custom.values)
.where("post_actions.agreed_at IS NOT NULL")
.count
ReviewableFlaggedPost.where(target_created_by: self.id).count
end
alias_method :flags_received_count, :number_of_flagged_posts
def number_of_rejected_posts
ReviewableQueuedPost.rejected.where(target_created_by_id: self.id).count