Drop image messages in public chats

Currently image messages are actually displayed, we only prevent
sending.
This commit changes the behavior so that we drop them.
This commit is contained in:
Andrea Maria Piana 2021-02-15 08:19:14 +01:00
parent 61993fab47
commit add5040b48
2 changed files with 5 additions and 1 deletions

View File

@ -1 +1 @@
0.70.1 0.71.0

View File

@ -423,6 +423,10 @@ 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 {
return errors.New("images are not allowed in public chats")
}
// If profile updates check if author is the same as chat profile public key // If profile updates check if author is the same as chat profile public key
if chat.ProfileUpdates() && receivedMessage.From != chat.Profile { if chat.ProfileUpdates() && receivedMessage.From != chat.Profile {
return nil return nil