mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-25 22:54:51 +00:00
i love commit messages
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user