Johann150
1516ddfc9b
Some checks failed
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline failed
ci/woodpecker/push/lint-backend Pipeline failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline failed
ci/woodpecker/push/test Pipeline failed
The CacheableUser, CacheableLocalUser and CacheableRemoteUser are identical types to User, ILocalUser and IRemoteUser so it seems nonsensical to have different types for them.
19 lines
725 B
TypeScript
19 lines
725 B
TypeScript
import { DAY } from '@/const.js';
|
|
import { IRemoteUser } from '@/models/entities/user.js';
|
|
import { Resolver } from '@/remote/activitypub/resolver.js';
|
|
import { IObject } from './type.js';
|
|
import { performActivity } from './kernel/index.js';
|
|
import { updatePerson } from './models/person.js';
|
|
|
|
export async function perform(actor: IRemoteUser, activity: IObject, resolver: Resolver): Promise<void> {
|
|
await performActivity(actor, activity, resolver);
|
|
|
|
// And while I'm at it, I'll update the remote user information if it's out of date.
|
|
if (actor.uri) {
|
|
if (actor.lastFetchedAt == null || Date.now() - actor.lastFetchedAt.getTime() > DAY) {
|
|
setImmediate(() => {
|
|
updatePerson(actor.uri!, resolver);
|
|
});
|
|
}
|
|
}
|
|
}
|