Skip to content

Commit

Permalink
πŸ› (channels): Fix users can reply on threads with no permission (#166)
Browse files Browse the repository at this point in the history
* ✨ 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 <[email protected]>
Co-authored-by: Sarah Kamal <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2024
1 parent 72e0ea4 commit 10c7673
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions app/src/features/chats/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 <DisabledChatInput />;
if (hasNoPostPermission) return <DisabledChatInput />;
}

return (
<>
Expand Down

0 comments on commit 10c7673

Please sign in to comment.