fix: trust userGroups is kicked state in addition to the group's one

pull/3281/head
Audric Ackermann 10 months ago
parent 060175004f
commit fbc449e859
No known key found for this signature in database

@ -17,7 +17,7 @@ import {
} from './conversations'; } from './conversations';
import { getLibMembersPubkeys, useLibGroupName } from './groups'; import { getLibMembersPubkeys, useLibGroupName } from './groups';
import { getCanWrite, getModerators, getSubscriberCount } from './sogsRoomInfo'; import { getCanWrite, getModerators, getSubscriberCount } from './sogsRoomInfo';
import { getLibGroupDestroyed, useLibGroupDestroyed } from './userGroups'; import { getLibGroupDestroyed, getLibGroupKicked, useLibGroupDestroyed } from './userGroups';
const getIsSelectedPrivate = (state: StateType): boolean => { const getIsSelectedPrivate = (state: StateType): boolean => {
return Boolean(getSelectedConversation(state)?.isPrivate) || false; return Boolean(getSelectedConversation(state)?.isPrivate) || false;
@ -59,6 +59,7 @@ export const getSelectedConversationIsPublic = (state: StateType): boolean => {
export function getSelectedCanWrite(state: StateType) { export function getSelectedCanWrite(state: StateType) {
const selectedConvoPubkey = getSelectedConversationKey(state); const selectedConvoPubkey = getSelectedConversationKey(state);
const isSelectedGroupDestroyed = getLibGroupDestroyed(state, selectedConvoPubkey); const isSelectedGroupDestroyed = getLibGroupDestroyed(state, selectedConvoPubkey);
const isSelectedGroupKicked = getLibGroupKicked(state, selectedConvoPubkey);
if (!selectedConvoPubkey) { if (!selectedConvoPubkey) {
return false; return false;
} }
@ -76,6 +77,7 @@ export function getSelectedCanWrite(state: StateType) {
return !( return !(
isBlocked || isBlocked ||
isKickedFromGroup || isKickedFromGroup ||
isSelectedGroupKicked ||
isSelectedGroupDestroyed || isSelectedGroupDestroyed ||
readOnlySogs || readOnlySogs ||
isBlindedAndDisabledMsgRequests isBlindedAndDisabledMsgRequests

@ -26,7 +26,7 @@ export function useLibGroupInviteGroupName(convoId?: string) {
return useSelector((state: StateType) => getGroupById(state, convoId)?.name); 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; return getGroupById(state, convoId)?.kicked;
} }

Loading…
Cancel
Save