From 073ff0b6afd1d34f3b39291bce0c8749802e0456 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Fri, 10 Jul 2020 14:36:31 +0100 Subject: [PATCH] Added message validator tests for emoji reactions --- protocol/message_validator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/protocol/message_validator.go b/protocol/message_validator.go index de1c27d9a..39dc11313 100644 --- a/protocol/message_validator.go +++ b/protocol/message_validator.go @@ -213,6 +213,9 @@ func ValidateReceivedChatMessage(message *protobuf.ChatMessage, whisperTimestamp if emojiR == nil { return errors.New("no emoji reaction data") } + if len(emojiR.MessageId) == 0 { + return errors.New("emoji reaction no target message id") + } if emojiR.Type == protobuf.EmojiReaction_UNKNOWN_EMOJI_REACTION_TYPE { return errors.New("emoji reaction type unknown") } @@ -225,6 +228,9 @@ func ValidateReceivedChatMessage(message *protobuf.ChatMessage, whisperTimestamp if emojiRR == nil { return errors.New("no emoji reaction retraction data") } + if len(emojiRR.EmojiReactionId) == 0 { + return errors.New("emoji reaction retraction no target emoji reaction id") + } } if message.ContentType == protobuf.ChatMessage_AUDIO {