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