From 4a0eb56574a3cfd8f5732f0069cc62cb04f9dd29 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 14 Dec 2022 17:11:25 -0500 Subject: [PATCH] fix: fix special messages not being received because not encrypted --- protocol/common/message_sender.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/protocol/common/message_sender.go b/protocol/common/message_sender.go index 5411aac27..4b589b6d5 100644 --- a/protocol/common/message_sender.go +++ b/protocol/common/message_sender.go @@ -232,6 +232,14 @@ func (s *MessageSender) getMessageID(rawMessage *RawMessage) (types.HexBytes, er return messageID, nil } +func ShouldCommunityMessageBeEncrypted(msgType protobuf.ApplicationMetadataMessage_Type) bool { + return msgType == protobuf.ApplicationMetadataMessage_CHAT_MESSAGE || + msgType == protobuf.ApplicationMetadataMessage_EDIT_MESSAGE || + msgType == protobuf.ApplicationMetadataMessage_DELETE_MESSAGE || + msgType == protobuf.ApplicationMetadataMessage_PIN_MESSAGE || + msgType == protobuf.ApplicationMetadataMessage_EMOJI_REACTION +} + // sendCommunity sends a message that's to be sent in a community // If it's a chat message, it will go to the respective topic derived by the // chat id, if it's not a chat message, it will go to the community topic. @@ -284,7 +292,7 @@ func (s *MessageSender) sendCommunity( } // If it's a chat message, we send it on the community chat topic - if rawMessage.MessageType == protobuf.ApplicationMetadataMessage_CHAT_MESSAGE { + if ShouldCommunityMessageBeEncrypted(rawMessage.MessageType) { messageSpec, err := s.protocol.BuildHashRatchetMessage(rawMessage.CommunityID, wrappedMessage) if err != nil { return nil, err