mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Messages bugfix again :D (#164)
* Handle offline messages | Fetch messages when broadcasted | Fetch message groups * Fetch messages on notification click * Dont fetch groups if duplicate group * Only submit new message on click submit * Fix infinite loading when duplicated group is creatded * Fix infinite loading when group already existed * Make code prettier * Centralize fetch messages on goToConversation * Remove duplicated event * Improve message groups mapping to include yourself for unreadCount + Fix redirection after adding contact + General improvements * Remove conflicts * Fix media paths
This commit is contained in:
1 parent
a2c0f94bd8
commit
0ec2b682e7
12 files changed
+132
-69
No files matched your search
@@ -15,7 +15,13 @@ const MessagesList = (): any => {
|
||||
const history = useHistory();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const { messageGroups, createMessageGroupResult, clearMessageGroupResult } = useMessages();
|
||||
const {
|
||||
messageGroups,
|
||||
createMessageGroupResult,
|
||||
clearMessageGroupResult,
|
||||
getMessageGroupById,
|
||||
setActiveMessageGroup,
|
||||
} = useMessages();
|
||||
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
|
||||
@@ -32,18 +38,24 @@ const MessagesList = (): any => {
|
||||
|
||||
useEffect(() => {
|
||||
if (createMessageGroupResult?.groupId) {
|
||||
const findGroup = messageGroups.find((g) => g.groupId === createMessageGroupResult.groupId);
|
||||
const findGroup = getMessageGroupById(createMessageGroupResult.groupId);
|
||||
clearMessageGroupResult();
|
||||
if (findGroup) {
|
||||
goToConversation(findGroup, history);
|
||||
}
|
||||
}
|
||||
}, [messageGroups, createMessageGroupResult, clearMessageGroupResult, history]);
|
||||
}, [
|
||||
messageGroups,
|
||||
createMessageGroupResult,
|
||||
clearMessageGroupResult,
|
||||
history,
|
||||
setActiveMessageGroup,
|
||||
getMessageGroupById,
|
||||
]);
|
||||
|
||||
if (!messageGroups) return null;
|
||||
|
||||
const handleClick = (messageGroup: MessageGroup) => () => {
|
||||
Nui.send('phone:fetchMessages', { groupId: messageGroup.groupId });
|
||||
goToConversation(messageGroup, history);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user