feat(chat): self-chat 'You' — note-to-self (#4)

Pinned 'You' chat at the top of the list (always available); messaging yourself works
(to===me), with no self push/echo notification and a 'Message yourself' header. Self is
filtered from the normal contacts and shows no status dot. build batch24.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 12:05:32 +05:30
parent 15350c691b
commit 462a167438
2 changed files with 19 additions and 10 deletions
+3 -3
View File
@@ -1234,9 +1234,9 @@ route('POST', '/api/messages', async (req, res) => {
const dto = buildMsgDTO(R.messages.byId(id), namesFor(u.team_id), u.id);
const push = { type: 'chat-message', message: { ...dto, fromName: u.name || u.email } };
try { CHAT.pushToUser(to, push); } catch (_) {}
try { CHAT.pushToUser(u.id, push); } catch (_) {} // sync the sender's other devices
// Background/closed-tab push to the recipient (opens the DM with this sender).
PUSH.sendToUser(to, { title: (u.name || u.email), body: (text ? (text.length > 80 ? text.slice(0, 80) + '…' : text) : '📎 Attachment'), kind: 'dm', id: u.id, tag: 'dm:' + u.id });
if (to !== u.id) try { CHAT.pushToUser(u.id, push); } catch (_) {} // sync the sender's other devices (skip for self-notes)
// Background/closed-tab push to the recipient (opens the DM). Not for a note-to-self.
if (to !== u.id) PUSH.sendToUser(to, { title: (u.name || u.email), body: (text ? (text.length > 80 ? text.slice(0, 80) + '…' : text) : '📎 Attachment'), kind: 'dm', id: u.id, tag: 'dm:' + u.id });
json(res, 200, dto);
});