Improve user operations

Resolve #2197
Resolve #3367
This commit is contained in:
syuilo
2018-11-23 08:01:14 +09:00
parent 13a75abc91
commit 246cead2b1
19 changed files with 404 additions and 63 deletions

View File

@@ -104,7 +104,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
});
// ユーザーの情報が古かったらついでに更新しておく
if (actor.updatedAt == null || Date.now() - actor.updatedAt.getTime() > 1000 * 60 * 60 * 24) {
if (actor.lastFetchedAt == null || Date.now() - actor.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
updatePerson(note.attributedTo);
}

View File

@@ -143,7 +143,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
avatarId: null,
bannerId: null,
createdAt: Date.parse(person.published) || null,
updatedAt: new Date(),
lastFetchedAt: new Date(),
description: htmlToMFM(person.summary),
followersCount,
followingCount,
@@ -298,7 +298,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
// Update user
await User.update({ _id: exist._id }, {
$set: {
updatedAt: new Date(),
lastFetchedAt: new Date(),
inbox: person.inbox,
sharedInbox: person.sharedInbox,
featured: person.featured,