5a3c6575dd
* feat: add defaultWithReplies to MiUser * feat: use defaultWithReplies when creating MiFollowing * feat: update defaultWithReplies from API * feat: return defaultWithReplies as a part of $i * feat(frontend): configure defaultWithReplies * docs(changelog): 新規にフォローした人のをデフォルトでTL二追加できるように * fix: typo * style: fix lint failure * chore: improve UI text * chore: make optional params of UserFollowingService.follow() object * chore: UserFollowingService.follow() accept withReplies * chore: add withReplies to MiFollowRequest * chore: process withReplies for follow request * feat: accept withReplies on 'following/create' endpoint * feat: store defaultWithReplies in client store * Revert "feat: return defaultWithReplies as a part of $i" This reverts commit f2cc4fe6 * Revert "feat: update defaultWithReplies from API" This reverts commit 95e3cee6 * Revert "feat: add defaultWithReplies to MiUser" This reverts commit 9f5ab14d7063532de2b049bc2ed40a15658168f5. * feat: configuring withReplies in import-following * feat(frontend): configure withReplies * fix(frontend): incorrectly showRepliesToOthersInTimeline can be shown * fix(backend): withReplies of following/create not working * fix(frontend): importFollowing error * fix: withReplies is not working with follow import * fix(frontend): use v-model * style: fix lint --------- Co-authored-by: Sayamame-beans <61457993+sayamame-beans@users.noreply.github.com> Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
225 lines
8 KiB
Vue
225 lines
8 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div class="_gaps_m">
|
|
<FormSection first>
|
|
<template #label><i class="ti ti-pencil"></i> {{ i18n.ts._exportOrImport.allNotes }}</template>
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportNotes()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-star"></i> {{ i18n.ts._exportOrImport.favoritedNotes }}</template>
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportFavorites()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-users"></i> {{ i18n.ts._exportOrImport.followingList }}</template>
|
|
<div class="_gaps_s">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<div class="_gaps_s">
|
|
<MkSwitch v-model="excludeMutingUsers">
|
|
{{ i18n.ts._exportOrImport.excludeMutingUsers }}
|
|
</MkSwitch>
|
|
<MkSwitch v-model="excludeInactiveUsers">
|
|
{{ i18n.ts._exportOrImport.excludeInactiveUsers }}
|
|
</MkSwitch>
|
|
<MkButton primary :class="$style.button" inline @click="exportFollowing()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</div>
|
|
</MkFolder>
|
|
<MkFolder v-if="$i && !$i.movedTo">
|
|
<template #label>{{ i18n.ts.import }}</template>
|
|
<template #icon><i class="ti ti-upload"></i></template>
|
|
<MkSwitch v-model="withReplies">
|
|
{{ i18n.ts._exportOrImport.withReplies }}
|
|
</MkSwitch>
|
|
<MkButton primary :class="$style.button" inline @click="importFollowing($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton>
|
|
</MkFolder>
|
|
</div>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-users"></i> {{ i18n.ts._exportOrImport.userLists }}</template>
|
|
<div class="_gaps_s">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportUserLists()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
<MkFolder v-if="$i && !$i.movedTo">
|
|
<template #label>{{ i18n.ts.import }}</template>
|
|
<template #icon><i class="ti ti-upload"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="importUserLists($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton>
|
|
</MkFolder>
|
|
</div>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-user-off"></i> {{ i18n.ts._exportOrImport.muteList }}</template>
|
|
<div class="_gaps_s">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportMuting()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
<MkFolder v-if="$i && !$i.movedTo">
|
|
<template #label>{{ i18n.ts.import }}</template>
|
|
<template #icon><i class="ti ti-upload"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="importMuting($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton>
|
|
</MkFolder>
|
|
</div>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-user-off"></i> {{ i18n.ts._exportOrImport.blockingList }}</template>
|
|
<div class="_gaps_s">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportBlocking()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
<MkFolder v-if="$i && !$i.movedTo">
|
|
<template #label>{{ i18n.ts.import }}</template>
|
|
<template #icon><i class="ti ti-upload"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="importBlocking($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton>
|
|
</MkFolder>
|
|
</div>
|
|
</FormSection>
|
|
<FormSection>
|
|
<template #label><i class="ti ti-antenna"></i> {{ i18n.ts.antennas }}</template>
|
|
<div class="_gaps_s">
|
|
<MkFolder>
|
|
<template #label>{{ i18n.ts.export }}</template>
|
|
<template #icon><i class="ti ti-download"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="exportAntennas()"><i class="ti ti-download"></i> {{ i18n.ts.export }}</MkButton>
|
|
</MkFolder>
|
|
<MkFolder v-if="$i && !$i.movedTo">
|
|
<template #label>{{ i18n.ts.import }}</template>
|
|
<template #icon><i class="ti ti-upload"></i></template>
|
|
<MkButton primary :class="$style.button" inline @click="importAntennas($event)"><i class="ti ti-upload"></i> {{ i18n.ts.import }}</MkButton>
|
|
</MkFolder>
|
|
</div>
|
|
</FormSection>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import FormSection from '@/components/form/section.vue';
|
|
import MkFolder from '@/components/MkFolder.vue';
|
|
import MkSwitch from '@/components/MkSwitch.vue';
|
|
import * as os from '@/os.js';
|
|
import { selectFile } from '@/scripts/select-file.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
import { $i } from '@/account.js';
|
|
import { defaultStore } from "@/store.js";
|
|
|
|
const excludeMutingUsers = ref(false);
|
|
const excludeInactiveUsers = ref(false);
|
|
const withReplies = ref(defaultStore.state.defaultWithReplies);
|
|
|
|
const onExportSuccess = () => {
|
|
os.alert({
|
|
type: 'info',
|
|
text: i18n.ts.exportRequested,
|
|
});
|
|
};
|
|
|
|
const onImportSuccess = () => {
|
|
os.alert({
|
|
type: 'info',
|
|
text: i18n.ts.importRequested,
|
|
});
|
|
};
|
|
|
|
const onError = (ev) => {
|
|
os.alert({
|
|
type: 'error',
|
|
text: ev.message,
|
|
});
|
|
};
|
|
|
|
const exportNotes = () => {
|
|
os.api('i/export-notes', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportFavorites = () => {
|
|
os.api('i/export-favorites', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportFollowing = () => {
|
|
os.api('i/export-following', {
|
|
excludeMuting: excludeMutingUsers.value,
|
|
excludeInactive: excludeInactiveUsers.value,
|
|
})
|
|
.then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportBlocking = () => {
|
|
os.api('i/export-blocking', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportUserLists = () => {
|
|
os.api('i/export-user-lists', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportMuting = () => {
|
|
os.api('i/export-mute', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const exportAntennas = () => {
|
|
os.api('i/export-antennas', {}).then(onExportSuccess).catch(onError);
|
|
};
|
|
|
|
const importFollowing = async (ev) => {
|
|
const file = await selectFile(ev.currentTarget ?? ev.target);
|
|
os.api('i/import-following', {
|
|
fileId: file.id,
|
|
withReplies: withReplies.value,
|
|
}).then(onImportSuccess).catch(onError);
|
|
};
|
|
|
|
const importUserLists = async (ev) => {
|
|
const file = await selectFile(ev.currentTarget ?? ev.target);
|
|
os.api('i/import-user-lists', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
|
};
|
|
|
|
const importMuting = async (ev) => {
|
|
const file = await selectFile(ev.currentTarget ?? ev.target);
|
|
os.api('i/import-muting', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
|
};
|
|
|
|
const importBlocking = async (ev) => {
|
|
const file = await selectFile(ev.currentTarget ?? ev.target);
|
|
os.api('i/import-blocking', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
|
};
|
|
|
|
const importAntennas = async (ev) => {
|
|
const file = await selectFile(ev.currentTarget ?? ev.target);
|
|
os.api('i/import-antennas', { fileId: file.id }).then(onImportSuccess).catch(onError);
|
|
};
|
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
definePageMetadata({
|
|
title: i18n.ts.importAndExport,
|
|
icon: 'ti ti-package',
|
|
});
|
|
</script>
|
|
|
|
<style module>
|
|
.button {
|
|
margin-right: 16px;
|
|
}
|
|
</style>
|