diff --git a/components/forum/ChatReply.js b/components/forum/ChatReply.js index c4107636d..3b9b7535f 100644 --- a/components/forum/ChatReply.js +++ b/components/forum/ChatReply.js @@ -120,11 +120,11 @@ const ChatReply = ({ existingTagId = existingTags.find((t) => t.signature === signature)?.id } const tagData = { - tag: tagValue, + label: tagValue, invitation: reactionInvitation.id, - replyto: note.id, + note: note.id, forum: note.forum, - signatures: [signature], + signature, ...(existingTagId && { id: existingTagId, ddate: Date.now() }), } api @@ -326,7 +326,7 @@ const ChatReply = ({ {showReactionPicker && ( { - const groupedTags = groupBy(newTags, 'replyto') + const groupedTags = groupBy(newTags, 'note') let newMessageAuthor = '' let newMessage = '' diff --git a/lib/forum-utils.js b/lib/forum-utils.js index ca33f3bca..4f478d44a 100644 --- a/lib/forum-utils.js +++ b/lib/forum-utils.js @@ -21,17 +21,17 @@ export function groupTagsByValue(tags) { for (let i = 0; i < sortedTags.length; i += 1) { const tag = sortedTags[i] - if (tag.tag && !tag.ddate) { - const existingIndex = groupedTags.findIndex((t) => t[0] === tag.tag) + if (tag.label && !tag.ddate) { + const existingIndex = groupedTags.findIndex((t) => t[0] === tag.label) const tagInfo = { id: tag.id, - signature: tag.signatures[0], + signature: tag.signature, cdate: tag.cdate, } if (existingIndex > -1) { groupedTags[existingIndex][1].push(tagInfo) } else { - groupedTags.push([tag.tag, [tagInfo]]) + groupedTags.push([tag.label, [tagInfo]]) } } } @@ -50,11 +50,11 @@ export function addTagToReactionsList(reactions, tag) { const newReactions = [] const newTagInfo = tag.ddate ? null - : { id: tag.id, signature: tag.signatures[0], cdate: tag.cdate } + : { id: tag.id, signature: tag.signature, cdate: tag.cdate } let reactionExists = false reactions.forEach((tuple) => { - if (tuple[0] !== tag.tag) { + if (tuple[0] !== tag.label) { newReactions.push(tuple) } else { if (tag.ddate) { @@ -71,7 +71,7 @@ export function addTagToReactionsList(reactions, tag) { } }) if (!reactionExists && !tag.ddate) { - newReactions.push([tag.tag, [newTagInfo]]) + newReactions.push([tag.label, [newTagInfo]]) } return newReactions } @@ -121,12 +121,10 @@ export function getNoteInvitations(invitations, note) { }) const tagInvitations = invitations.filter((p) => { - const replyTo = p.tag?.replyto const invitationExpired = p.expdate && p.expdate < Date.now() return ( !invitationExpired && - replyTo && - (replyTo === note.id || replyTo.param?.withForum === note.forum) + (p.tag?.note?.id === note.id || p.tag?.note?.param?.withForum === note.forum) ) })