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:
parent
6ac1c43926
commit
31b9a924ce
|
@ -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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue