server: add typing for renderFollowRelay
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
Norm 2022-12-13 16:06:18 -05:00
parent e28a9eb8e8
commit bd27b7ca3a
Signed by: norm
GPG key ID: 7123E30E441E80DE
2 changed files with 10 additions and 3 deletions

View file

@ -2,13 +2,20 @@ import config from '@/config/index.js';
import { Relay } from '@/models/entities/relay.js';
import { ILocalUser } from '@/models/entities/user.js';
export function renderFollowRelay(relay: Relay, relayActor: ILocalUser) {
export type FollowRelay = {
id: string;
type: 'Follow';
actor: string;
object: 'https://www.w3.org/ns/activitystreams#Public';
};
export function renderFollowRelay(relay: Relay, relayActor: ILocalUser): FollowRelay {
const follow = {
id: `${config.url}/activities/follow-relay/${relay.id}`,
type: 'Follow',
actor: `${config.url}/users/${relayActor.id}`,
object: 'https://www.w3.org/ns/activitystreams#Public',
};
} as const;
return follow;
}

View file

@ -44,7 +44,7 @@ export async function addRelay(inbox: string): Promise<Relay> {
}).then(x => Relays.findOneByOrFail(x.identifiers[0]));
const relayActor = await getRelayActor();
const follow = await renderFollowRelay(relay, relayActor);
const follow = renderFollowRelay(relay, relayActor);
const activity = renderActivity(follow);
deliver(relayActor, activity, relay.inbox);