Allow emoji reactions
This commit is contained in:
parent
f3afa962c6
commit
06dcf0cea9
|
@ -755,11 +755,18 @@ func (m *MessageHandler) matchChatEntity(chatEntity common.ChatEntity, chats map
|
|||
return nil, errors.New("not an community chat")
|
||||
}
|
||||
|
||||
var emojiReaction bool
|
||||
// We allow emoji reactions from anyone
|
||||
switch chatEntity.(type) {
|
||||
case *EmojiReaction:
|
||||
emojiReaction = true
|
||||
}
|
||||
|
||||
canPost, err := m.communitiesManager.CanPost(chatEntity.GetSigPubKey(), chat.CommunityID, chat.CommunityChatID(), chatEntity.GetGrant())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !canPost {
|
||||
if !emojiReaction && !canPost {
|
||||
return nil, errors.New("user can't post")
|
||||
}
|
||||
|
||||
|
|
|
@ -2304,7 +2304,9 @@ func (m *Messenger) dispatchMessage(ctx context.Context, spec common.RawMessage)
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !canPost {
|
||||
|
||||
// We allow emoji reactions by anyone
|
||||
if spec.MessageType != protobuf.ApplicationMetadataMessage_EMOJI_REACTION && !canPost {
|
||||
m.logger.Error("can't post on chat", zap.String("chat-id", chat.ID), zap.String("chat-name", chat.Name))
|
||||
|
||||
return nil, errors.New("can't post on chat")
|
||||
|
|
|
@ -178,7 +178,7 @@ func (db sqlitePersistence) DeleteChat(chatID string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
_, err := tx.Exec(`DELETE FROM user_messages WHERE local_chat_id = ?`, chatID)
|
||||
_, err = tx.Exec(`DELETE FROM user_messages WHERE local_chat_id = ?`, chatID)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue