From bbe197fe8bd009a903effcf5d72e8802c7fb7d97 Mon Sep 17 00:00:00 2001 From: lqvp <183242690+lqvp@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:51:27 +0900 Subject: [PATCH] =?UTF-8?q?fix+enhance:=20=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=81=8C=E3=81=84=E3=81=AA=E3=81=84=E3=81=A8=E3=82=AF?= =?UTF-8?q?=E3=82=A8=E3=83=AA=E3=81=8C=E3=82=B3=E3=82=B1=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3+=E3=83=95=E3=83=AD=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=A7=E8=A7=A6=E3=82=8C=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/api/endpoints/following/history.ts | 10 +- .../endpoints/following/requests/history.ts | 10 +- .../frontend/src/pages/follow-history.vue | 187 +++++++++++------- .../src/pages/follow-requests-history.vue | 159 +++++++++------ 4 files changed, 226 insertions(+), 140 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/following/history.ts b/packages/backend/src/server/api/endpoints/following/history.ts index 14cdfd410690..c9698d7237cf 100644 --- a/packages/backend/src/server/api/endpoints/following/history.ts +++ b/packages/backend/src/server/api/endpoints/following/history.ts @@ -37,12 +37,10 @@ export const meta = { fromUser: { type: 'object', optional: false, nullable: false, - ref: 'UserDetailedNotMe', }, toUser: { type: 'object', optional: false, nullable: false, - ref: 'UserDetailedNotMe', }, timestamp: { type: 'string', @@ -199,8 +197,12 @@ export default class extends Endpoint { return await Promise.all(histories.map(async history => ({ id: history.id, type: history.type, - fromUser: await this.userEntityService.pack(history.fromUser ?? history.fromUserId, me, { schema: 'UserDetailed' }), - toUser: await this.userEntityService.pack(history.toUser ?? history.toUserId, me, { schema: 'UserDetailed' }), + fromUser: history.fromUser + ? await this.userEntityService.pack(history.fromUser ?? history.fromUserId, me) + : { name: 'unknown user' }, + toUser: history.toUser + ? await this.userEntityService.pack(history.toUser ?? history.toUserId, me) + : { name: 'unknown user' }, timestamp: history.timestamp.toISOString(), }))); }); diff --git a/packages/backend/src/server/api/endpoints/following/requests/history.ts b/packages/backend/src/server/api/endpoints/following/requests/history.ts index efb3816890a8..f2a33e86c3c4 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/history.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/history.ts @@ -37,12 +37,10 @@ export const meta = { fromUser: { type: 'object', optional: false, nullable: false, - ref: 'UserDetailedNotMe', }, toUser: { type: 'object', optional: false, nullable: false, - ref: 'UserDetailedNotMe', }, timestamp: { type: 'string', @@ -200,8 +198,12 @@ export default class extends Endpoint { return await Promise.all(histories.map(async history => ({ id: history.id, type: history.type, - fromUser: await this.userEntityService.pack(history.fromUser ?? history.fromUserId, me, { schema: 'UserDetailed' }), - toUser: await this.userEntityService.pack(history.toUser ?? history.toUserId, me, { schema: 'UserDetailed' }), + fromUser: history.fromUser + ? await this.userEntityService.pack(history.fromUser ?? history.fromUserId, me) + : { name: 'unknown user' }, + toUser: history.toUser + ? await this.userEntityService.pack(history.toUser ?? history.toUserId, me) + : { name: 'unknown user' }, timestamp: history.timestamp.toISOString(), }))); }); diff --git a/packages/frontend/src/pages/follow-history.vue b/packages/frontend/src/pages/follow-history.vue index 5025b937c913..f5b1d841f702 100644 --- a/packages/frontend/src/pages/follow-history.vue +++ b/packages/frontend/src/pages/follow-history.vue @@ -19,17 +19,41 @@ SPDX-License-Identifier: AGPL-3.0-only