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?"
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"

View file

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

View file

@ -43,9 +43,11 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._delivery._type[suspensionState] }}
</template>
</MkKeyValue>
<MkButton :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFilesConfirm }}</MkButton>
<MkButton :disabled="!instance" danger @click="severAllFollowRelations">{{ i18n.ts.severAllFollowRelations }}</MkButton>
<MkButton v-if="suspensionState === 'none'" :disabled="!instance" danger @click="stopDelivery">{{ i18n.ts._delivery.stop }}</MkButton>
<div class="_buttons">
<MkButton inline :disabled="!instance" danger @click="deleteAllFiles">{{ i18n.ts.deleteAllFiles }}</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>
<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>
@ -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,
});