[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: reply notification root uris

+29 -3
+4
data-plane/indexing/plugins/reply.ts
··· 167 167 recordCid: string; 168 168 sortAt: string; 169 169 reasonSubject?: string; 170 + threadRootUri?: string; 170 171 }> = []; 171 172 const notified = new Set([obj.reply.authorDid]); 172 173 const maybeNotify = (notif: { ··· 177 178 recordCid: string; 178 179 sortAt: string; 179 180 reasonSubject?: string; 181 + threadRootUri?: string; 180 182 }) => { 181 183 if (!notified.has(notif.did)) { 182 184 notified.add(notif.did); ··· 211 213 recordUri: obj.reply.uri, 212 214 recordCid: obj.reply.cid, 213 215 sortAt: obj.reply.createdAt, 216 + threadRootUri: obj.reply.reply?.root.uri, 214 217 }); 215 218 // found hidden reply, don't notify any higher ancestors 216 219 if (threadgateHiddenReplies.includes(ancestorUri.toString())) break; ··· 232 235 recordUri: descendent.uri, 233 236 recordCid: descendent.cid, 234 237 sortAt: descendent.sortAt, 238 + threadRootUri: obj.reply.reply?.root.uri, 235 239 }); 236 240 } 237 241 }
+2
data-plane/indexing/processor.ts
··· 41 41 recordCid: string; 42 42 sortAt: string; 43 43 reasonSubject?: string; 44 + threadRootUri?: string; 44 45 }; 45 46 46 47 export class RecordProcessor<T, S> { ··· 374 375 author: notif.author, 375 376 recordUri: notif.recordUri, 376 377 reasonSubject: notif.reasonSubject, 378 + threadRootUri: notif.threadRootUri, 377 379 }); 378 380 }); 379 381 }
+23 -3
utils/push.ts
··· 8 8 author: string; 9 9 recordUri: string; 10 10 reasonSubject?: string; 11 + threadRootUri?: string; 11 12 } 12 13 13 14 export interface PushConfig { ··· 254 255 recordUri: payload.recordUri, 255 256 ...(payload.reasonSubject && 256 257 { reasonSubject: payload.reasonSubject }), 258 + ...(payload.threadRootUri && 259 + { threadRootUri: payload.threadRootUri }), 257 260 }, 258 261 }, 259 262 }; 260 263 261 264 // Add platform-specific options 262 265 if (token.platform === "ios") { 263 - const threadId = this.getThreadId(payload); 266 + const threadId = this.getIosThreadId(payload); 264 267 message.message.apns = { 265 268 headers: { 266 269 "apns-priority": "10", ··· 274 277 }, 275 278 }; 276 279 } else if (token.platform === "android") { 277 - const threadId = this.getThreadId(payload); 280 + const threadId = this.getAndroidTag(payload); 278 281 message.message.android = { 279 282 priority: "high", 280 283 notification: { ··· 510 513 return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""); 511 514 } 512 515 513 - private getThreadId(payload: PushPayload): string { 516 + private getIosThreadId(payload: PushPayload): string { 514 517 if (payload.reason === "follow") { 515 518 return "follows"; 519 + } 520 + if (payload.reason === "reply") { 521 + return payload.threadRootUri ?? payload.reasonSubject ?? 522 + payload.recordUri; 523 + } 524 + if (payload.reasonSubject) { 525 + return payload.reasonSubject; 526 + } 527 + return payload.recordUri; 528 + } 529 + 530 + private getAndroidTag(payload: PushPayload): string { 531 + if (payload.reason === "follow") { 532 + return "follows"; 533 + } 534 + if (payload.reason === "reply") { 535 + return payload.reasonSubject ?? payload.recordUri; 516 536 } 517 537 if (payload.reasonSubject) { 518 538 return payload.reasonSubject;