Fix image messages being dropped in profile chats

It looks like profile chats are created as public chats, and the code
will drop messages for it.

This commit fixes the issue by checking for the "@" prefix in profile
chat names, until we fix the issue by migrating those chats.
This commit is contained in:
Andrea Maria Piana 2021-02-15 15:50:04 +01:00
parent 6ac1c43926
commit 31b9a924ce
2 changed files with 5 additions and 2 deletions

View File

@ -1 +1 @@
0.71.1 0.71.2

View File

@ -4,6 +4,7 @@ import (
"crypto/ecdsa" "crypto/ecdsa"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"strings"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -423,7 +424,9 @@ func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error {
return err // matchChatEntity returns a descriptive error message return err // matchChatEntity returns a descriptive error message
} }
if chat.Public() && receivedMessage.ContentType == protobuf.ChatMessage_IMAGE { // 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 && !strings.HasPrefix(chat.ID, "@") {
return errors.New("images are not allowed in public chats") return errors.New("images are not allowed in public chats")
} }