Fix breaking follow relationships + add warning counts to dialogue

This commit is contained in:
PrivateGER 2024-10-05 18:50:42 +02:00
parent 99a0f756ff
commit b3f925c426
3 changed files with 12 additions and 8 deletions

View File

@ -1330,7 +1330,7 @@ confirmWhenRevealingSensitiveMedia: "Confirm when revealing sensitive media"
sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?" sensitiveMediaRevealConfirm: "This media might be sensitive. Are you sure you want to reveal it?"
createdLists: "Created lists" createdLists: "Created lists"
createdAntennas: "Created antennas" createdAntennas: "Created antennas"
severAllFollowRelations: "Break follow relationships" severAllFollowRelations: "Break following relationships"
severAllFollowRelationsConfirm: "Really break all follow relationships? This is irreversible!" severAllFollowRelationsConfirm: "Really break all follow relationships? This is irreversible!"
_delivery: _delivery:
status: "Delivery status" status: "Delivery status"

View File

@ -31,7 +31,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.usersRepository) @Inject(DI.usersRepository)
private usersRepository: UsersRepository, private usersRepository: UsersRepository,
@Inject(DI.notesRepository) @Inject(DI.followingsRepository)
private followingsRepository: FollowingsRepository, private followingsRepository: FollowingsRepository,
private queueService: QueueService, private queueService: QueueService,

View File

@ -43,9 +43,11 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._delivery._type[suspensionState] }} {{ i18n.ts._delivery._type[suspensionState] }}
</template> </template>
</MkKeyValue> </MkKeyValue>
<MkButton :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFilesConfirm }}</MkButton> <div class="_buttons">
<MkButton :disabled="!instance" danger @click="severAllFollowRelations">{{ i18n.ts.severAllFollowRelations }}</MkButton> <MkButton inline :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFiles }}</MkButton>
<MkButton v-if="suspensionState === 'none'" :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton> <MkButton inline :disabled="!instance" danger @click="severAllFollowRelations">{{ i18n.ts.severAllFollowRelations }}</MkButton>
<MkButton v-if="suspensionState === 'none'" inline :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
</div>
<MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton> <MkButton v-if="suspensionState !== 'none'" :disabled="!instance" @click="resumeDelivery">{{ i18n.ts._delivery.resume }}</MkButton>
<MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch> <MkSwitch v-model="isBlocked" :disabled="!meta || !instance" @update:modelValue="toggleBlock">{{ i18n.ts.blockThisInstance }}</MkSwitch>
<MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch> <MkSwitch v-model="isSilenced" :disabled="!meta || !instance" @update:modelValue="toggleSilenced">{{ i18n.ts.silenceThisInstance }}</MkSwitch>
@ -277,7 +279,8 @@ async function deleteAllFiles(): void {
type: 'danger', type: 'danger',
text: i18n.ts.deleteAllFilesConfirm, text: i18n.ts.deleteAllFilesConfirm,
}); });
if (!confirm) return; if (confirm.canceled) return;
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
await misskeyApi('admin/federation/delete-all-files', { await misskeyApi('admin/federation/delete-all-files', {
host: instance.value.host, host: instance.value.host,
@ -292,9 +295,10 @@ async function severAllFollowRelations(): void {
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'danger', 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', { await misskeyApi('admin/federation/remove-all-following', {
host: instance.value.host, host: instance.value.host,
}); });