diff --git a/frontend/app/src/components/home/profile/ViewUserProfile.svelte b/frontend/app/src/components/home/profile/ViewUserProfile.svelte index 1fc8910751..18f6b24554 100644 --- a/frontend/app/src/components/home/profile/ViewUserProfile.svelte +++ b/frontend/app/src/components/home/profile/ViewUserProfile.svelte @@ -219,6 +219,28 @@ year: "numeric", }); } + + function unsuspendUser() { + client.unsuspendUser(userId).then((success) => { + if (success) { + toastStore.showSuccessToast("unsuspendedUser"); + onClose(); + } else { + toastStore.showFailureToast("failedToUnsuspendUser"); + } + }); + } + + function suspendUser() { + client.suspendUser(userId, "").then((success) => { + if (success) { + toastStore.showSuccessToast("suspendedUser"); + onClose(); + } else { + toastStore.showFailureToast("failedToSuspendUser"); + } + }); + } @@ -289,6 +311,18 @@ {/if} + {#if $platformModerator} +
+ + {#if isSuspended} + + {:else} + + {/if} + +
+ {/if} @@ -371,4 +405,8 @@ } } } + + .suspend { + margin-top: $sp3; + } diff --git a/frontend/openchat-agent/src/services/userIndex/userIndex.client.ts b/frontend/openchat-agent/src/services/userIndex/userIndex.client.ts index 25741d3055..474fe1e30a 100644 --- a/frontend/openchat-agent/src/services/userIndex/userIndex.client.ts +++ b/frontend/openchat-agent/src/services/userIndex/userIndex.client.ts @@ -226,13 +226,11 @@ export class UserIndexClient extends CandidService { for (const userId of allUsers) { const cached = fromCacheMap.get(userId); - const userResponse = responseMap.get(userId); + const fromServer = responseMap.get(userId); - if (userResponse !== undefined) { - users.push({ - ...userResponse, - blobReference: userResponse.blobReference ?? cached?.blobReference, - }); + if (fromServer !== undefined) { + responseMap.delete(userId); + users.push(fromServer); } else if (cached !== undefined) { if (requestedFromServer.has(userId)) { // If this user was requested from the server but wasn't included in the response, then that means @@ -248,6 +246,11 @@ export class UserIndexClient extends CandidService { } } + // This is needed because newly suspended users won't have been included in the `allUsers` array + for (const user of responseMap.values()) { + users.push(user); + } + return { serverTimestamp: response.serverTimestamp, users,