2022-02-27 03:07:39 +01:00
|
|
|
import { IObject } from './type.js';
|
2022-03-25 08:27:41 +01:00
|
|
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
2022-02-27 03:07:39 +01:00
|
|
|
import { performActivity } from './kernel/index.js';
|
2022-03-25 08:27:41 +01:00
|
|
|
import { updatePerson } from './models/person.js';
|
2018-04-08 22:02:52 +02:00
|
|
|
|
2022-03-25 08:27:41 +01:00
|
|
|
export default async (actor: CacheableRemoteUser, activity: IObject): Promise<void> => {
|
2019-09-26 21:58:28 +02:00
|
|
|
await performActivity(actor, activity);
|
2022-03-25 08:27:41 +01:00
|
|
|
|
|
|
|
// ついでにリモートユーザーの情報が古かったら更新しておく
|
|
|
|
if (actor.uri) {
|
|
|
|
if (actor.lastFetchedAt == null || Date.now() - actor.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
|
|
|
|
setImmediate(() => {
|
|
|
|
updatePerson(actor.uri!);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-04-08 22:02:52 +02:00
|
|
|
};
|