From b3f925c426b88432f9b6143f05d4989a8178f3ea Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Sat, 5 Oct 2024 18:50:42 +0200 Subject: [PATCH] Fix breaking follow relationships + add warning counts to dialogue --- locales/en-US.yml | 2 +- .../admin/federation/remove-all-following.ts | 2 +- packages/frontend/src/pages/instance-info.vue | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index ad517b888f..eebda35a5e 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1330,7 +1330,7 @@ confirmWhenRevealingSensitiveMedia: "Confirm when revealing sensitive media" sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?" createdLists: "Created lists" createdAntennas: "Created antennas" -severAllFollowRelations: "Break follow relationships" +severAllFollowRelations: "Break following relationships" severAllFollowRelationsConfirm: "Really break all follow relationships? This is irreversible!" _delivery: status: "Delivery status" diff --git a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts index 9e93310746..7f84e7694d 100644 --- a/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts +++ b/packages/backend/src/server/api/endpoints/admin/federation/remove-all-following.ts @@ -31,7 +31,7 @@ export default class extends Endpoint { // eslint- @Inject(DI.usersRepository) private usersRepository: UsersRepository, - @Inject(DI.notesRepository) + @Inject(DI.followingsRepository) private followingsRepository: FollowingsRepository, private queueService: QueueService, diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index 18dfa80d6b..6f3fc34dd1 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -43,9 +43,11 @@ SPDX-License-Identifier: AGPL-3.0-only {{ i18n.ts._delivery._type[suspensionState] }} - {{ i18n.ts.deleteAllFilesConfirm }} - {{ i18n.ts.severAllFollowRelations }} - {{ i18n.ts._delivery.stop }} +
+ {{ i18n.ts.deleteAllFiles }} + {{ i18n.ts.severAllFollowRelations }} + {{ i18n.ts._delivery.stop }} +
{{ i18n.ts._delivery.resume }} {{ i18n.ts.blockThisInstance }} {{ i18n.ts.silenceThisInstance }} @@ -277,7 +279,8 @@ async function deleteAllFiles(): void { type: 'danger', text: i18n.ts.deleteAllFilesConfirm, }); - if (!confirm) return; + if (confirm.canceled) return; + if (!instance.value) throw new Error('No instance?'); await misskeyApi('admin/federation/delete-all-files', { host: instance.value.host, @@ -292,9 +295,10 @@ async function severAllFollowRelations(): void { const confirm = await os.confirm({ type: 'danger', - text: i18n.ts.severAllFollowRelationsConfirm, + text: `${i18n.ts.severAllFollowRelationsConfirm} This will break ${instance.value.followingCount} following and ${instance.value.followersCount} follower relations on ${meta.value.name}.`, }); - if (!confirm) return; + if (confirm.canceled) return; + await misskeyApi('admin/federation/remove-all-following', { host: instance.value.host, });