From 22d6c7fe8af3b0fa7854f41e1a1221cdad5ecaa9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 9 May 2023 15:28:44 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=2013.11=E3=82=92=E7=B5=8C?= =?UTF-8?q?=E9=A8=93=E3=81=97=E3=81=AA=E3=81=84=E7=8A=B6=E6=85=8B=E3=81=A7?= =?UTF-8?q?13.12=E3=81=AB=E3=82=A2=E3=83=83=E3=83=97=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=83=88=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E9=96=A2=E9=80=A3=E3=81=AE=E7=94=BB=E5=83=8F=E3=81=8C?= =?UTF-8?q?=E6=B6=88=E5=A4=B1=E3=81=99=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #10811 --- CHANGELOG.md | 1 + .../src/core/entities/UserEntityService.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd26ddc84..47a9d48ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Server - Fix: リモートサーバーの情報が更新できない問題を修正 +- Fix: 13.11を経験しない状態で13.12にアップデートした場合ユーザープロフィール関連の画像が消失する問題を修正 ## 13.12.0 diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index a7f62c05f..453c1473d 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -306,6 +306,24 @@ export class UserEntityService implements OnModuleInit { const user = typeof src === 'object' ? src : await this.usersRepository.findOneByOrFail({ id: src }); + // migration + if (user.avatarId != null && user.avatarUrl === null) { + const avatar = await this.driveFilesRepository.findOneByOrFail({ id: user.avatarId }); + user.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar'); + this.usersRepository.update(user.id, { + avatarUrl: user.avatarUrl, + avatarBlurhash: avatar.blurhash, + }); + } + if (user.bannerId != null && user.bannerUrl === null) { + const banner = await this.driveFilesRepository.findOneByOrFail({ id: user.bannerId }); + user.bannerUrl = this.driveFileEntityService.getPublicUrl(banner); + this.usersRepository.update(user.id, { + bannerUrl: user.bannerUrl, + bannerBlurhash: banner.blurhash, + }); + } + const meId = me ? me.id : null; const isMe = meId === user.id; const iAmModerator = me ? await this.roleService.isModerator(me as User) : false;