mirror of
https://github.com/status-im/status-go.git
synced 2025-02-18 01:37:22 +00:00
Fix push notification & mentions
The code had an issue where it would not register a chat if just joined as re-register push notifications was called before the chat had been added. This commit fixes the behavior by making sure that the chat just joined is included.
This commit is contained in:
parent
9e148eab89
commit
a759d9dd67
@ -1377,13 +1377,9 @@ func (m *Messenger) saveChat(chat *Chat) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We check if it's a new chat, or chat.Active has changed
|
// We check if it's a new chat, or chat.Active has changed
|
||||||
if chat.Public() && (!ok && chat.Active) || (ok && chat.Active != previousChat.Active) {
|
// we check here, but we only re-register once the chat has been
|
||||||
// Re-register for push notifications, as we want to receive mentions
|
// saved an added
|
||||||
if err := m.reregisterForPushNotifications(); err != nil {
|
shouldRegisterForPushNotifications := chat.Public() && (!ok && chat.Active) || (ok && chat.Active != previousChat.Active)
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
err := m.persistence.SaveChat(*chat)
|
err := m.persistence.SaveChat(*chat)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1391,6 +1387,14 @@ func (m *Messenger) saveChat(chat *Chat) error {
|
|||||||
}
|
}
|
||||||
m.allChats[chat.ID] = chat
|
m.allChats[chat.ID] = chat
|
||||||
|
|
||||||
|
if shouldRegisterForPushNotifications {
|
||||||
|
// Re-register for push notifications, as we want to receive mentions
|
||||||
|
if err := m.reregisterForPushNotifications(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user