新規にフォローした人のwithRepliesをtrueにする機能を追加 (#12048)
* 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 commitf2cc4fe6* Revert "feat: update defaultWithReplies from API" This reverts commit95e3cee6* Revert "feat: add defaultWithReplies to MiUser" This reverts commit9f5ab14d70. * 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>
This commit is contained in:
		| @@ -14,6 +14,7 @@ import * as Misskey from 'misskey-js'; | ||||
| import * as os from '@/os.js'; | ||||
| import { mainRouter } from '@/router.js'; | ||||
| import { i18n } from '@/i18n.js'; | ||||
| import { defaultStore } from "@/store.js"; | ||||
|  | ||||
| async function follow(user): Promise<void> { | ||||
| 	const { canceled } = await os.confirm({ | ||||
| @@ -28,7 +29,9 @@ async function follow(user): Promise<void> { | ||||
|  | ||||
| 	os.apiWithDialog('following/create', { | ||||
| 		userId: user.id, | ||||
| 		withReplies: defaultStore.state.defaultWithReplies, | ||||
| 	}); | ||||
| 	user.withReplies = defaultStore.state.defaultWithReplies; | ||||
| } | ||||
|  | ||||
| const acct = new URL(location.href).searchParams.get('acct'); | ||||
|   | ||||
| @@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 								<MkUserName :user="post.user" style="display: block;"/> | ||||
| 								<MkAcct :user="post.user"/> | ||||
| 							</div> | ||||
| 							<MkFollowButton v-if="!$i || $i.id != post.user.id" :user="post.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/> | ||||
| 							<MkFollowButton v-if="!$i || $i.id != post.user.id" v-model:user="post.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<MkAd :prefer="['horizontal', 'horizontal-big']"/> | ||||
|   | ||||
| @@ -29,6 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 		<div class="_gaps_s"> | ||||
| 			<MkSwitch v-model="showFixedPostForm">{{ i18n.ts.showFixedPostForm }}</MkSwitch> | ||||
| 			<MkSwitch v-model="showFixedPostFormInChannel">{{ i18n.ts.showFixedPostFormInChannel }}</MkSwitch> | ||||
| 			<MkSwitch v-model="defaultWithReplies">{{ i18n.ts.withRepliesByDefaultForNewlyFollowed }}</MkSwitch> | ||||
| 			<MkFolder> | ||||
| 				<template #label>{{ i18n.ts.pinnedList }}</template> | ||||
| 				<!-- 複数ピン止め管理できるようにしたいけどめんどいので一旦ひとつのみ --> | ||||
| @@ -249,6 +250,7 @@ const mediaListWithOneImageAppearance = computed(defaultStore.makeGetterSetter(' | ||||
| const notificationPosition = computed(defaultStore.makeGetterSetter('notificationPosition')); | ||||
| const notificationStackAxis = computed(defaultStore.makeGetterSetter('notificationStackAxis')); | ||||
| const keepScreenOn = computed(defaultStore.makeGetterSetter('keepScreenOn')); | ||||
| const defaultWithReplies = computed(defaultStore.makeGetterSetter('defaultWithReplies')); | ||||
|  | ||||
| watch(lang, () => { | ||||
| 	miLocalStorage.setItem('lang', lang.value as string); | ||||
|   | ||||
| @@ -40,6 +40,9 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 			<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> | ||||
| @@ -118,9 +121,11 @@ 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({ | ||||
| @@ -177,7 +182,10 @@ const exportAntennas = () => { | ||||
|  | ||||
| const importFollowing = async (ev) => { | ||||
| 	const file = await selectFile(ev.currentTarget ?? ev.target); | ||||
| 	os.api('i/import-following', { fileId: file.id }).then(onImportSuccess).catch(onError); | ||||
| 	os.api('i/import-following', { | ||||
| 		fileId: file.id, | ||||
| 		withReplies: withReplies.value, | ||||
| 	}).then(onImportSuccess).catch(onError); | ||||
| }; | ||||
|  | ||||
| const importUserLists = async (ev) => { | ||||
|   | ||||
| @@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only | ||||
| 						<span v-if="$i && $i.id != user.id && user.isFollowed" class="followed">{{ i18n.ts.followsYou }}</span> | ||||
| 						<div v-if="$i" class="actions"> | ||||
| 							<button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button> | ||||
| 							<MkFollowButton v-if="$i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/> | ||||
| 							<MkFollowButton v-if="$i.id != user.id" v-model:user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 					<MkAvatar class="avatar" :user="user" indicator/> | ||||
| @@ -198,6 +198,7 @@ const props = withDefaults(defineProps<{ | ||||
|  | ||||
| const router = useRouter(); | ||||
|  | ||||
| let user = $ref(props.user); | ||||
| let parallaxAnimationId = $ref<null | number>(null); | ||||
| let narrow = $ref<null | boolean>(null); | ||||
| let rootEl = $ref<null | HTMLElement>(null); | ||||
| @@ -232,7 +233,7 @@ const age = $computed(() => { | ||||
| }); | ||||
|  | ||||
| function menu(ev) { | ||||
| 	const { menu, cleanup } = getUserMenu(props.user, router); | ||||
| 	const { menu, cleanup } = getUserMenu(user, router); | ||||
| 	os.popupMenu(menu, ev.currentTarget ?? ev.target).finally(cleanup); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 anatawa12
					anatawa12