DM messages fix

This commit is contained in:
2025-12-22 20:55:22 +01:00
parent f780a8eb3e
commit ac7fb25e47
6 changed files with 17 additions and 18 deletions
+13 -4
View File
@@ -22,13 +22,17 @@ export default function DMs() {
auth({
id: target.node_address,
wsRef: targetNode,
addMessage: app.addMessage,
deleteMessage: app.deleteMessage,
editMessage: app.editMessage,
messageStore: app.privateMessages,
});
}
connectTargetNode();
app.setCurrentChannel({
id: id,
name: target?.display_name || id,
kind: "text",
});
}, [target]);
return loading || target ? (
@@ -37,16 +41,21 @@ export default function DMs() {
app={app}
channelName={target?.display_name || id}
channelIcon={target?.avatar_url || "_"}
messages={app.privateMessages.filter(
messages={app.privateMessages.messages.filter(
(m) =>
(m.channel_id === id && m.from === app.profile?.id) ||
(m.from === id && m.channel_id === app.profile?.id)
)}
sendRequest={(req) => {
console.log("Sending request: ", req);
switch (req.type) {
case "send_message":
targetNode.current?.send(JSON.stringify(req));
break;
case "load_chunk":
targetNode.current?.send(JSON.stringify(req));
app.node.current?.send(JSON.stringify(req));
break;
default:
app.node.current?.send(JSON.stringify(req));
break;
+1 -1
View File
@@ -52,7 +52,7 @@ export default function ChatHub() {
channels: [],
},
];
const recentActivity = app.privateMessages.slice(0, 3);
const recentActivity = app.privateMessages.messages.slice(0, 3);
return (
<AppLayout app={app}>