File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,23 +84,6 @@ export const buildDefaultChannelActionItems: BuildDefaultChannelActionItems = (
8484 : undefined ;
8585
8686 const actionItems : ChannelActionItem [ ] = [
87- // isPinned
88- // ? {
89- // action: unpin,
90- // Icon: <View />,
91- // id: 'unpin',
92- // label: '',
93- // placement: 'both',
94- // type: 'standard',
95- // }
96- // : {
97- // action: pin,
98- // Icon: <View />,
99- // id: 'pin',
100- // label: '',
101- // placement: 'both',
102- // type: 'standard',
103- // },
10487 {
10588 action : isDirectChat
10689 ? muteActive
Original file line number Diff line number Diff line change 11import { Alert } from 'react-native' ;
22
3+ import { useUserMuteActive } from './useUserMuteActive' ;
4+
35import type { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext' ;
46import type { ChatContextValue } from '../../../contexts/chatContext/ChatContext' ;
57import { MessageComposerAPIContextValue } from '../../../contexts/messageComposerContext/MessageComposerAPIContext' ;
@@ -32,14 +34,12 @@ export const useMessageActionHandlers = ({
3234 const handleResendMessage = ( ) => retrySendMessage ( message ) ;
3335 const translatedMessage = useTranslatedMessage ( message ) ;
3436
37+ const isMuted = useUserMuteActive ( message . user ) ;
38+
3539 const handleQuotedReplyMessage = ( ) => {
3640 setQuotedMessage ( message ) ;
3741 } ;
3842
39- const isMuted = ( client . mutedUsers || [ ] ) . some (
40- ( mute ) => mute . user . id === client . userID && mute . target . id === message . user ?. id ,
41- ) ;
42-
4343 const handleCopyMessage = ( ) => {
4444 if ( ! message . text ) {
4545 return ;
Original file line number Diff line number Diff line change 1+ import { UserResponse } from 'stream-chat' ;
2+
3+ import { useChannelContext , useChatContext } from '../../../contexts' ;
4+ import { useMutedUsers } from '../../ChannelList/hooks/useMutedUsers' ;
5+
6+ export const useUserMuteActive = ( user : UserResponse | null | undefined ) => {
7+ const { client } = useChatContext ( ) ;
8+ const { channel } = useChannelContext ( ) ;
9+ const mutedUsers = useMutedUsers ( channel ) ;
10+
11+ if ( ! user ) {
12+ return false ;
13+ }
14+
15+ return ! ! mutedUsers . find ( ( mute ) => mute . user . id === client . userID && user . id === mute . target . id ) ;
16+ } ;
You can’t perform that action at this time.
0 commit comments