From fbc449e8591b1a901f0955e986491af008d489d6 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 21 Jan 2025 17:47:48 +1100 Subject: [PATCH] fix: trust userGroups is kicked state in addition to the group's one --- ts/state/selectors/selectedConversation.ts | 4 +++- ts/state/selectors/userGroups.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ts/state/selectors/selectedConversation.ts b/ts/state/selectors/selectedConversation.ts index f6178c64d..7d790ca1b 100644 --- a/ts/state/selectors/selectedConversation.ts +++ b/ts/state/selectors/selectedConversation.ts @@ -17,7 +17,7 @@ import { } from './conversations'; import { getLibMembersPubkeys, useLibGroupName } from './groups'; import { getCanWrite, getModerators, getSubscriberCount } from './sogsRoomInfo'; -import { getLibGroupDestroyed, useLibGroupDestroyed } from './userGroups'; +import { getLibGroupDestroyed, getLibGroupKicked, useLibGroupDestroyed } from './userGroups'; const getIsSelectedPrivate = (state: StateType): boolean => { return Boolean(getSelectedConversation(state)?.isPrivate) || false; @@ -59,6 +59,7 @@ export const getSelectedConversationIsPublic = (state: StateType): boolean => { export function getSelectedCanWrite(state: StateType) { const selectedConvoPubkey = getSelectedConversationKey(state); const isSelectedGroupDestroyed = getLibGroupDestroyed(state, selectedConvoPubkey); + const isSelectedGroupKicked = getLibGroupKicked(state, selectedConvoPubkey); if (!selectedConvoPubkey) { return false; } @@ -76,6 +77,7 @@ export function getSelectedCanWrite(state: StateType) { return !( isBlocked || isKickedFromGroup || + isSelectedGroupKicked || isSelectedGroupDestroyed || readOnlySogs || isBlindedAndDisabledMsgRequests diff --git a/ts/state/selectors/userGroups.ts b/ts/state/selectors/userGroups.ts index 6d3b3db12..7f89c680d 100644 --- a/ts/state/selectors/userGroups.ts +++ b/ts/state/selectors/userGroups.ts @@ -26,7 +26,7 @@ export function useLibGroupInviteGroupName(convoId?: string) { return useSelector((state: StateType) => getGroupById(state, convoId)?.name); } -function getLibGroupKicked(state: StateType, convoId?: string) { +export function getLibGroupKicked(state: StateType, convoId?: string) { return getGroupById(state, convoId)?.kicked; }