diff --git a/src/commands/server-admin/DeactivateCommand.tsx b/src/commands/server-admin/DeactivateCommand.tsx index 9499b3c..a75b6c8 100644 --- a/src/commands/server-admin/DeactivateCommand.tsx +++ b/src/commands/server-admin/DeactivateCommand.tsx @@ -11,6 +11,7 @@ import { Ok, Result, ResultError, isError } from "@gnuxie/typescript-result"; import { BasicInvocationInformation, + DeadDocumentJSX, MatrixUserIDPresentationType, describeCommand, tuple, @@ -131,6 +132,70 @@ export const SynapseAdminDeactivateCommand = describeCommand({ }, }); +function renderUserDetails(preview: DeactivateUserPreview) { + return ( +
+ + Details for {preview.targetUser} + + +
+ ); +} + DraupnirInterfaceAdaptor.describeRenderer(SynapseAdminDeactivateCommand, { isAlwaysSupposedToUseDefaultRenderer: true, + confirmationPromptJSXRenderer(commandResult) { + if (isError(commandResult)) { + return Ok(undefined); + } + const preview = commandResult.ok; + return Ok( + + You are about to deactivate the user {preview.targetUser}. + This will permanently deactivate the user and remove their access to the + homeserver. + {preview.isPurgingMessages ? ( + + Purging their messages will also cause their account to be used by + the homeserver to send hundreds of redaction events to remove + everything they have sent. + + ) : ( + + )} + {renderUserDetails(preview)} + + ); + }, + JSXRenderer(commandResult) { + if (isError(commandResult)) { + return Ok(undefined); + } + return Ok( + + Successfully deactivated {commandResult.ok.targetUser} + {renderUserDetails(commandResult.ok)} + + ); + }, });