Added message validator tests for emoji reactions

This commit is contained in:
Samuel Hawksby-Robinson 2020-07-10 14:36:31 +01:00 committed by Andrea Maria Piana
parent a0e7e0751c
commit 073ff0b6af
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
1 changed files with 6 additions and 0 deletions

View File

@ -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 {