fix generation of reaction ids to support multiple reactions

This commit is contained in:
marlon-erler
2026-04-07 20:19:52 +00:00
parent 01d57038e9
commit 5189107bed
3 changed files with 30 additions and 3 deletions
+10 -1
View File
@@ -417,7 +417,7 @@ export default class ChatModel {
const fileContent = FileModel.createFileContent(v4(), "reaction");
const reaction: ChatMessageReaction = {
...fileContent,
fileId: sender,
fileId: ChatModel.createMessageReactionId(messageId, content, sender),
messageId,
sender,
@@ -426,6 +426,10 @@ export default class ChatModel {
};
return reaction;
};
static createMessageReactionId = (messageId: string, content: ReactionSymbols, sender: string): string => {
return messageId + sender + reactionStringMap[content];
}
}
// types
@@ -437,6 +441,11 @@ export enum ReactionSymbols {
Question = "❓",
}
const reactionStringMap: {[key: ReactionSymbols|string]: string} = {}
Object.entries(ReactionSymbols).forEach(value => {
reactionStringMap[value[1]] = value[0];
});
export interface ChatInfo extends ValidObject {
primaryChannel: string;
secondaryChannels: string[];