This commit is contained in:
syuilo 2025-09-24 17:53:36 +09:00
parent 4cef192011
commit 4a698165cc
5 changed files with 158 additions and 98 deletions

4
locales/index.d.ts vendored
View File

@ -5569,6 +5569,10 @@ export interface Locale extends ILocale {
*
*/
"schedule": string;
/**
*
*/
"scheduled": string;
"_compression": {
"_quality": {
/**

View File

@ -1387,6 +1387,7 @@ createUserSpecifiedNote: "ユーザー指定ノートを作成"
schedulePost: "投稿を予約"
scheduleToPostOnX: "{x}に投稿を予約します"
schedule: "予約"
scheduled: "予約"
_compression:
_quality:

View File

@ -41,6 +41,7 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
sinceDate: { type: 'integer' },
untilDate: { type: 'integer' },
scheduled: { type: 'boolean', nullable: true },
},
required: [],
} as const;
@ -58,6 +59,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const query = this.queryService.makePaginationQuery<MiNoteDraft>(this.noteDraftsRepository.createQueryBuilder('drafts'), ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere('drafts.userId = :meId', { meId: me.id });
if (ps.scheduled === true) {
query.andWhere('drafts.isActuallyScheduled = true');
} else if (ps.scheduled === false) {
query.andWhere('drafts.isActuallyScheduled = false');
}
const drafts = await query
.limit(ps.limit)
.getMany();

View File

@ -15,10 +15,32 @@ SPDX-License-Identifier: AGPL-3.0-only
@esc="cancel()"
>
<template #header>
{{ i18n.ts.drafts }} ({{ currentDraftsCount }}/{{ $i?.policies.noteDraftLimit }})
{{ i18n.ts.draftsAndScheduledNotes }} ({{ currentDraftsCount }}/{{ $i?.policies.noteDraftLimit }})
</template>
<MkStickyContainer>
<template #header>
<MkTabs
v-model:tab="tab"
centered
:class="$style.tabs"
:tabs="[
{
key: 'drafts',
title: i18n.ts.drafts,
icon: 'ti ti-pencil-question',
},
{
key: 'scheduled',
title: i18n.ts.scheduled,
icon: 'ti ti-calendar-clock',
},
]"
/>
</template>
<div class="_spacer">
<MkPagination :paginator="paginator" withControl>
<MkPagination :key="tab" :paginator="tab === 'scheduled' ? scheduledPaginator : draftsPaginator" withControl>
<template #empty>
<MkResult type="empty" :text="i18n.ts._drafts.noDrafts"/>
</template>
@ -119,6 +141,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
</MkPagination>
</div>
</MkStickyContainer>
</MkModalWindow>
</template>
@ -134,6 +157,11 @@ import * as os from '@/os.js';
import { $i } from '@/i.js';
import { misskeyApi } from '@/utility/misskey-api';
import { Paginator } from '@/utility/paginator.js';
import MkTabs from '@/components/MkTabs.vue';
const props = defineProps<{
scheduled?: boolean;
}>();
const emit = defineEmits<{
(ev: 'restore', draft: Misskey.entities.NoteDraft): void;
@ -141,8 +169,20 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();
const paginator = markRaw(new Paginator('notes/drafts/list', {
const tab = ref<'drafts' | 'scheduled'>(props.scheduled ? 'scheduled' : 'drafts');
const draftsPaginator = markRaw(new Paginator('notes/drafts/list', {
limit: 10,
params: {
scheduled: false,
},
}));
const scheduledPaginator = markRaw(new Paginator('notes/drafts/list', {
limit: 10,
params: {
scheduled: true,
},
}));
const currentDraftsCount = ref(0);
@ -171,7 +211,7 @@ async function deleteDraft(draft: Misskey.entities.NoteDraft) {
if (canceled) return;
os.apiWithDialog('notes/drafts/delete', { draftId: draft.id }).then(() => {
paginator.reload();
draftsPaginator.reload();
});
}
</script>
@ -229,4 +269,11 @@ async function deleteDraft(draft: Misskey.entities.NoteDraft) {
padding-top: 16px;
border-top: solid 1px var(--MI_THEME-divider);
}
.tabs {
background: color(from var(--MI_THEME-bg) srgb r g b / 0.75);
-webkit-backdrop-filter: var(--MI-blur, blur(15px));
backdrop-filter: var(--MI-blur, blur(15px));
border-bottom: solid 0.5px var(--MI_THEME-divider);
}
</style>

View File

@ -29354,6 +29354,7 @@ export interface operations {
untilId?: string;
sinceDate?: number;
untilDate?: number;
scheduled?: boolean | null;
};
};
};