[CORL-156] Manage user suspension status (#2419)

* wire up suspension modal

* show user suspended callout on stream

* prevent comment actions for suspended users

* set default to 3 hour suspension

* add message field to suspension

* allow custom message for suspension

* show suspend success modal

* fix type errors

* remove unused code

* update styles

* fix fixture for streams

* add suspension ui tests

* fix types

* remove warnings?

* remove snapshot

* fix merge conflicts

* allow custom email message when banning users

* fix typo

* correct message type

* use final-form in suspend modal

* refactor suspend modal to use final-form

* refactor ban modal to use final-form

* refactor userStatusChangeContainer to use useCallback

* feat: improve translated form

* fix: addressed issue caused by i18n refactor

* update getMessage to accept arguments, remove format method

* translate suspend info

* change hour format

* make message a mandatory input for suspend and ban user

* fix types in user table

* Revert "fix types in user table"

This reverts commit d396e90b88bb1bd354c5cdbdd72b6d8f1ab72929.

* fix types for user table

* fix: small review tweaks
This commit is contained in:
Tessa Thornton
2019-08-02 21:16:21 +00:00
committed by Wyatt Johnson
parent 4e548e8fbf
commit 5df2de6afc
42 changed files with 1511 additions and 276 deletions
+13
View File
@@ -142,6 +142,11 @@ export interface SuspensionStatusHistory {
* was edited at.
*/
modifiedAt?: Date;
/**
* message is the email message content sent to the user.
*/
message: string;
}
/**
@@ -180,6 +185,8 @@ export interface BanStatusHistory {
* createdAt is the time that the given ban was added.
*/
createdAt: Date;
message?: string;
}
/**
@@ -1128,6 +1135,7 @@ async function retrieveConnection(
* @param tenantID the Tenant's ID where the User exists
* @param id the ID of the user being banned
* @param createdBy the ID of the user banning the above mentioned user
* @param message message to banned user
* @param now the current date
*/
export async function banUser(
@@ -1135,6 +1143,7 @@ export async function banUser(
tenantID: string,
id: string,
createdBy: string,
message?: string,
now = new Date()
) {
// Create the new ban.
@@ -1143,6 +1152,7 @@ export async function banUser(
active: true,
createdBy,
createdAt: now,
message,
};
// Try to update the user if the user isn't already banned.
@@ -1267,6 +1277,7 @@ export async function removeUserBan(
* @param id the ID of the user being suspended
* @param createdBy the ID of the user banning the above mentioned user
* @param from the range of time that the user is being banned for
* @param message the message sent to suspended user in email
* @param now the current date
*/
export async function suspendUser(
@@ -1275,6 +1286,7 @@ export async function suspendUser(
id: string,
createdBy: string,
finish: Date,
message: string,
now = new Date()
) {
// Create the new suspension.
@@ -1286,6 +1298,7 @@ export async function suspendUser(
},
createdBy,
createdAt: now,
message,
};
// Try to update the user if the user isn't already suspended.