refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)

* refactor(frontend): 非推奨となったReactivity Transformを使わないように

* refactor: 不要な括弧を除去

* fix: 不要なアノテーションを除去

* fix: Refの配列をrefしている部分の対応

* refactor: 不要な括弧を除去

* fix: lint

* refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換

* fix: type error

* chore: drop reactivity transform from eslint configuration

* refactor: remove unnecessary import

* fix: 対応漏れ
This commit is contained in:
zyoshoka
2023-12-07 14:42:09 +09:00
committed by GitHub
parent e42c91dee7
commit 406b4bdbe7
277 changed files with 3353 additions and 3441 deletions

View File

@@ -79,7 +79,7 @@ const props = defineProps<{
}>();
const paginationEl = ref<InstanceType<typeof MkPagination>>();
let list = $ref<Misskey.entities.UserList | null>(null);
const list = ref<Misskey.entities.UserList | null>(null);
const isPublic = ref(false);
const name = ref('');
const membershipsPagination = {
@@ -94,17 +94,17 @@ function fetchList() {
os.api('users/lists/show', {
listId: props.listId,
}).then(_list => {
list = _list;
name.value = list.name;
isPublic.value = list.isPublic;
list.value = _list;
name.value = list.value.name;
isPublic.value = list.value.isPublic;
});
}
function addUser() {
os.selectUser().then(user => {
if (!list) return;
if (!list.value) return;
os.apiWithDialog('users/lists/push', {
listId: list.id,
listId: list.value.id,
userId: user.id,
}).then(() => {
paginationEl.value.reload();
@@ -118,9 +118,9 @@ async function removeUser(item, ev) {
icon: 'ti ti-x',
danger: true,
action: async () => {
if (!list) return;
if (!list.value) return;
os.api('users/lists/pull', {
listId: list.id,
listId: list.value.id,
userId: item.userId,
}).then(() => {
paginationEl.value.removeItem(item.id);
@@ -135,7 +135,7 @@ async function showMembershipMenu(item, ev) {
icon: item.withReplies ? 'ti ti-messages-off' : 'ti ti-messages',
action: async () => {
os.api('users/lists/update-membership', {
listId: list.id,
listId: list.value.id,
userId: item.userId,
withReplies: !item.withReplies,
}).then(() => {
@@ -149,42 +149,42 @@ async function showMembershipMenu(item, ev) {
}
async function deleteList() {
if (!list) return;
if (!list.value) return;
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.t('removeAreYouSure', { x: list.name }),
text: i18n.t('removeAreYouSure', { x: list.value.name }),
});
if (canceled) return;
await os.apiWithDialog('users/lists/delete', {
listId: list.id,
listId: list.value.id,
});
userListsCache.delete();
mainRouter.push('/my/lists');
}
async function updateSettings() {
if (!list) return;
if (!list.value) return;
await os.apiWithDialog('users/lists/update', {
listId: list.id,
listId: list.value.id,
name: name.value,
isPublic: isPublic.value,
});
userListsCache.delete();
list.name = name.value;
list.isPublic = isPublic.value;
list.value.name = name.value;
list.value.isPublic = isPublic.value;
}
watch(() => props.listId, fetchList, { immediate: true });
const headerActions = $computed(() => []);
const headerActions = computed(() => []);
const headerTabs = $computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => list ? {
title: list.name,
definePageMetadata(computed(() => list.value ? {
title: list.value.name,
icon: 'ti ti-list',
} : null));
</script>