don't sync profile and timeline chats

This commit is contained in:
andrey 2021-03-04 14:02:08 +01:00 committed by flexsurfer
parent aab93a6abb
commit 66c78c6a7f
5 changed files with 7 additions and 10 deletions

View File

@ -1 +1 @@
0.73.1
0.73.2

View File

@ -4,7 +4,6 @@ import (
"crypto/ecdsa"
"errors"
"math/rand"
"strings"
"github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types"
@ -101,10 +100,8 @@ func (c *Chat) ProfileUpdates() bool {
return c.ChatType == ChatTypeProfile
}
// It looks like status-react created profile chats as public chats
// so for now we need to check for the presence of "@" in their chatID
func (c *Chat) Timeline() bool {
return c.ChatType == ChatTypeTimeline || (c.Public() && strings.HasPrefix(c.ID, "@"))
return c.ChatType == ChatTypeTimeline
}
func (c *Chat) OneToOne() bool {

View File

@ -4,7 +4,6 @@ import (
"crypto/ecdsa"
"encoding/hex"
"fmt"
"github.com/pkg/errors"
"github.com/status-im/status-go/eth-node/crypto"
@ -448,7 +447,9 @@ func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error {
return err // matchChatEntity returns a descriptive error message
}
if chat.Public() && receivedMessage.ContentType == protobuf.ChatMessage_IMAGE && !chat.Timeline() {
// It looks like status-react created profile chats as public chats
// so for now we need to check for the presence of "@" in their chatID
if chat.Public() && receivedMessage.ContentType == protobuf.ChatMessage_IMAGE && !chat.ProfileUpdates() {
return errors.New("images are not allowed in public chats")
}

View File

@ -2210,7 +2210,7 @@ func (m *Messenger) SyncDevices(ctx context.Context, ensName, photoPath string)
}
for _, chat := range m.allChats {
if !chat.Timeline() && chat.Public() && chat.Active {
if !chat.Timeline() && !chat.ProfileUpdates() && chat.Public() && chat.Active {
if err := m.syncPublicChat(ctx, chat); err != nil {
return err
}

View File

@ -3,7 +3,6 @@ package protocol
import (
"context"
"errors"
"github.com/status-im/status-go/protocol/common"
"github.com/status-im/status-go/protocol/requests"
"github.com/status-im/status-go/protocol/transport"
@ -154,7 +153,7 @@ func (m *Messenger) saveChat(chat *Chat) error {
chat.Identicon = identicon
}
// Sync chat if it's a new active public chat, but not a timeline chat
if !ok && chat.Active && chat.Public() && !chat.Timeline() {
if !ok && chat.Active && chat.Public() && !chat.ProfileUpdates() && !chat.Timeline() {
if err := m.syncPublicChat(context.Background(), chat); err != nil {
return err