[CORL-882] option to reject all a user's comments when banning (#2827)

* show comment counts for stories in story table

* remove debug code

* add rejector task

* connect comment rejection job to user banning

* localize strings

* remove debug code

* remove debug code

* resolve merge conflicts

* add documentation to rejectExistingComments

* clean up rejector task

* add TODO about broker

* make rejectExistingComments nullable
This commit is contained in:
Tessa Thornton
2020-02-21 12:38:40 -05:00
committed by GitHub
parent ca52cc3253
commit d6db287c55
24 changed files with 491 additions and 120 deletions
+4
View File
@@ -12,6 +12,7 @@ import { PersistedQuery } from "coral-server/models/queries";
import { Tenant } from "coral-server/models/tenant";
import { User } from "coral-server/models/user";
import { MailerQueue } from "coral-server/queue/tasks/mailer";
import { RejectorQueue } from "coral-server/queue/tasks/rejector";
import { ScraperQueue } from "coral-server/queue/tasks/scraper";
import { I18n } from "coral-server/services/i18n";
import { JWTSigningConfig } from "coral-server/services/jwt";
@@ -40,6 +41,7 @@ export interface GraphContextOptions {
mongo: Db;
pubsub: RedisPubSub;
redis: AugmentedRedis;
rejectorQueue: RejectorQueue;
scraperQueue: ScraperQueue;
tenant: Tenant;
tenantCache: TenantCache;
@@ -61,6 +63,7 @@ export default class GraphContext {
public readonly now: Date;
public readonly pubsub: RedisPubSub;
public readonly redis: AugmentedRedis;
public readonly rejectorQueue: RejectorQueue;
public readonly scraperQueue: ScraperQueue;
public readonly tenant: Tenant;
public readonly tenantCache: TenantCache;
@@ -94,6 +97,7 @@ export default class GraphContext {
this.tenantCache = options.tenantCache;
this.scraperQueue = options.scraperQueue;
this.mailerQueue = options.mailerQueue;
this.rejectorQueue = options.rejectorQueue;
this.signingConfig = options.signingConfig;
this.clientID = options.clientID;
+2
View File
@@ -229,10 +229,12 @@ export const Users = (ctx: GraphContext) => ({
ban(
ctx.mongo,
ctx.mailerQueue,
ctx.rejectorQueue,
ctx.tenant,
ctx.user!,
input.userID,
input.message,
input.rejectExistingComments || false,
ctx.now
),
premodUser: async (input: GQLPremodUserInput) =>
@@ -5491,6 +5491,11 @@ input BanUserInput {
message is sent to banned user via email.
"""
message: String!
"""
whether or not to reject all the user's previous comments when banning them.
"""
rejectExistingComments: Boolean
}
type BanUserPayload {