From 174b41b46aaf69c4f0bc227fdeb53077646b1981 Mon Sep 17 00:00:00 2001 From: kamecha Date: Mon, 29 Jul 2024 11:28:44 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20User=E6=83=B3=E5=AE=9A=E3=81=AA?= =?UTF-8?q?=E3=81=AE=E3=81=ABUserDetail=E3=81=8C=E5=85=A5=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- denops/traqvim/model.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/denops/traqvim/model.ts b/denops/traqvim/model.ts index b46fc53..c21eda6 100644 --- a/denops/traqvim/model.ts +++ b/denops/traqvim/model.ts @@ -139,7 +139,17 @@ export const homeChannelId = async (): Promise => { // userIdからユーザー情報を取得する export const getUser = async (userId: string): Promise => { const userRes = await api.api.getUser(userId); - const user = userRes.data; + const userDetail: traq.UserDetail = userRes.data; + // TODO: もっと良い変換方法ありそうなんで、見つけたらやっとく + const user: traq.User = { + id: userDetail.id, + name: userDetail.name, + displayName: userDetail.displayName, + iconFileId: userDetail.iconFileId, + bot: userDetail.bot, + state: userDetail.state, + updatedAt: userDetail.updatedAt, + }; return user; }; From 7b815470078df57bf3399d7fca4c28f23e32575a Mon Sep 17 00:00:00 2001 From: kamecha Date: Mon, 29 Jul 2024 11:31:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20vim=E3=82=92=E7=B5=8C=E7=94=B1?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=81=A8undefined=E2=86=920=E3=81=AB?= =?UTF-8?q?=E3=81=AA=E3=82=8B=E3=81=9F=E3=82=81=E3=80=81undefined=E3=81=A0?= =?UTF-8?q?=E3=81=A8=E3=81=9D=E3=82=82=E3=81=9D=E3=82=82=E5=85=A5=E3=82=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- denops/traqvim/model.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/denops/traqvim/model.ts b/denops/traqvim/model.ts index c21eda6..9f5b5da 100644 --- a/denops/traqvim/model.ts +++ b/denops/traqvim/model.ts @@ -182,6 +182,11 @@ export const channelTimeline = async ( )?.map((url: string) => { return url.split("/").slice(-1)[0]; }); + const ret: Message = { + ...message, + user: user, + createdAt: new Date(message.createdAt).toLocaleString("ja-JP"), + }; // quotedMessageUUIDsが存在しなかった場合はundefinedを返す let quotedMessages: Message[] | undefined = undefined; if (quotedMessageUUIDs) { @@ -202,12 +207,10 @@ export const channelTimeline = async ( }), ); } - return { - ...message, - user: user, - createdAt: new Date(message.createdAt).toLocaleString("ja-JP"), - quote: quotedMessages, - }; + if (quotedMessages !== undefined) { + ret.quote = quotedMessages; + } + return ret; }), ); return messagesConverted;