[CORL-664] Threshold moderate new commenters (#2752)

* add new commenters config

* fix specs and fixtures, add translation strings

* save whether a commenter is new

* fix specs and snaps

* add admin role to new config options

* Update copy

* remvoe unused ref

* feat: initial impl

* Create preliminary comment moderation slices

CORL-688

* Move slices logic into stacks

CORL-688

* Create user comment counts

CORL-688

* Create naive mutation that initializes user comment counts

CORL-688

* Use bulk updates in user counts migration

CORL-688

* fix: review

* fix: fixed issue with aggregation

* Migrate creating comment into stacks

CORL-688

* Migrate editing a comment to the stacks

CORL-688

* Break publishing comment status out of updateAllCounts

CORL-688

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* Remove un-necessary isNew flags on users

CORL-664

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* fix: check if authorID is null before update user counts

CORL-688

* fix: addressed bug in shared count retrival

Co-authored-by: Tessa Thornton <tessathornton@gmail.com>
Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
This commit is contained in:
Nick Funk
2020-01-07 14:38:50 -07:00
committed by GitHub
co-authored by Tessa Thornton Wyatt Johnson
parent e3e2e0f52e
commit d26e331a4f
20 changed files with 437 additions and 2 deletions
@@ -179,6 +179,7 @@ enum COMMENT_FLAG_REASON {
COMMENT_DETECTED_SUSPECT_WORD
COMMENT_DETECTED_RECENT_HISTORY
COMMENT_DETECTED_PREMOD_USER
COMMENT_DETECTED_NEW_COMMENTER
COMMENT_DETECTED_REPEAT_POST
}
@@ -215,6 +216,7 @@ type FlagReasonActionCounts {
COMMENT_DETECTED_SUSPECT_WORD: Int!
COMMENT_DETECTED_RECENT_HISTORY: Int!
COMMENT_DETECTED_PREMOD_USER: Int!
COMMENT_DETECTED_NEW_COMMENTER: Int!
COMMENT_DETECTED_REPEAT_POST: Int!
}
@@ -1194,6 +1196,23 @@ type StaffConfiguration {
label: String!
}
"""
NewCommenterConfiguration specifies the features that apply to new commenters
"""
type NewCommentersConfiguration {
"""
premodEnabled ensures that new commenters' comments are pre-moderated until they have
enough approved comments
"""
premodEnabled: Boolean!
"""
approvedCommentsThreshold is the number of comments a user must have approved before their
comments do not require premoderation
"""
approvedCommentsThreshold: Int!
}
"""
Settings stores the global settings for a given Tenant.
"""
@@ -1339,6 +1358,11 @@ type Settings {
createdAt is the time that the Settings was created at.
"""
createdAt: Time! @auth(roles: [ADMIN])
"""
newCommenters is the configuration for how new commenters comments are treated.
"""
newCommenters: NewCommentersConfiguration! @auth(roles: [ADMIN])
}
################################################################################
@@ -3525,6 +3549,23 @@ input SlackConfigurationInput {
channels: [SlackChannelConfigurationInput!]
}
"""
NewCommenterConfigurationInput specifies the features that apply to new commenters
"""
input NewCommentersConfigurationInput {
"""
premodEnabled ensures that new commenters' comments are pre-moderated until they have
enough approved comments
"""
premodEnabled: Boolean
"""
approvedCommentsThreshold is the number of comments a user must have approved before their
comments do not require premoderation
"""
approvedCommentsThreshold: Int
}
"""
SettingsInput is the partial type of the Settings type for performing mutations.
"""
@@ -3644,6 +3685,11 @@ input SettingsInput {
locale specifies the locale for this Tenant.
"""
locale: Locale
"""
newCommenters is the configuration for how new commenters comments are treated.
"""
newCommenters: NewCommentersConfigurationInput
}
"""