1
0
forked from mirror/misskey

ユーザーのアイコンにサムネイルを使うように

Closes #2365
This commit is contained in:
syuilo 2018-08-25 19:44:47 +09:00
parent f0b08d3936
commit 0875460974
2 changed files with 4 additions and 4 deletions

View File

@ -166,8 +166,8 @@ export async function createPerson(value: any, resolver?: Resolver): Promise<IUs
const avatarId = avatar ? avatar._id : null; const avatarId = avatar ? avatar._id : null;
const bannerId = banner ? banner._id : null; const bannerId = banner ? banner._id : null;
const avatarUrl = avatar && avatar.metadata.url ? avatar.metadata.url : null; const avatarUrl = (avatar && avatar.metadata.thumbnailUrl) ? avatar.metadata.thumbnailUrl : (avatar && avatar.metadata.url) ? avatar.metadata.url : null;
const bannerUrl = banner && banner.metadata.url ? banner.metadata.url : null; const bannerUrl = (banner && banner.metadata.url) ? banner.metadata.url : null;
await User.update({ _id: user._id }, { await User.update({ _id: user._id }, {
$set: { $set: {
@ -255,7 +255,7 @@ export async function updatePerson(value: string | IObject, resolver?: Resolver)
sharedInbox: person.sharedInbox, sharedInbox: person.sharedInbox,
avatarId: avatar ? avatar._id : null, avatarId: avatar ? avatar._id : null,
bannerId: banner ? banner._id : null, bannerId: banner ? banner._id : null,
avatarUrl: avatar && avatar.metadata.url ? avatar.metadata.url : null, avatarUrl: (avatar && avatar.metadata.thumbnailUrl) ? avatar.metadata.thumbnailUrl : (avatar && avatar.metadata.url) ? avatar.metadata.url : null,
bannerUrl: banner && banner.metadata.url ? banner.metadata.url : null, bannerUrl: banner && banner.metadata.url ? banner.metadata.url : null,
description: htmlToMFM(person.summary), description: htmlToMFM(person.summary),
followersCount, followersCount,

View File

@ -84,7 +84,7 @@ export default async (params: any, user: ILocalUser, app: IApp) => new Promise(a
if (avatar == null) return rej('avatar not found'); if (avatar == null) return rej('avatar not found');
updates.avatarUrl = avatar.metadata.url || `${config.drive_url}/${avatar._id}`; updates.avatarUrl = avatar.metadata.thumbnailUrl || avatar.metadata.url || `${config.drive_url}/${avatar._id}`;
if (avatar.metadata.properties.avgColor) { if (avatar.metadata.properties.avgColor) {
updates.avatarColor = avatar.metadata.properties.avgColor; updates.avatarColor = avatar.metadata.properties.avgColor;