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:
J Francisco Rader authored and GitHub committed 2021-03-18 23:01:54 -03:00
1 parent a2c0f94bd8
commit 0ec2b682e7
12 files changed
+132 -69

No files matched your search

@@ -77,7 +77,6 @@ export const MessageModal = () => {
useEffect(() => {
if (!groupId) return;
setActiveMessageGroup(groupId);
}, [groupId, setActiveMessageGroup]);
@@ -109,10 +108,11 @@ export const MessageModal = () => {
const handleAddContact = (number) => {
const exists = getContactByNumber(number);
const referal = encodeURIComponent(pathname);
if (exists) {
return history.push(`/contacts/${exists.id}/?referal=${pathname}`);
return history.push(`/contacts/${exists.id}/?referal=${referal}`);
}
return history.push(`/contacts/-1/?addNumber=${number}&referal=${pathname}`);
return history.push(`/contacts/-1/?addNumber=${number}&referal=${referal}`);
};
const phoneNumbers = activeMessageGroup?.phoneNumbers || [];
@@ -164,7 +164,7 @@ export const MessageModal = () => {
) : null}
</Box>
</Paper>
{isLoaded ? (
{isLoaded && activeMessageGroup ? (
<Conversation
onClickDisplay={handleAddContact}
messages={messages}