aboutsummaryrefslogtreecommitdiffstats
path: root/src/dm-inbox.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-18 09:48:13 -0700
committerAdam Soltys <[email protected]>2026-10-18 09:48:13 -0700
commit5869fa2ce351efa485ae6547d618a216b09a47c1 (patch)
tree6894739087f320bd48c18c58fd5ca6fe8d8d6781 /src/dm-inbox.js
parentaaebbd5d51e0e149c36975122dd0ae59e6c011bb (diff)
downloadcoinosv3-5869fa2ce351efa485ae6547d618a216b09a47c1.tar.gz
coinosv3-5869fa2ce351efa485ae6547d618a216b09a47c1.zip
A call from someone you don't follow and haven't written to no longer vanishes: it doesn't ring, but it's a missed call in your conversation with them, saying it didn't ring and why, a tap away from calling back (with the app shut, the worker notes it for the app, without a notification). A muted person's still leaves nothing. A logged call no longer counts as having written to someone.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
Diffstat (limited to 'src/dm-inbox.js')
-rw-r--r--src/dm-inbox.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dm-inbox.js b/src/dm-inbox.js
index 1a026c1..58fc72d 100644
--- a/src/dm-inbox.js
+++ b/src/dm-inbox.js
@@ -122,7 +122,8 @@ export function shouldNotifyDm(verdict) {
// it's for, and worth ringing only as a fresh offer from someone this
// account follows or talks to, and hasn't muted. Returns { offer, name,
// type } to ring with, or null for anything else (a candidate, a stranger,
-// a stale one, a wrap we hold no key for).
+// a stale one, a wrap we hold no key for); `quiet` for a caller who
+// may not ring us (not followed, not written to).
export async function classifyCall(wrap, inboxes, nowS = Math.floor(Date.now() / 1000)) {
for (const rec of inboxes) {
if (!rec || !rec.sk) continue;
@@ -133,9 +134,11 @@ export async function classifyCall(wrap, inboxes, nowS = Math.floor(Date.now() /
const from = ev.pubkey;
if (ev.kind !== CALL.OFFER || from === rec.pubkey || nowS - ev.created_at > RING_S) return null;
if ((rec.muted || []).includes(from)) return null;
- if (!(rec.follows || []).includes(from) && !(rec.known || []).includes(from)) return null;
const type = (ev.tags.find((x) => x[0] === 'call-type') || [])[1] === 'video' ? 'video' : 'voice';
- return { offer: ev, name: (rec.names || {})[from] || null, type };
+ // someone not followed nor written to doesn't ring — `quiet`: the app
+ // lists it as a call that didn't ring, next time it opens
+ const quiet = !(rec.follows || []).includes(from) && !(rec.rings || rec.known || []).includes(from);
+ return { offer: ev, name: (rec.names || {})[from] || null, type, quiet };
}
return null;
}