Prettier
This commit is contained in:
parent
dde730238d
commit
f5617d1b01
@ -154,8 +154,9 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={`subthread-container ${hasMultipleNotes ? "subthread-multi" : ""} ${isLast ? "subthread-last" : "subthread-mid"
|
className={`subthread-container ${hasMultipleNotes ? "subthread-multi" : ""} ${
|
||||||
}`}>
|
isLast ? "subthread-last" : "subthread-mid"
|
||||||
|
}`}>
|
||||||
<Divider variant="small" />
|
<Divider variant="small" />
|
||||||
<Note
|
<Note
|
||||||
highlight={active === first.id}
|
highlight={active === first.id}
|
||||||
@ -184,8 +185,9 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={r.id}
|
key={r.id}
|
||||||
className={`subthread-container ${lastReply ? "" : "subthread-multi"} ${lastReply ? "subthread-last" : "subthread-mid"
|
className={`subthread-container ${lastReply ? "" : "subthread-multi"} ${
|
||||||
}`}>
|
lastReply ? "subthread-last" : "subthread-mid"
|
||||||
|
}`}>
|
||||||
<Divider variant="small" />
|
<Divider variant="small" />
|
||||||
<Note
|
<Note
|
||||||
className={`thread-note ${lastNote ? "is-last-note" : ""}`}
|
className={`thread-note ${lastNote ? "is-last-note" : ""}`}
|
||||||
|
@ -12,11 +12,7 @@ export default function useThreadFeed(link: NostrLink) {
|
|||||||
sub.withOptions({
|
sub.withOptions({
|
||||||
leaveOpen: true,
|
leaveOpen: true,
|
||||||
});
|
});
|
||||||
sub
|
sub.withFilter().kinds([EventKind.TextNote]).link(link).replyToLink(link);
|
||||||
.withFilter()
|
|
||||||
.kinds([EventKind.TextNote])
|
|
||||||
.link(link)
|
|
||||||
.replyToLink(link);
|
|
||||||
allEvents.forEach(x => {
|
allEvents.forEach(x => {
|
||||||
sub.withFilter().kinds([EventKind.TextNote]).link(x).replyToLink(x);
|
sub.withFilter().kinds([EventKind.TextNote]).link(x).replyToLink(x);
|
||||||
});
|
});
|
||||||
|
@ -111,7 +111,7 @@ export abstract class EventExt {
|
|||||||
pubKeys: [],
|
pubKeys: [],
|
||||||
} as Thread;
|
} as Thread;
|
||||||
const replyTags = ev.tags.filter(a => a[0] === "e" || a[0] === "a").map(a => EventExt.parseTag(a));
|
const replyTags = ev.tags.filter(a => a[0] === "e" || a[0] === "a").map(a => EventExt.parseTag(a));
|
||||||
if(replyTags.length > 0) {
|
if (replyTags.length > 0) {
|
||||||
const marked = replyTags.some(a => a.marker);
|
const marked = replyTags.some(a => a.marker);
|
||||||
if (!marked) {
|
if (!marked) {
|
||||||
ret.root = replyTags[0];
|
ret.root = replyTags[0];
|
||||||
|
@ -296,11 +296,14 @@ export class NostrSystem extends ExternalStore<SystemSnapshot> implements System
|
|||||||
if (cacheResults.length > 0) {
|
if (cacheResults.length > 0) {
|
||||||
const resultIds = new Set(cacheResults.map(a => a.id));
|
const resultIds = new Set(cacheResults.map(a => a.id));
|
||||||
f.ids = f.ids.filter(a => !resultIds.has(a));
|
f.ids = f.ids.filter(a => !resultIds.has(a));
|
||||||
q.insertCompletedTrace({
|
q.insertCompletedTrace(
|
||||||
filters:[{...f, ids: [...resultIds]}],
|
{
|
||||||
strategy: RequestStrategy.ExplicitRelays,
|
filters: [{ ...f, ids: [...resultIds] }],
|
||||||
relay: ""
|
strategy: RequestStrategy.ExplicitRelays,
|
||||||
}, cacheResults as Array<TaggedNostrEvent>);
|
relay: "",
|
||||||
|
},
|
||||||
|
cacheResults as Array<TaggedNostrEvent>,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export class ProfileLoaderService {
|
|||||||
TrackMetadata(pk: HexKey | Array<HexKey>) {
|
TrackMetadata(pk: HexKey | Array<HexKey>) {
|
||||||
for (const p of Array.isArray(pk) ? pk : [pk]) {
|
for (const p of Array.isArray(pk) ? pk : [pk]) {
|
||||||
if (p.length === 64) {
|
if (p.length === 64) {
|
||||||
this.#wantsMetadata.add(p)
|
this.#wantsMetadata.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,14 +198,14 @@ export class Query implements QueryBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new trace as a placeholder
|
* Insert a new trace as a placeholder
|
||||||
*/
|
*/
|
||||||
insertCompletedTrace(subq: BuiltRawReqFilter, data: Readonly<Array<TaggedNostrEvent>>) {
|
insertCompletedTrace(subq: BuiltRawReqFilter, data: Readonly<Array<TaggedNostrEvent>>) {
|
||||||
const qt = new QueryTrace(
|
const qt = new QueryTrace(
|
||||||
"",
|
"",
|
||||||
subq.filters,
|
subq.filters,
|
||||||
"",
|
"",
|
||||||
() => {
|
() => {
|
||||||
// nothing to close
|
// nothing to close
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
@ -146,7 +146,9 @@ export class RequestBuilder {
|
|||||||
|
|
||||||
const filtersSquashed = [...relayMerged.values()].map(a => {
|
const filtersSquashed = [...relayMerged.values()].map(a => {
|
||||||
return {
|
return {
|
||||||
filters: system.QueryOptimizer.flatMerge(a.flatMap(b => b.filters.flatMap(c => system.QueryOptimizer.expandFilter(c)))),
|
filters: system.QueryOptimizer.flatMerge(
|
||||||
|
a.flatMap(b => b.filters.flatMap(c => system.QueryOptimizer.expandFilter(c))),
|
||||||
|
),
|
||||||
relay: a[0].relay,
|
relay: a[0].relay,
|
||||||
strategy: a[0].strategy,
|
strategy: a[0].strategy,
|
||||||
} as BuiltRawReqFilter;
|
} as BuiltRawReqFilter;
|
||||||
@ -252,7 +254,7 @@ export class RequestFilterBuilder {
|
|||||||
if (link.type === NostrPrefix.Address) {
|
if (link.type === NostrPrefix.Address) {
|
||||||
this.tag("a", [`${link.kind}:${link.author}:${link.id}`]);
|
this.tag("a", [`${link.kind}:${link.author}:${link.id}`]);
|
||||||
link.relays?.forEach(v => this.relay(v));
|
link.relays?.forEach(v => this.relay(v));
|
||||||
} else if(link.type === NostrPrefix.PublicKey || link.type === NostrPrefix.Profile) {
|
} else if (link.type === NostrPrefix.PublicKey || link.type === NostrPrefix.Profile) {
|
||||||
this.tag("p", [link.id]);
|
this.tag("p", [link.id]);
|
||||||
link.relays?.forEach(v => this.relay(v));
|
link.relays?.forEach(v => this.relay(v));
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,23 +4,23 @@ import { ReqFilter } from "nostr";
|
|||||||
* Remove empty filters, filters which would result in no results
|
* Remove empty filters, filters which would result in no results
|
||||||
*/
|
*/
|
||||||
export function trimFilters(filters: Array<ReqFilter>) {
|
export function trimFilters(filters: Array<ReqFilter>) {
|
||||||
const fNew = [];
|
const fNew = [];
|
||||||
for(const f of filters) {
|
for (const f of filters) {
|
||||||
let arrays = 0;
|
let arrays = 0;
|
||||||
for(const [k, v] of Object.entries(f)) {
|
for (const [k, v] of Object.entries(f)) {
|
||||||
if(Array.isArray(v)) {
|
if (Array.isArray(v)) {
|
||||||
arrays++;
|
arrays++;
|
||||||
if(v.length === 0) {
|
if (v.length === 0) {
|
||||||
delete f[k];
|
delete f[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(arrays > 0 && Object.entries(f).some(v => Array.isArray(v))) {
|
if (arrays > 0 && Object.entries(f).some(v => Array.isArray(v))) {
|
||||||
fNew.push(f);
|
fNew.push(f);
|
||||||
} else if(arrays === 0) {
|
} else if (arrays === 0) {
|
||||||
fNew.push(f);
|
fNew.push(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fNew;
|
return fNew;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user