mirror of
https://github.com/wassname/talk.git
synced 2026-07-26 13:37:38 +08:00
[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:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user