From add5040b48533da253c317af87a9696c519e3e7e Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Mon, 15 Feb 2021 08:19:14 +0100 Subject: [PATCH] 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. --- VERSION | 2 +- protocol/message_handler.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7c2cb02e9..e6c73154d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.70.1 +0.71.0 diff --git a/protocol/message_handler.go b/protocol/message_handler.go index cb1ee4d9d..5f8c70131 100644 --- a/protocol/message_handler.go +++ b/protocol/message_handler.go @@ -423,6 +423,10 @@ func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error { 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 chat.ProfileUpdates() && receivedMessage.From != chat.Profile { return nil