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

[Feature] 'Select all user's comments' in admin #2027

Open
aguilarm opened this Issue Oct 24, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@aguilarm
Copy link

aguilarm commented Oct 24, 2018

Do you want to request a feature or report a bug?

Bug? Incomplete feature perhaps.

Intended outcome:

By clicking 'select all' in Talk admin for a user's comments, admins would like to easily reject all comments for a particular user (generally spammers, with hundreds of comments).

Actual outcome:

Bulk approving/rejecting comments (original issue #1027) only selects 10 comments at a time, or however many have been loaded on the admin sidebar. This makes removing a user's comments with anything more than 100 or so is an unnecessarily manual process.

How to reproduce the issue:

In admin, click select all on a users comments (original issue has screenshots).

Version and environment

4.6.2

Perhaps it should operate like gmail, where initially clicking 'select all' selects showing comments, and prompts to further select all comments, like

All 10 comments on this page are selected. Select all 360 comments by $USERNAME

@aguilarm

This comment has been minimized.

Copy link
Author

aguilarm commented Oct 24, 2018

Looked at what's happening now a bit. It's iterating individual comments and triggering a setStatus on each one then waiting for all of those changes to resolve.

I think perhaps we could make a new mutation like setCommentStatusForUser or something that takes a query shape like { author_id, status } and updates all comments by a particular user to match a new status. That query will use the existing index on author_id/created_at and looks to be totally fine at scale.

@kgardnr

This comment has been minimized.

Copy link
Member

kgardnr commented Oct 24, 2018

Hey @aguilarm this is a cool idea, if you wanted to contribute something like this!

@kgardnr kgardnr changed the title 'Select all' in admin for user comments does not select all of a user's comments [Feature] 'Select all user's comments' in admin Oct 24, 2018

@aguilarm

This comment has been minimized.

Copy link
Author

aguilarm commented Oct 24, 2018

@kgardnr Cool, I'll have a go at a PR!

@aguilarm

This comment has been minimized.

Copy link
Author

aguilarm commented Oct 24, 2018

Turns out changing the status of a comment triggers some side effect operations including:

  • adjusting reply counts for the parent comment, if it exists
  • clearing comment count caches for associated assets so they can be refreshed
  • adjusting user karma

While I can do the asset cache clear and karma all at once in separate post-update actions based on total changes, reply counts check the pre- and post-change visibility state of the affected comments.

There is no way (in mongo, that I know of) to atomically run a find and update on multiple documents at once (so I can figure out if the change should trigger an increment or decrement on the parent reply count) meaning I still have to iterate one at a time to make sure the parent is updated accurately.

That might take some time with large numbers of comments, so it's probably prudent to run it in chunks and display chunked progress to the user. Perhaps update 50 comments each chunk and write feedback/progress to the UI up top somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.