Skip to content

Commit

Permalink
fix(backend): アバターとバナーがリセットできない (#10643)
Browse files Browse the repository at this point in the history
* fix(backend): avatar and banner couldn't be reset

* Update CHANGELOG.md
  • Loading branch information
Nanashia authored Apr 16, 2023
1 parent d2aba9b commit 0ddc79b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
### Server
- Fix: エクスポートデータの拡張子がunknownになる問題を修正
- Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正
- Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正

## 13.11.3

Expand Down
8 changes: 8 additions & 0 deletions packages/backend/src/server/api/endpoints/i/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
updates.avatarId = avatar.id;
updates.avatarUrl = this.driveFileEntityService.getPublicUrl(avatar, 'avatar');
updates.avatarBlurhash = avatar.blurhash;
} else if (ps.avatarId === null) {
updates.avatarId = null;
updates.avatarUrl = null;
updates.avatarBlurhash = null;
}

if (ps.bannerId) {
Expand All @@ -232,6 +236,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
updates.bannerId = banner.id;
updates.bannerUrl = this.driveFileEntityService.getPublicUrl(banner);
updates.bannerBlurhash = banner.blurhash;
} else if (ps.bannerId === null) {
updates.bannerId = null;
updates.bannerUrl = null;
updates.bannerBlurhash = null;
}

if (ps.pinnedPageId) {
Expand Down
2 changes: 0 additions & 2 deletions packages/backend/test/e2e/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ describe('ユーザー', () => {
};
assert.deepStrictEqual(response, expected, inspect(parameters));

if (1) return; // BUG 521eb95 以降アバターのリセットができない。
const parameters2 = { avatarId: null };
const response2 = await successfulApiCall({ endpoint: 'i/update', parameters: parameters2, user: alice });
const expected2 = {
Expand All @@ -534,7 +533,6 @@ describe('ユーザー', () => {
};
assert.deepStrictEqual(response, expected, inspect(parameters));

if (1) return; // BUG 521eb95 以降バナーのリセットができない。
const parameters2 = { bannerId: null };
const response2 = await successfulApiCall({ endpoint: 'i/update', parameters: parameters2, user: alice });
const expected2 = {
Expand Down

0 comments on commit 0ddc79b

Please sign in to comment.