From a292e46f84c4b01a942e447960cc587c849bae9d Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Mon, 7 Oct 2024 11:56:18 +0200 Subject: [PATCH 1/5] Pack other side of relation into response as well --- .../backend/src/server/api/endpoints/federation/followers.ts | 2 +- .../backend/src/server/api/endpoints/federation/following.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index ce4dd13067..f114363eec 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -54,7 +54,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: true }); }); } } diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 1a793889c7..9f574f124e 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -54,7 +54,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: true }); }); } } From 80cbf00eac3b215e856032b7d7fdf7b0508c1a30 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Mon, 7 Oct 2024 12:30:49 +0200 Subject: [PATCH 2/5] Add following and follower relationship view --- packages/frontend/src/pages/instance-info.vue | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 4ff26197d8..93debf4aba 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -123,6 +123,36 @@ SPDX-License-Identifier: AGPL-3.0-only +
+ + + +
+
+ + + +
@@ -185,6 +215,24 @@ const usersPagination = { offsetMode: true, }; +const followingPagination = { + endpoint: 'federation/following' as const, + limit: 10, + params: { + host: props.host, + }, + offsetMode: false, +}; + +const followersPagination = { + endpoint: 'federation/followers' as const, + limit: 10, + params: { + host: props.host, + }, + offsetMode: false, +}; + watch(moderationNote, async () => { await misskeyApi('admin/federation/update-instance', { host: instance.value.host, moderationNote: moderationNote.value }); }); @@ -292,6 +340,14 @@ const headerTabs = computed(() => [{ key: 'users', title: i18n.ts.users, icon: 'ti ti-users', +}, { + key: 'following', + title: i18n.ts.following, + icon: 'ti ti-arrow-right', +}, { + key: 'followers', + title: i18n.ts.followers, + icon: 'ti ti-arrow-left', }, { key: 'raw', title: 'Raw', @@ -334,4 +390,31 @@ definePageMetadata(() => ({ } } } + +.follow-relations-list { + display: flex; + flex-direction: column; + gap: 12px; + + .follow-relation { + display: flex; + align-items: center; + gap: 12px; + flex-wrap: nowrap; + justify-content: space-between; + + .user { + flex: 1; + max-width: 45%; + flex-shrink: 0; + overflow: hidden; + text-overflow: ellipsis; + } + + .arrow { + font-size: 1.5em; + flex-shrink: 0; + } + } +} From bfd812720eaaa7923c3c18adde14bcab888ffe33 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Mon, 7 Oct 2024 12:46:28 +0200 Subject: [PATCH 3/5] Move styling to MkA elements --- packages/frontend/src/pages/instance-info.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 93debf4aba..b8d9434498 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -127,12 +127,12 @@ SPDX-License-Identifier: AGPL-3.0-only @@ -142,12 +142,12 @@ SPDX-License-Identifier: AGPL-3.0-only From 1c3495ef59a9bd1cfa61c27fc15873a4d8ecf99f Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Mon, 7 Oct 2024 16:23:24 +0200 Subject: [PATCH 4/5] Make including followers in response a parameter --- .../backend/src/server/api/endpoints/federation/followers.ts | 3 ++- .../backend/src/server/api/endpoints/federation/following.ts | 3 ++- packages/frontend/src/pages/instance-info.vue | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index f114363eec..c7630bed93 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -33,6 +33,7 @@ export const paramDef = { sinceId: { type: 'string', format: 'misskey:id' }, untilId: { type: 'string', format: 'misskey:id' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + includeFollower: { type: 'boolean', default: false }, }, required: ['host'], } as const; @@ -54,7 +55,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: true }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: ps.includeFollower }); }); } } diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 9f574f124e..516cf7b56a 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -33,6 +33,7 @@ export const paramDef = { sinceId: { type: 'string', format: 'misskey:id' }, untilId: { type: 'string', format: 'misskey:id' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, + includeFollower: { type: 'boolean', default: false }, }, required: ['host'], } as const; @@ -54,7 +55,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: true }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: ps.includeFollower }); }); } } diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index b8d9434498..19007401e5 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -220,6 +220,7 @@ const followingPagination = { limit: 10, params: { host: props.host, + includeFollower: true, }, offsetMode: false, }; @@ -229,6 +230,7 @@ const followersPagination = { limit: 10, params: { host: props.host, + includeFollower: true, }, offsetMode: false, }; From 46e53e294e2b65ca9630f68347f2399983aee015 Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Mon, 7 Oct 2024 16:47:15 +0200 Subject: [PATCH 5/5] Parameterize followee as well --- .../backend/src/server/api/endpoints/federation/followers.ts | 3 ++- .../backend/src/server/api/endpoints/federation/following.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index c7630bed93..45a38e86d9 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -34,6 +34,7 @@ export const paramDef = { untilId: { type: 'string', format: 'misskey:id' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, includeFollower: { type: 'boolean', default: false }, + includeFollowee: { type: 'boolean', default: true }, }, required: ['host'], } as const; @@ -55,7 +56,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: ps.includeFollower }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: ps.includeFollowee, populateFollower: ps.includeFollower }); }); } } diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 516cf7b56a..23257ae926 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -34,6 +34,7 @@ export const paramDef = { untilId: { type: 'string', format: 'misskey:id' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, includeFollower: { type: 'boolean', default: false }, + includeFollowee: { type: 'boolean', default: true }, }, required: ['host'], } as const; @@ -55,7 +56,7 @@ export default class extends Endpoint { // eslint- .limit(ps.limit) .getMany(); - return await this.followingEntityService.packMany(followings, me, { populateFollowee: true, populateFollower: ps.includeFollower }); + return await this.followingEntityService.packMany(followings, me, { populateFollowee: ps.includeFollowee, populateFollower: ps.includeFollower }); }); } }