mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-24 03:33:07 +02:00
[Server] Fix bug
This commit is contained in:
parent
977a4373c5
commit
4000da6be8
1 changed files with 37 additions and 29 deletions
|
@ -336,19 +336,11 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
|
||||||
console.log(`cat not extract fields: ${e}`);
|
console.log(`cat not extract fields: ${e}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update user
|
const updates = {
|
||||||
await User.update({ _id: exist._id }, {
|
|
||||||
$set: {
|
|
||||||
lastFetchedAt: new Date(),
|
lastFetchedAt: new Date(),
|
||||||
inbox: person.inbox,
|
inbox: person.inbox,
|
||||||
sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
||||||
featured: person.featured,
|
featured: person.featured,
|
||||||
avatarId: avatar ? avatar._id : null,
|
|
||||||
bannerId: banner ? banner._id : null,
|
|
||||||
avatarUrl: getDriveFileUrl(avatar, true),
|
|
||||||
bannerUrl: getDriveFileUrl(banner, false),
|
|
||||||
avatarColor: avatar && avatar.metadata.properties.avgColor ? avatar.metadata.properties.avgColor : null,
|
|
||||||
bannerColor: banner && banner.metadata.properties.avgColor ? banner.metadata.properties.avgColor : null,
|
|
||||||
emojis: emojiNames,
|
emojis: emojiNames,
|
||||||
description: htmlToMFM(person.summary),
|
description: htmlToMFM(person.summary),
|
||||||
followersCount,
|
followersCount,
|
||||||
|
@ -366,7 +358,23 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
|
||||||
id: person.publicKey.id,
|
id: person.publicKey.id,
|
||||||
publicKeyPem: person.publicKey.publicKeyPem
|
publicKeyPem: person.publicKey.publicKeyPem
|
||||||
},
|
},
|
||||||
|
} as any;
|
||||||
|
|
||||||
|
if (avatar) {
|
||||||
|
updates.avatarId = avatar._id;
|
||||||
|
updates.avatarUrl = getDriveFileUrl(avatar, true);
|
||||||
|
updates.avatarColor = avatar.metadata.properties.avgColor ? avatar.metadata.properties.avgColor : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (banner) {
|
||||||
|
updates.bannerId = banner._id;
|
||||||
|
updates.bannerUrl = getDriveFileUrl(banner, true);
|
||||||
|
updates.bannerColor = banner.metadata.properties.avgColor ? banner.metadata.properties.avgColor : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update user
|
||||||
|
await User.update({ _id: exist._id }, {
|
||||||
|
$set: updates
|
||||||
});
|
});
|
||||||
|
|
||||||
// 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
|
// 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
|
||||||
|
|
Loading…
Reference in a new issue