chore: some notification fixes
This commit is contained in:
parent
b199d1a366
commit
a6707c111f
3
packages/app/.gitignore
vendored
3
packages/app/.gitignore
vendored
@ -25,4 +25,5 @@ yarn-error.log*
|
||||
.idea
|
||||
|
||||
dist/
|
||||
dev-dist/
|
||||
dev-dist/
|
||||
.wrangler/
|
@ -153,6 +153,7 @@ export function NotificationGroup({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{window.location.search === "?debug=true" && <pre>{JSON.stringify(evs, undefined, 2)}</pre>}
|
||||
{context && <NotificationContext link={context} />}
|
||||
</div>
|
||||
</>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { EventKind, Nip10, NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||
import { EventKind, Nip10, NostrEvent, NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||
|
||||
export function getNotificationContext(ev: TaggedNostrEvent) {
|
||||
switch (ev.kind) {
|
||||
@ -17,14 +17,18 @@ export function getNotificationContext(ev: TaggedNostrEvent) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EventKind.Repost:
|
||||
case EventKind.Repost: {
|
||||
if (ev.kind === EventKind.Repost && ev.content.startsWith("{")) {
|
||||
const innerEvent = JSON.parse(ev.content) as NostrEvent;
|
||||
return NostrLink.fromEvent(innerEvent);
|
||||
} else {
|
||||
const thread = Nip10.parseThread(ev);
|
||||
return thread?.replyTo ?? thread?.root ?? thread?.mentions[0];
|
||||
}
|
||||
}
|
||||
case EventKind.Reaction: {
|
||||
const thread = Nip10.parseThread(ev);
|
||||
const tag = thread?.replyTo ?? thread?.root ?? thread?.mentions[0];
|
||||
if (tag) {
|
||||
return tag;
|
||||
}
|
||||
break;
|
||||
return thread?.replyTo ?? thread?.root ?? thread?.mentions[0];
|
||||
}
|
||||
case EventKind.TextNote: {
|
||||
return NostrLink.fromEvent(ev);
|
||||
|
@ -18,7 +18,10 @@ export class DiffSyncTags extends EventEmitter<SafeSyncEvents> {
|
||||
#changesEncrypted: Array<TagDiff> = [];
|
||||
#decryptedContent?: string;
|
||||
|
||||
constructor(readonly link: NostrLink, readonly contentEncrypted: boolean) {
|
||||
constructor(
|
||||
readonly link: NostrLink,
|
||||
readonly contentEncrypted: boolean,
|
||||
) {
|
||||
super();
|
||||
this.#sync = new SafeSync(link);
|
||||
this.#sync.on("change", () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user