mozilla / discourse

Issues repo for Discourse roadmap within Mozilla
https://github.com/mozilla/discourse/projects/1
5 stars 4 forks source link

"new user typed too fast" not appearing in review queue #207

Open LeoMcA opened 5 years ago

LeoMcA commented 5 years ago

This user had their account put on hold for typing too fast, but it seems like it was never surfaced to the review queue (from looking through old queued posts).

There must be a bug here.

Sorting it out is high priority since we have a fair few false positives from the "new user typed too fast" spam detection.

┆Issue is synchronized with this Jira Task

LeoMcA commented 5 years ago

Gathering some metrics to understand what's going on here:

Total users caught by "new user typed too fast": 594 Those which were deleted: 165 Those which are still silenced: 68

The remaining 361 are (probably) legitimate users.

361 false positives vs 233 spammers doesn't seem great on the face of it, but that's 233 spammers who we prevented from ever posting by doing literally nothing.

It could be that some of those 68 silenced users were never in the review queue (like the user in the OP), that's what I'm looking into next.

LeoMcA commented 5 years ago

Of the 594 users caught by "new user typed too fast", 167 don't have posts in the review queue. 165 of those users were those which had been deleted (so presumably had their Reviewable entry deleted too).

That leaves 2 users who were silenced for "new user typed too fast" without a Reviewable entry. They are the user in the OP and one other user. Both are now un-silenced after manual review by me.

One user was silenced at 14 Apr 2019 15:41 BST, the other 20 May 2019 09:08 BST. There are multiple posts in the review queue between those times and since then that were held for "new user typed too fast", so this isn't an issue with all posts held for that reason.

My queries for future reference:

total = UserHistory.where(details: "New user typed too fast").pluck(:target_user_id)
total.count
=> 595 # total users caught by "new user typed too fast"

alive = total.map{ |x| User.where(id: x).first&.id }.compact
alive.count
=> 430 # users which haven't been deleted

silenced = alive.map{ |x| User.find(x).silenced? }
silenced.filter{ |x| x == true }.count
=> 68 # users which are still silenced
silenced.filter{ |x| x == false }.count
=> 362 # users which were un-silenced

total.map{|x| Reviewable.where(created_by_id: x).count}.filter{|x| x == 0}.count
=> 167 # total users without posts in the review queue history

alive.map{|x| Reviewable.where(created_by_id: x).count}.filter{|x| x == 0}.count
=> 2 # non deleted users without posts in the review queue history
alive.map{|x| [x, Reviewable.where(created_by_id: x).count]}.filter{|x| x[1] == 0}
=> [[20914, 0], [22425, 0]] # the ids of those users

total.map{|x| Reviewable.where(created_by_id: x).pluck(:created_at)}.flatten.compact
# gets dates of all posts in review queue from users caught by "new user typed too fast"
LeoMcA commented 5 years ago

Further investigation (post lunch) may have revealed something. First I checked the UserHistory and UserAction tables for these users and there was nothing of note around the time they were silenced.

I was able to (sort-of) reproduce this however. If I locally recreated a post getting caught in moderation, and then manually destroyed the ReviewableQueuedPost using rails c it (obviously) didn't appear in the review history, but the user stayed silenced. I wonder if something has been causing these queued posts to be deleted, or never created in the first place.

Posted upstream about this: https://meta.discourse.org/t/users-silenced-for-new-user-typed-too-fast-not-appearing-in-review-queue/119499