From 10c767324ef5b43c6d9c1dc59db291e435adb024 Mon Sep 17 00:00:00 2001 From: Asmaa Abozaid <130288326+Asmaa-204@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:01:53 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(channels):=20Fix=20users=20can?= =?UTF-8?q?=20reply=20on=20threads=20with=20no=20permission=20(#166)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ Feat(profile-picture): set/remove profile picture feat(profile-picture): set/remove profile picture * admin mock * fix: adjust sixing (#158) fix: voice notes * 🐛 (channels): Fix users can reply on threads with no permission --------- Co-authored-by: ahmedHamdiy Co-authored-by: Sarah Kamal <143711089+sarah-kamall@users.noreply.github.com> --- app/src/features/chats/ChatInput.tsx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/features/chats/ChatInput.tsx b/app/src/features/chats/ChatInput.tsx index cf2eb7e4..831f6814 100644 --- a/app/src/features/chats/ChatInput.tsx +++ b/app/src/features/chats/ChatInput.tsx @@ -86,11 +86,6 @@ function ChatInput() { const chats = useAppSelector((state) => state.chats.chats); const currChat = getChatByID({ chats: chats, chatID: chatId! }); - const hasNoPostPermission = - currChat?.type === "group" && - !currChat?.messagingPermission && - !isCurrUserAdmin; - const showCheckBox = currChat?.showCheckBox; const isBlocked = currChat?.isBlocked; @@ -101,9 +96,21 @@ function ChatInput() { setError(""); } - if (!activeThread && !isCurrUserAdmin && currChat?.type === "channel") + console.log(currChat?.messagingPermission); + + const isGroupWithoutPostPermission = + currChat?.type === "group" && + !currChat?.messagingPermission && + !isCurrUserAdmin; + + const isChannelWithoutPostPermission = + currChat?.type === "channel" && + !isCurrUserAdmin && + (!activeThread || !currChat?.messagingPermission); + + if (isChannelWithoutPostPermission || isGroupWithoutPostPermission) { return ; - if (hasNoPostPermission) return ; + } return ( <>