aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 57f0e23..03fabee 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -7771,22 +7771,28 @@ export function messagesFeature(ctx) {
if (!staged) feedStaged.set(c, staged = new Set());
// (with those waiting a moment to go in together — admitQueues — or a
// copy from a second relay, or another version of a clip, slips in)
+ const noteOf = (e) => (e.kind === REPOST ? repostInner(e) : e);
+ // Your own boost is the exception: it has a row of its own at the time
+ // you boosted, whether or not the post is in the feed already, and it
+ // doesn't keep the post itself (or someone else's repost of it) out.
+ const own = (e) => e.kind === REPOST && isMe(e.pubkey);
const held = [...c.notes, ...(c.deferred || []), ...((admitQueues.get(c) || {}).evs || [])];
const known = new Set(held.map((e) => e.id));
for (const e of evs || []) noteForSpam(e);
// A note shows once: as itself, or under the first repost of it to
// arrive — counting the ones still warming at the door.
// (`staged` holds the note's id too, for a repost)
- const noteOf = (e) => (e.kind === REPOST ? repostInner(e) : e);
- const notesIn = new Set(held.map((e) => noteOf(e)?.id).filter(Boolean));
+ const notesIn = new Set(held.filter((e) => !own(e)).map((e) => noteOf(e)?.id).filter(Boolean));
+ const boostedIn = new Set(held.filter(own).map((e) => noteOf(e)?.id).filter(Boolean));
// an addressable post (a 34235/34236 clip) once, however many versions of it come
- for (const e of held) { const a = noteOf(e) && addrOf(noteOf(e)); if (a) notesIn.add(a); }
- const addrNew = (e) => { const n = noteOf(e); const a = n && addrOf(n); return !a || (!notesIn.has(a) && !staged.has(a) && !!staged.add(a)); };
- const fresh = (e) => { const n = noteOf(e); return !!n && !notesIn.has(n.id) && !staged.has(n.id); };
- const unstage = (e) => { staged.delete(e.id); const n = noteOf(e); if (n) { staged.delete(n.id); const a = addrOf(n); if (a) staged.delete(a); } };
+ for (const e of held) { const a = !own(e) && noteOf(e) && addrOf(noteOf(e)); if (a) notesIn.add(a); }
+ const addrNew = (e) => { const n = noteOf(e); const a = !own(e) && n && addrOf(n); return !a || (!notesIn.has(a) && !staged.has(a) && !!staged.add(a)); };
+ const stageId = (e) => (own(e) ? 'own:' : '') + noteOf(e).id;
+ const fresh = (e) => { const n = noteOf(e); return !!n && !(own(e) ? boostedIn : notesIn).has(n.id) && !staged.has(stageId(e)); };
+ const unstage = (e) => { staged.delete(e.id); const n = noteOf(e); if (n) { staged.delete(stageId(e)); const a = !own(e) && addrOf(n); if (a) staged.delete(a); } };
const def = feedDef(c.id);
let add = (evs || []).filter((e) => (e.kind === REPOST ? !(def && def.replies) && !!repostInner(e) && !hidden(repostInner(e)) && !reboosted(e) : feedKeeps(def, e)) && !hidden(e)
- && fresh(e) && !known.has(e.id) && !staged.has(e.id) && addrNew(e) && known.add(e.id) && staged.add(e.id) && staged.add(noteOf(e).id));
+ && fresh(e) && !known.has(e.id) && !staged.has(e.id) && addrNew(e) && known.add(e.id) && staged.add(e.id) && staged.add(stageId(e)));
if (def && def.search) add = add.filter((e) => !nearCopy(c, held, e));
if (!add.length) return false;
if (def && def.curated) {
@@ -11823,6 +11829,9 @@ export function messagesFeature(ctx) {
const evt = id.signer instanceof Uint8Array ? finalizeEvent(partial, id.signer) : await id.signer.signEvent(partial);
noteEvent(evt);
render();
+ // in the feeds that carry your posts now, as your own post is
+ const carries = (def) => !!def && !def.replies && (!!def.all || feedAuthors(def).includes(id.pubkey));
+ for (const c of new Set([feed, feedStates.get(FOLLOWING)])) if (c && !c.stopped && carries(feedDef(c.id))) mergeFeed([evt], {}, c).catch(() => {});
const ok = await publishOn(relays, evt);
toast(ok ? t('postBoosted') : t('msgSendFailed'));
}