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
+1 -1
View File
@@ -747,7 +747,7 @@ body[showing-chat] #chat-page-wrapper {
display: none;
}
.message-reaction-row {
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
}
/* src/View/ChatPages/taskPage.css */
+19 -1
View File
@@ -1495,7 +1495,7 @@
const fileContent = FileModel2.createFileContent(v4_default(), "reaction");
const reaction = {
...fileContent,
fileId: sender,
fileId: _ChatModel.createMessageReactionId(messageId, content, sender),
messageId,
sender,
content,
@@ -1504,7 +1504,25 @@
return reaction;
};
}
static {
this.createMessageReactionId = (messageId, content, sender) => {
console.log(reactionStringMap, content, reactionStringMap[content]);
return messageId + sender + reactionStringMap[content];
};
}
};
var ReactionSymbols = /* @__PURE__ */ ((ReactionSymbols2) => {
ReactionSymbols2["ThumbsUp"] = "\u{1F44D}";
ReactionSymbols2["Check"] = "\u2705";
ReactionSymbols2["Attention"] = "\u2757\uFE0F";
ReactionSymbols2["DoubleAttention"] = "\u203C\uFE0F";
ReactionSymbols2["Question"] = "\u2753";
return ReactionSymbols2;
})(ReactionSymbols || {});
var reactionStringMap = {};
Object.entries(ReactionSymbols).forEach((value) => {
reactionStringMap[value[1]] = value[0];
});
var ChatInfoReference = {
dataVersion: DATA_VERSION,
primaryChannel: "",
+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[];