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
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:
parent
e28a9eb8e8
commit
bd27b7ca3a
2 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue