mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-22 22:30:52 +01:00
Required changes fixed
This commit is contained in:
parent
17d8233381
commit
985fe9be15
@ -9,7 +9,7 @@ export const ChatHistoryView: FC<{}> = props =>
|
||||
{
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const [ searchText, setSearchText ] = useState<string>('');
|
||||
const { chatHistory = [], setMessengerHistory, addMessengerEntry } = useChatHistory();
|
||||
const { chatHistory = [], setMessengerHistory = null } = useChatHistory();
|
||||
const { report = null } = useHelp();
|
||||
|
||||
const filteredChatHistory = useMemo(() =>
|
||||
@ -23,9 +23,16 @@ export const ChatHistoryView: FC<{}> = props =>
|
||||
|
||||
const reportMessage = (message: any) =>
|
||||
{
|
||||
setMessengerHistory([]); // We do this because we are interested in displaying only the reported message.
|
||||
setMessengerHistory(prevValue =>
|
||||
{
|
||||
const newValue = [ ...prevValue ];
|
||||
|
||||
newValue.push({ id: message.id, webId: message.webId, entityId: message.entityId, name: '', message: message.message, roomId: message.roomId, timestamp: message.timestamp, type: ChatEntryType.TYPE_IM });
|
||||
|
||||
return newValue;
|
||||
});
|
||||
|
||||
report(ReportType.IM, { reportedUserId: message.webId });
|
||||
addMessengerEntry({ id: message.id, webId: message.webId, entityId: message.entityId, name: message.name, timestamp: message.timestamp, type: ChatEntryType.TYPE_IM, roomId: message.roomId, message: message.message });
|
||||
}
|
||||
|
||||
/* useEffect(() =>
|
||||
|
@ -98,7 +98,7 @@ const useChatHistoryState = () =>
|
||||
addMessengerEntry({ id: -1, webId: parser.senderId, entityId: -1, name: '', message: parser.messageText, roomId: -1, timestamp: MessengerHistoryCurrentDate(), type: ChatEntryType.TYPE_IM });
|
||||
});
|
||||
|
||||
return { addChatEntry, chatHistory, roomHistory, messengerHistory, setMessengerHistory, addMessengerEntry };
|
||||
return { addChatEntry, chatHistory, roomHistory, messengerHistory, setMessengerHistory };
|
||||
}
|
||||
|
||||
export const useChatHistory = () => useBetween(useChatHistoryState);
|
||||
|
Loading…
Reference in New Issue
Block a user