[backend/federation] Iterate over paginated collections
This commit is contained in:
parent
024de937d0
commit
5300aa069b
2 changed files with 15 additions and 1 deletions
|
@ -90,5 +90,19 @@ public class ObjectResolver(
|
|||
if (collection.Items != null)
|
||||
foreach (var item in collection.Items)
|
||||
yield return item;
|
||||
|
||||
var page = collection.First;
|
||||
while (page != null)
|
||||
{
|
||||
if (page.IsUnresolved)
|
||||
page = await ResolveObject(page, force: true) as ASCollectionPage;
|
||||
if (page == null) break;
|
||||
|
||||
if (page.Items != null)
|
||||
foreach (var item in page.Items)
|
||||
yield return item;
|
||||
|
||||
page = page.Next;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ public class ASObject : ASObjectBase
|
|||
[JC(typeof(StringListSingleConverter))]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JI] public bool IsUnresolved => GetType() == typeof(ASObject) && Type == null;
|
||||
[JI] public bool IsUnresolved => this is ASObject && Type == null;
|
||||
|
||||
//FIXME: don't recurse creates and co
|
||||
public static ASObject? Deserialize(JToken token)
|
||||
|
|
Loading…
Add table
Reference in a new issue