[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
@@ -275,6 +275,128 @@ approved by a moderator.
</fieldset>
</div>
</fieldset>
<div
className="Box-root ConfigBox-root"
>
<div
className="Box-root Flex-root ConfigBox-title Flex-flex Flex-justifySpaceBetween"
>
<div>
<legend
className="Header-root"
>
New commenter approval
</legend>
</div>
<div />
</div>
<div
className="ConfigBox-content"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-spacing-4"
>
<p
className="FormFieldDescription-root"
>
When this is active, initial comments by a new commenter will be sent to Pending
for moderator approval before publication.
</p>
<fieldset
className="FieldSet-root Box-root HorizontalGutter-root FormField-root HorizontalGutter-spacing-2"
>
<legend
className="Label-root"
>
Enable new commenter approval
</legend>
<div>
<div
className="Box-root Flex-root RadioButton-root Flex-flex Flex-alignCenter"
>
<input
checked={false}
className="RadioButton-input"
disabled={false}
id="newCommenters.premodEnabled-true"
name="newCommenters.premodEnabled"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="true"
/>
<label
className="RadioButton-label"
htmlFor="newCommenters.premodEnabled-true"
>
<span>
On
</span>
</label>
</div>
<div
className="Box-root Flex-root RadioButton-root Flex-flex Flex-alignCenter"
>
<input
checked={true}
className="RadioButton-input"
disabled={false}
id="newCommenters.premodEnabled-false"
name="newCommenters.premodEnabled"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
type="radio"
value="false"
/>
<label
className="RadioButton-label"
htmlFor="newCommenters.premodEnabled-false"
>
<span>
Off
</span>
</label>
</div>
</div>
</fieldset>
<div
className="Box-root HorizontalGutter-root FormField-root HorizontalGutter-spacing-2"
>
<label
className="Label-root"
>
Number of first comments sent for approval
</label>
<div
className="TextField-root"
>
<input
autoCapitalize="off"
autoComplete="off"
autoCorrect="off"
className="TextField-input NewCommentersConfig-thresholdTextField TextField-colorRegular TextField-textAlignCenter"
disabled={false}
name="newCommenters.approvedCommentsThreshold"
onBlur={[Function]}
onChange={[Function]}
onFocus={[Function]}
placeholder=""
spellCheck={false}
type="text"
value={2}
/>
<div
className="TextField-adornment"
>
comments
</div>
</div>
</div>
</div>
</div>
</div>
<fieldset
className="FieldSet-root Box-root ConfigBox-root"
>
+5
View File
@@ -161,6 +161,10 @@ export const settings = createFixture<GQLSettings>({
changeUsername: true,
deleteAccount: true,
},
newCommenters: {
premodEnabled: false,
approvedCommentsThreshold: 2,
},
slack: {
channels: [],
},
@@ -532,6 +536,7 @@ export const baseComment = createFixture<GQLComment>({
COMMENT_DETECTED_SUSPECT_WORD: 0,
COMMENT_REPORTED_OFFENSIVE: 0,
COMMENT_REPORTED_SPAM: 0,
COMMENT_DETECTED_NEW_COMMENTER: 0,
COMMENT_DETECTED_REPEAT_POST: 0,
},
},