mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-08 04:54:32 +00:00
fix ID checks in resolveCollectionItems
This commit is contained in:
parent
facedd3646
commit
1ab5ceb65a
1 changed files with 4 additions and 4 deletions
|
@ -93,12 +93,12 @@ export class Resolver {
|
||||||
const items: IObjectWithId[] = [];
|
const items: IObjectWithId[] = [];
|
||||||
|
|
||||||
const collectionObj = await this.resolveCollection(collection);
|
const collectionObj = await this.resolveCollection(collection);
|
||||||
await this.resolveCollectionItemsTo(collectionObj, limit ?? undefined, allowAnonymousItems, collectionObj.id, items);
|
await this.resolveCollectionItemsTo(collectionObj, limit ?? undefined, allowAnonymousItems, items);
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async resolveCollectionItemsTo(current: AnyCollection | null, limit: number | undefined, allowAnonymousItems: boolean | undefined, sourceUri: string | undefined, destination: IObjectWithId[]): Promise<void> {
|
private async resolveCollectionItemsTo(current: AnyCollection | null, limit: number | undefined, allowAnonymousItems: boolean | undefined, destination: IObjectWithId[]): Promise<void> {
|
||||||
// This is pulled up to avoid code duplication below
|
// This is pulled up to avoid code duplication below
|
||||||
const iterate = async(items: ApObject): Promise<void> => {
|
const iterate = async(items: ApObject): Promise<void> => {
|
||||||
for (const item of toArray(items)) {
|
for (const item of toArray(items)) {
|
||||||
|
@ -109,8 +109,8 @@ export class Resolver {
|
||||||
if (limit != null && limit < 1) break;
|
if (limit != null && limit < 1) break;
|
||||||
|
|
||||||
// Use secureResolve whenever possible, to avoid re-fetching items that were included inline.
|
// Use secureResolve whenever possible, to avoid re-fetching items that were included inline.
|
||||||
const resolved = (sourceUri && !allowAnonymousItems)
|
const resolved = current?.id
|
||||||
? await this.secureResolve(item, sourceUri)
|
? await this.secureResolve(item, current.id, allowAnonymousItems)
|
||||||
: await this.resolve(getApId(item), allowAnonymousItems);
|
: await this.resolve(getApId(item), allowAnonymousItems);
|
||||||
destination.push(resolved);
|
destination.push(resolved);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue