[CORL-155] User Suspending and Banning (#2247)

* feat: suspending, banning, now propogation

* feat: adapting to `now`

* feat: support auth for suspension/banned

* feat: added trace-id to requests

* feat: new mutation api with hooks support

* feat: added user status filtering, current field

* feat: Implement filter by status, adapt to new USER_STATUS type, add lookup helper <3

* fix: typo

* fix: tests

* chore: rename banned status to ban status

* test: feature test + lots of test helper improvements e.g. types

* fix: add translation to ban user modal

* fix: translation

* fix: test
This commit is contained in:
Wyatt Johnson
2019-04-22 22:57:32 +00:00
committed by GitHub
parent b63c00f26f
commit dbbc1af42e
147 changed files with 4609 additions and 1468 deletions
+7 -9
View File
@@ -221,10 +221,9 @@ export type CreateCommentInput = Omit<
export async function createComment(
mongo: Db,
tenantID: string,
input: CreateCommentInput
input: CreateCommentInput,
now = new Date()
) {
const createdAt = new Date();
// Pull out some useful properties from the input.
const { body, actionCounts = {}, ...rest } = input;
@@ -233,7 +232,7 @@ export async function createComment(
id: uuid.v4(),
body,
actionCounts,
createdAt,
createdAt: now,
};
// default are the properties set by the application when a new comment is
@@ -244,7 +243,7 @@ export async function createComment(
replyIDs: [],
replyCount: 0,
revisions: [revision],
createdAt,
createdAt: now,
};
// Merge the defaults and the input together.
@@ -360,10 +359,9 @@ export interface EditComment {
export async function editComment(
mongo: Db,
tenantID: string,
input: EditCommentInput
input: EditCommentInput,
now = new Date()
): Promise<EditComment> {
const createdAt = new Date();
const {
id,
body,
@@ -379,7 +377,7 @@ export async function editComment(
id: uuid.v4(),
body,
actionCounts,
createdAt,
createdAt: now,
};
const update: Record<string, any> = {