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

[CORL-8] prevent repeat comments #2632

Merged
merged 6 commits into from Oct 16, 2019
Merged

Conversation

tessalt
Copy link
Contributor

@tessalt tessalt commented Oct 10, 2019

  • stores ID of user's most recent comment in redis for 6 hours
  • adds moderation step to check the body of that comment and compare it against the new comment
  • throws an error if we're nudging, flags comment and witholds if not
  • display "Duplicate comment" flag on comments marked as duplicates

Question: the expiration of the last id in redis... it makes sense in this context but I'm wondering if we might want this to be more general-purpose and have the ID not expire and instead compare the createdAt in the moderation step? But then we're storing one entry indefinitely per user in redis and that could be a lot?

How to test:

  1. log in as commenter on non-premod stream
  2. post a comment
  3. attempt to post the same comment
  4. observe nudge, post comment anyways
  5. observe message that comment will be held for moderation
  6. log in as admin, comment should be marked "Duplicate comment"

@tessalt tessalt requested review from wyattjoh and cvle October 10, 2019 12:40
Comment on lines 32 to 37
// We can only check for spam if this comment originated from a graphql
// request via an HTTP call.
if (!req) {
log.debug("request was not available");
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not required as req isn't used in this phase

src/core/server/services/users/users.ts Outdated Show resolved Hide resolved
src/core/server/services/users/users.ts Outdated Show resolved Hide resolved
src/core/common/errors.ts Show resolved Hide resolved
src/core/common/constants.ts Show resolved Hide resolved
@kgardnr kgardnr added this to the v5.2.0 milestone Oct 15, 2019
@tessalt tessalt requested a review from wyattjoh October 15, 2019 20:08
@tessalt
Copy link
Contributor Author

tessalt commented Oct 16, 2019

updated, the "re-request" button isn't showing up

@wyattjoh wyattjoh modified the milestones: v5.2.0, v5.3.0 Oct 16, 2019
@wyattjoh wyattjoh merged commit 9df4731 into master Oct 16, 2019
@wyattjoh wyattjoh deleted the feature/CORL-8-repeat-comment branch October 16, 2019 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants