Refactor and use original image for banner

This commit is contained in:
syuilo 2018-11-01 09:30:51 +09:00
parent cb53914ad0
commit 1c8c707037
2 changed files with 4 additions and 4 deletions

View file

@ -210,8 +210,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
const avatarId = avatar ? avatar._id : null;
const bannerId = banner ? banner._id : 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 avatarUrl = getDriveFileUrl(avatar, true);
const bannerUrl = getDriveFileUrl(banner, false);
await User.update({ _id: user._id }, {
$set: {
@ -305,7 +305,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
avatarId: avatar ? avatar._id : null,
bannerId: banner ? banner._id : null,
avatarUrl: getDriveFileUrl(avatar, true),
bannerUrl: getDriveFileUrl(banner, true),
bannerUrl: getDriveFileUrl(banner, false),
description: htmlToMFM(person.summary),
followersCount,
followingCount,

View file

@ -144,7 +144,7 @@ export default async (params: any, user: ILocalUser, app: IApp) => new Promise(a
if (banner == null) return rej('banner not found');
if (!banner.contentType.startsWith('image/')) return rej('banner not an image');
updates.bannerUrl = getDriveFileUrl(banner, true);
updates.bannerUrl = getDriveFileUrl(banner, false);
if (banner.metadata.properties.avgColor) {
updates.bannerColor = banner.metadata.properties.avgColor;