Fix bug
This commit is contained in:
parent
16d4b16872
commit
bee77afb7f
|
@ -405,13 +405,17 @@ export const pack = (
|
||||||
delete _user.publicKey;
|
delete _user.publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_user.avatarUrl == null) {
|
||||||
_user.avatarUrl = _user.avatarId != null
|
_user.avatarUrl = _user.avatarId != null
|
||||||
? `${config.drive_url}/${_user.avatarId}`
|
? `${config.drive_url}/${_user.avatarId}`
|
||||||
: `${config.drive_url}/default-avatar.jpg`;
|
: `${config.drive_url}/default-avatar.jpg`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_user.bannerUrl == null) {
|
||||||
_user.bannerUrl = _user.bannerId != null
|
_user.bannerUrl = _user.bannerId != null
|
||||||
? `${config.drive_url}/${_user.bannerId}`
|
? `${config.drive_url}/${_user.bannerId}`
|
||||||
: null;
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
_user.wallpaperUrl = _user.wallpaperId != null
|
_user.wallpaperUrl = _user.wallpaperId != null
|
||||||
? `${config.drive_url}/${_user.wallpaperId}`
|
? `${config.drive_url}/${_user.wallpaperId}`
|
||||||
|
|
|
@ -9,6 +9,7 @@ import webFinger from '../../webfinger';
|
||||||
import Resolver from '../resolver';
|
import Resolver from '../resolver';
|
||||||
import { resolveImage } from './image';
|
import { resolveImage } from './image';
|
||||||
import { isCollectionOrOrderedCollection, IObject, IPerson } from '../type';
|
import { isCollectionOrOrderedCollection, IObject, IPerson } from '../type';
|
||||||
|
import { IDriveFile } from '../../../models/drive-file';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub');
|
const log = debug('misskey:activitypub');
|
||||||
|
|
||||||
|
@ -190,21 +191,23 @@ export async function updatePerson(value: string | IObject, resolver?: Resolver)
|
||||||
const summaryDOM = JSDOM.fragment(person.summary);
|
const summaryDOM = JSDOM.fragment(person.summary);
|
||||||
|
|
||||||
// アイコンとヘッダー画像をフェッチ
|
// アイコンとヘッダー画像をフェッチ
|
||||||
const [avatarId, bannerId] = (await Promise.all([
|
const [avatar, banner] = (await Promise.all<IDriveFile>([
|
||||||
person.icon,
|
person.icon,
|
||||||
person.image
|
person.image
|
||||||
].map(img =>
|
].map(img =>
|
||||||
img == null
|
img == null
|
||||||
? Promise.resolve(null)
|
? Promise.resolve(null)
|
||||||
: resolveImage(exist, img)
|
: resolveImage(exist, img)
|
||||||
))).map(file => file != null ? file._id : null);
|
)));
|
||||||
|
|
||||||
// Update user
|
// Update user
|
||||||
await User.update({ _id: exist._id }, {
|
await User.update({ _id: exist._id }, {
|
||||||
$set: {
|
$set: {
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
avatarId,
|
avatarId: avatar ? avatar._id : null,
|
||||||
bannerId,
|
bannerId: banner ? banner._id : null,
|
||||||
|
avatarUrl: avatar && avatar.metadata.isMetaOnly ? avatar.metadata.url : null,
|
||||||
|
bannerUrl: banner && banner.metadata.isMetaOnly ? banner.metadata.url : null,
|
||||||
description: summaryDOM.textContent,
|
description: summaryDOM.textContent,
|
||||||
followersCount,
|
followersCount,
|
||||||
followingCount,
|
followingCount,
|
||||||
|
|
Loading…
Reference in New Issue