i love commit messages

This commit is contained in:
Madeline
2023-08-14 21:18:47 +10:00
parent 4b144365cd
commit 093c23feae
2 changed files with 12 additions and 3 deletions
+11 -3
View File
@@ -1,16 +1,24 @@
import { APObject, APOrderedCollection } from "activitypub-types";
import {
APObject,
APOrderedCollection,
OrderedCollectionItemsField,
} from "activitypub-types";
import { Request } from "express";
interface ActivityPubable {
toAP(): APObject;
}
interface CorrectOrderedCollection extends APOrderedCollection {
orderedItems?: OrderedCollectionItemsField[];
}
export const makeOrderedCollection = async <T extends ActivityPubable>(
req: Request,
id: string,
getTotalElements: () => Promise<number>,
getElements: (before?: string, after?: string) => Promise<T[]>,
): Promise<APOrderedCollection> => {
): Promise<CorrectOrderedCollection> => {
const { page, min_id, max_id } = req.query;
if (!page)
@@ -37,6 +45,6 @@ export const makeOrderedCollection = async <T extends ActivityPubable>(
first: `${id}?page=true`,
last: `${id}?page=true&min_id=0`,
totalItems: await getTotalElements(),
items: items,
orderedItems: items,
};
};
+1
View File
@@ -309,6 +309,7 @@ export class User extends BaseClass {
}/${this.avatar}`,
]
: undefined,
discoverable: true,
inbox: `https://${webDomain}/fed/user/${this.id}/inbox`,
outbox: `https://${webDomain}/fed/user/${this.id}/outbox`,