Treat no returned messages on FetchMessagesFrom as a compelte sync

This commit is contained in:
Sarah Jamie Lewis 2021-05-07 16:33:07 -07:00
parent 6c57555b81
commit 4687ea8d79
1 changed files with 8 additions and 1 deletions

View File

@ -56,7 +56,7 @@ func (s SqliteMessageStore) FetchMessages() []*groups.EncryptedGroupMessage {
func (s SqliteMessageStore) FetchMessagesFrom(signature []byte) []*groups.EncryptedGroupMessage {
// If signature is empty then treat this as a complete sync request
if len(signature) == 0 || signature == nil {
if signature == nil || len(signature) == 0 {
return s.FetchMessages()
}
@ -86,6 +86,13 @@ func (s *SqliteMessageStore) compileRows(rows *sql.Rows) []*groups.EncryptedGrou
Ciphertext: rawCiphertext,
})
}
// if we don't have *any* messages then either the signature next existed
// or the server purged it...either way treat this as a full sync...
if len(messages) < 1 {
return s.FetchMessages()
}
return messages
}