From 7ae9d4163f59fcbba71b7822dc88d04831cddaa7 Mon Sep 17 00:00:00 2001 From: ThinaticSystem Date: Fri, 20 May 2022 23:38:04 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E3=81=A8=E3=82=8A=E3=81=82=E3=81=88?= =?UTF-8?q?=E3=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/components/notification.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue index 1a360f990..556df8863 100644 --- a/packages/client/src/components/notification.vue +++ b/packages/client/src/components/notification.vue @@ -60,6 +60,7 @@ + {{ $ts.youGotNewFollower }}
{{ $ts.followRequestAccepted }} {{ $ts.receiveFollowRequest }}
|
@@ -165,8 +166,19 @@ export default defineComponent({ }, {}, 'closed'); }); + function openRenoteDestination(remoteUser: User): void { + os.api('users/show', {userId: remoteUser.id}).then(user => { + if (user.host != null && user.followersCount === 0) { // リモートユーザーかつローカルの人間が誰もフォローしていない(最新の投稿が取得できない)ユーザー + window.open(user.url, '_blank', 'rel="nofollow noopener"'); + } else { + os.pageWindow('/@' + user.username + (user.host ? `@${user.host}` : '')); + } + }); + } + return { getNoteSummary: (note: misskey.entities.Note) => getNoteSummary(note), + openRenoteDestination: (remoteUser: misskey.entities.User) => openRenoteDestination(remoteUser), followRequestDone, groupInviteDone, notePage, From d3e4d7614842a3964d0ac301a2a69b8c8318298e Mon Sep 17 00:00:00 2001 From: ThinaticSystem Date: Sat, 21 May 2022 06:27:37 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9C=80=E6=96=B0=E3=81=AE=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E3=81=8C=E5=8F=96=E5=BE=97=E6=B8=88=E3=81=AE=E3=83=A6?= =?UTF-8?q?=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AF?= =?UTF-8?q?=E3=83=AA=E3=83=8E=E3=83=BC=E3=83=88=E8=A9=B3=E7=B4=B0=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/components/notification.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue index 556df8863..dd5382671 100644 --- a/packages/client/src/components/notification.vue +++ b/packages/client/src/components/notification.vue @@ -60,7 +60,7 @@ - + {{ $ts.youGotNewFollower }}
{{ $ts.followRequestAccepted }} {{ $ts.receiveFollowRequest }}
|
@@ -166,19 +166,23 @@ export default defineComponent({ }, {}, 'closed'); }); - function openRenoteDestination(remoteUser: User): void { - os.api('users/show', {userId: remoteUser.id}).then(user => { + function openRenoteDestination(renoteNotification: misskey.entities.Notification): void { + if (renoteNotification.type !== 'renote') { + throw new Error("openRenoteDestination()の引数には type: 'renote' のNotificationが渡される必要があります"); + } + + os.api('users/show', {userId: renoteNotification.user.id}).then(user => { if (user.host != null && user.followersCount === 0) { // リモートユーザーかつローカルの人間が誰もフォローしていない(最新の投稿が取得できない)ユーザー window.open(user.url, '_blank', 'rel="nofollow noopener"'); } else { - os.pageWindow('/@' + user.username + (user.host ? `@${user.host}` : '')); + os.pageWindow(notePage(renoteNotification.note)); } }); } return { getNoteSummary: (note: misskey.entities.Note) => getNoteSummary(note), - openRenoteDestination: (remoteUser: misskey.entities.User) => openRenoteDestination(remoteUser), + openRenoteDestination: (renoteNotification: misskey.entities.Notification) => openRenoteDestination(renoteNotification), followRequestDone, groupInviteDone, notePage, From 283f0b6d62c457e26f9120a51cd7c3a8519ed409 Mon Sep 17 00:00:00 2001 From: ThinaticSystem Date: Sat, 21 May 2022 06:38:15 +0900 Subject: [PATCH 3/4] refactor --- packages/client/src/components/notification.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue index dd5382671..bf37442b8 100644 --- a/packages/client/src/components/notification.vue +++ b/packages/client/src/components/notification.vue @@ -171,7 +171,7 @@ export default defineComponent({ throw new Error("openRenoteDestination()の引数には type: 'renote' のNotificationが渡される必要があります"); } - os.api('users/show', {userId: renoteNotification.user.id}).then(user => { + os.api('users/show', {userId: renoteNotification.user.id}).then((user: misskey.entities.UserDetailed) => { if (user.host != null && user.followersCount === 0) { // リモートユーザーかつローカルの人間が誰もフォローしていない(最新の投稿が取得できない)ユーザー window.open(user.url, '_blank', 'rel="nofollow noopener"'); } else { From 9a9e77a44ba56bd86280261f429c6803aa98d9bf Mon Sep 17 00:00:00 2001 From: ThinaticSystem Date: Sat, 21 May 2022 06:46:25 +0900 Subject: [PATCH 4/4] =?UTF-8?q?user.url:=20null=E5=AF=BE=E7=AD=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/components/notification.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/client/src/components/notification.vue b/packages/client/src/components/notification.vue index bf37442b8..38db93da6 100644 --- a/packages/client/src/components/notification.vue +++ b/packages/client/src/components/notification.vue @@ -173,6 +173,7 @@ export default defineComponent({ os.api('users/show', {userId: renoteNotification.user.id}).then((user: misskey.entities.UserDetailed) => { if (user.host != null && user.followersCount === 0) { // リモートユーザーかつローカルの人間が誰もフォローしていない(最新の投稿が取得できない)ユーザー + if (user.url === null) { throw new Error('User page URL is Null') }; window.open(user.url, '_blank', 'rel="nofollow noopener"'); } else { os.pageWindow(notePage(renoteNotification.note));