Fix removing custom emoji reactions from Matrix
This commit is contained in:
@@ -1819,7 +1819,6 @@ func (portal *Portal) handleMatrixReaction(sender *User, evt *event.Event) {
|
|||||||
|
|
||||||
// Figure out if this is a custom emoji or not.
|
// Figure out if this is a custom emoji or not.
|
||||||
emojiID := reaction.RelatesTo.Key
|
emojiID := reaction.RelatesTo.Key
|
||||||
requestEmojiID := emojiID
|
|
||||||
if strings.HasPrefix(emojiID, "mxc://") {
|
if strings.HasPrefix(emojiID, "mxc://") {
|
||||||
uri, _ := id.ParseContentURI(emojiID)
|
uri, _ := id.ParseContentURI(emojiID)
|
||||||
emojiFile := portal.bridge.DB.File.GetByMXC(uri)
|
emojiFile := portal.bridge.DB.File.GetByMXC(uri)
|
||||||
@@ -1828,11 +1827,9 @@ func (portal *Portal) handleMatrixReaction(sender *User, evt *event.Event) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
emojiID = emojiFile.ID
|
emojiID = fmt.Sprintf("%s:%s", emojiFile.EmojiName, emojiFile.ID)
|
||||||
requestEmojiID = fmt.Sprintf("%s:%s", emojiFile.EmojiName, emojiFile.ID)
|
|
||||||
} else {
|
} else {
|
||||||
emojiID = variationselector.Remove(emojiID)
|
emojiID = variationselector.Remove(emojiID)
|
||||||
requestEmojiID = emojiID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
existing := portal.bridge.DB.Reaction.GetByDiscordID(portal.Key, msg.DiscordID, sender.DiscordID, emojiID)
|
existing := portal.bridge.DB.Reaction.GetByDiscordID(portal.Key, msg.DiscordID, sender.DiscordID, emojiID)
|
||||||
@@ -1842,7 +1839,7 @@ func (portal *Portal) handleMatrixReaction(sender *User, evt *event.Event) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := sender.Session.MessageReactionAdd(msg.DiscordProtoChannelID(), msg.DiscordID, requestEmojiID)
|
err := sender.Session.MessageReactionAdd(msg.DiscordProtoChannelID(), msg.DiscordID, emojiID)
|
||||||
go portal.sendMessageMetrics(evt, err, "Error sending")
|
go portal.sendMessageMetrics(evt, err, "Error sending")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dbReaction := portal.bridge.DB.Reaction.New()
|
dbReaction := portal.bridge.DB.Reaction.New()
|
||||||
@@ -1869,7 +1866,7 @@ func (portal *Portal) handleDiscordReaction(user *User, reaction *discordgo.Mess
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
matrixReaction = reactionMXC.String()
|
matrixReaction = reactionMXC.String()
|
||||||
discordID = reaction.Emoji.ID
|
discordID = fmt.Sprintf("%s:%s", reaction.Emoji.Name, reaction.Emoji.ID)
|
||||||
} else {
|
} else {
|
||||||
discordID = reaction.Emoji.Name
|
discordID = reaction.Emoji.Name
|
||||||
matrixReaction = variationselector.Add(reaction.Emoji.Name)
|
matrixReaction = variationselector.Add(reaction.Emoji.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user