Refactor and use original image for banner
This commit is contained in:
parent
1bb266e7c7
commit
5d61c7c691
|
@ -210,8 +210,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<IU
|
||||||
|
|
||||||
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.thumbnailUrl) ? avatar.metadata.thumbnailUrl : (avatar && avatar.metadata.url) ? avatar.metadata.url : null;
|
const avatarUrl = getDriveFileUrl(avatar, true);
|
||||||
const bannerUrl = (banner && banner.metadata.url) ? banner.metadata.url : null;
|
const bannerUrl = getDriveFileUrl(banner, false);
|
||||||
|
|
||||||
await User.update({ _id: user._id }, {
|
await User.update({ _id: user._id }, {
|
||||||
$set: {
|
$set: {
|
||||||
|
@ -305,7 +305,7 @@ export async function updatePerson(uri: string, resolver?: Resolver, hint?: obje
|
||||||
avatarId: avatar ? avatar._id : null,
|
avatarId: avatar ? avatar._id : null,
|
||||||
bannerId: banner ? banner._id : null,
|
bannerId: banner ? banner._id : null,
|
||||||
avatarUrl: getDriveFileUrl(avatar, true),
|
avatarUrl: getDriveFileUrl(avatar, true),
|
||||||
bannerUrl: getDriveFileUrl(banner, true),
|
bannerUrl: getDriveFileUrl(banner, false),
|
||||||
description: htmlToMFM(person.summary),
|
description: htmlToMFM(person.summary),
|
||||||
followersCount,
|
followersCount,
|
||||||
followingCount,
|
followingCount,
|
||||||
|
|
|
@ -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 == null) return rej('banner not found');
|
||||||
if (!banner.contentType.startsWith('image/')) return rej('banner not an image');
|
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) {
|
if (banner.metadata.properties.avgColor) {
|
||||||
updates.bannerColor = banner.metadata.properties.avgColor;
|
updates.bannerColor = banner.metadata.properties.avgColor;
|
||||||
|
|
Loading…
Reference in New Issue