mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-26 23:50: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 [ isVisible, setIsVisible ] = useState(false);
|
||||||
const [ searchText, setSearchText ] = useState<string>('');
|
const [ searchText, setSearchText ] = useState<string>('');
|
||||||
const { chatHistory = [], setMessengerHistory, addMessengerEntry } = useChatHistory();
|
const { chatHistory = [], setMessengerHistory = null } = useChatHistory();
|
||||||
const { report = null } = useHelp();
|
const { report = null } = useHelp();
|
||||||
|
|
||||||
const filteredChatHistory = useMemo(() =>
|
const filteredChatHistory = useMemo(() =>
|
||||||
@ -23,9 +23,16 @@ export const ChatHistoryView: FC<{}> = props =>
|
|||||||
|
|
||||||
const reportMessage = (message: any) =>
|
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 });
|
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(() =>
|
/* 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 });
|
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);
|
export const useChatHistory = () => useBetween(useChatHistoryState);
|
||||||
|
Loading…
Reference in New Issue
Block a user