feat(mentions): wire Remove action to server-side delete packet

This commit is contained in:
simoleo89
2026-06-02 14:44:22 +02:00
committed by simoleo89
parent 49d3bde50a
commit 2d126a7b9a
2 changed files with 6 additions and 5 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
import { CreateLinkEvent, MarkMentionsReadComposer } from '@nitrots/nitro-renderer';
import { CreateLinkEvent, DeleteMentionComposer, MarkMentionsReadComposer } from '@nitrots/nitro-renderer';
import { useMemo } from 'react';
import { IMentionEntry, SendMessageComposer } from '../../api';
import { markRead, removeMention } from '../../hooks/mentions/mentionsStore';
@@ -9,9 +9,8 @@ export interface MentionActions
open: (mention: IMentionEntry) => void;
/** Explicit "go to room" action: mark read, then jump to the origin room. */
goto: (mention: IMentionEntry) => void;
/** Remove from the list (client-side). Marks read on the server so it does
* not reappear as unread after a relog. A true server-side delete packet
* is a follow-up. */
/** Permanently delete the mention server-side (DeleteMentionComposer) and
* drop it from the local list, so it does not reappear after a relog. */
remove: (mention: IMentionEntry) => void;
}
@@ -33,7 +32,8 @@ export const useMentionActions = (): MentionActions => useMemo(() => ({
},
remove: (mention) =>
{
if(!mention.read) SendMessageComposer(new MarkMentionsReadComposer(1, mention.mentionId));
// Permanent server-side delete, then drop it from the local list.
SendMessageComposer(new DeleteMentionComposer(mention.mentionId));
removeMention(mention.mentionId);
}
}), []);
+1
View File
@@ -384,6 +384,7 @@ export class GetUserFlatCatsMessageComposer extends StubClass {}
export class NavigatorSearchComposer extends StubClass {}
export class RequestMentionsComposer extends StubClass {}
export class MarkMentionsReadComposer extends StubClass {}
export class DeleteMentionComposer extends StubClass {}
export class DesktopViewComposer extends StubClass {}
export class FurniturePlacePaintComposer extends StubClass {}
export class GetGuestRoomMessageComposer extends StubClass {}