mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
[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:
co-authored by
Tessa Thornton
Wyatt Johnson
parent
e3e2e0f52e
commit
d26e331a4f
@@ -19,6 +19,7 @@ Object {
|
||||
"reasons": Object {
|
||||
"COMMENT_DETECTED_BANNED_WORD": 1,
|
||||
"COMMENT_DETECTED_LINKS": 0,
|
||||
"COMMENT_DETECTED_NEW_COMMENTER": 0,
|
||||
"COMMENT_DETECTED_PREMOD_USER": 0,
|
||||
"COMMENT_DETECTED_RECENT_HISTORY": 0,
|
||||
"COMMENT_DETECTED_REPEAT_POST": 0,
|
||||
|
||||
@@ -95,6 +95,14 @@ export interface AccountFeatures {
|
||||
downloadComments: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* NewCommentersConfiguration is the configuration for how new commenters comments are treated.
|
||||
*/
|
||||
export interface NewCommentersConfiguration {
|
||||
premodEnabled: boolean;
|
||||
approvedCommentsThreshold: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Auth is the set of configured authentication integrations.
|
||||
*/
|
||||
@@ -165,4 +173,9 @@ export type Settings = GlobalModerationSettings &
|
||||
* AccountFeatures are features enabled for commenter accounts
|
||||
*/
|
||||
accountFeatures: AccountFeatures;
|
||||
|
||||
/**
|
||||
* newCommenters is the configuration for how new commenters comments are treated.
|
||||
*/
|
||||
newCommenters: NewCommentersConfiguration;
|
||||
};
|
||||
|
||||
@@ -157,8 +157,8 @@ export async function retrieveSharedModerationQueueQueuesCounts(
|
||||
|
||||
const [[, fresh], [, queues]] = await redis
|
||||
.pipeline()
|
||||
.hgetall(key)
|
||||
.get(freshKey)
|
||||
.hgetall(key)
|
||||
.exec();
|
||||
if (!fresh || !queues) {
|
||||
logger.debug({ tenantID }, "comment moderation counts were not cached");
|
||||
|
||||
@@ -197,6 +197,10 @@ export async function createTenant(
|
||||
deleteAccount: false,
|
||||
downloadComments: false,
|
||||
},
|
||||
newCommenters: {
|
||||
premodEnabled: false,
|
||||
approvedCommentsThreshold: 2,
|
||||
},
|
||||
createdAt: now,
|
||||
slack: {
|
||||
channels: [],
|
||||
|
||||
@@ -472,6 +472,10 @@ export interface User extends TenantResource {
|
||||
*/
|
||||
deletedAt?: Date;
|
||||
|
||||
/**
|
||||
* commentCounts are the tallies of all comment statuses for this
|
||||
* user.
|
||||
*/
|
||||
commentCounts: UserCommentCounts;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user