Skip to content

Commit 77e9a53

Browse files
committed
fix: disable ban and delete_all when dialog open from settings
1 parent 2457fb4 commit 77e9a53

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ts/components/dialog/BanOrUnbanUserDialog.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ export const BanOrUnBanUserDialog = (props: {
7777

7878
const displayName = useConversationUsername(pubkey);
7979

80+
const hasPubkeyOnLoad = pubkey?.length;
81+
8082
const inputTextToDisplay =
8183
!!pubkey && displayName ? `${displayName} ${PubKey.shorten(pubkey)}` : undefined;
8284

@@ -129,7 +131,14 @@ export const BanOrUnBanUserDialog = (props: {
129131
disabled={inProgress}
130132
dataTestId={isBan ? 'ban-user-confirm-button' : 'unban-user-confirm-button'}
131133
/>
132-
{isBan ? (
134+
{/*
135+
* Note: we can only ban-and-delete-all when we have a pubkey on load currently.
136+
* The reason is that there is an issue (sogs side), and the server won't lookup a blindedId from a
137+
* sessionID, for the delete_all endpoint specifically.
138+
* When hasPubkeyOnLoad is true, the dialog was shown from a right click on the messages list,
139+
* so we do have the blindedId already in this case.
140+
*/}
141+
{isBan && hasPubkeyOnLoad ? (
133142
<SessionButton
134143
buttonType={SessionButtonType.Simple}
135144
buttonColor={SessionButtonColor.Danger}

0 commit comments

Comments
 (0)