summaryrefslogtreecommitdiff
path: root/packages/frontend/src/pages/admin/announcements.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2026-01-09 22:06:40 +0900
committerGitHub <noreply@github.com>2026-01-09 22:06:40 +0900
commit41592eafb363e3c62ab2d3e5f41b38d7d083d3fb (patch)
tree8f69243a5482ad4161eb28b69769684a221aa05c /packages/frontend/src/pages/admin/announcements.vue
parentfix(frontend): popupのemit型が正しく利用できるように修正 (#16... (diff)
downloadmisskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.tar.gz
misskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.tar.bz2
misskey-41592eafb363e3c62ab2d3e5f41b38d7d083d3fb.zip
refactor: make noImplicitAny true (#17083)
* wip * Update emojis.emoji.vue * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update manager.ts * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update analytics.ts
Diffstat (limited to 'packages/frontend/src/pages/admin/announcements.vue')
-rw-r--r--packages/frontend/src/pages/admin/announcements.vue49
1 files changed, 34 insertions, 15 deletions
diff --git a/packages/frontend/src/pages/admin/announcements.vue b/packages/frontend/src/pages/admin/announcements.vue
index 4a5c83e9df..ddf458b268 100644
--- a/packages/frontend/src/pages/admin/announcements.vue
+++ b/packages/frontend/src/pages/admin/announcements.vue
@@ -83,6 +83,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed, watch } from 'vue';
+import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue';
@@ -112,7 +113,12 @@ const {
const loading = ref(true);
const loadingMore = ref(false);
-const announcements = ref<any[]>([]);
+const announcements = ref<(Omit<Misskey.entities.AdminAnnouncementsListResponse[number], 'id' | 'createdAt' | 'updatedAt' | 'reads' | 'isActive'> & {
+ id: string | null;
+ _id?: string;
+ isActive?: Misskey.entities.AdminAnnouncementsListResponse[number]['isActive'];
+ reads?: Misskey.entities.AdminAnnouncementsListResponse[number]['reads'];
+})[]>([]);
watch(announcementsStatus, (to) => {
loading.value = true;
@@ -136,42 +142,55 @@ function add() {
forExistingUsers: false,
silence: false,
needConfirmationToRead: false,
+ userId: null,
});
}
-function del(announcement) {
- os.confirm({
+async function del(announcement: (typeof announcements)['value'][number]) {
+ if (announcement.id == null) return;
+ const { canceled } = await os.confirm({
type: 'warning',
text: i18n.tsx.deleteAreYouSure({ x: announcement.title }),
- }).then(({ canceled }) => {
- if (canceled) return;
- announcements.value = announcements.value.filter(x => x !== announcement);
- misskeyApi('admin/announcements/delete', announcement);
+ });
+ if (canceled) return;
+ announcements.value = announcements.value.filter(x => x !== announcement);
+ misskeyApi('admin/announcements/delete', {
+ id: announcement.id,
});
}
-async function archive(announcement) {
+async function archive(announcement: (typeof announcements)['value'][number]) {
+ if (announcement.id == null) return;
+ const { _id, ...data } = announcement; // _idを消す
await os.apiWithDialog('admin/announcements/update', {
- ...announcement,
+ ...data,
+ id: announcement.id, // TSを黙らすため
isActive: false,
});
refresh();
}
-async function unarchive(announcement) {
+async function unarchive(announcement: (typeof announcements)['value'][number]) {
+ if (announcement.id == null) return;
+ const { _id, ...data } = announcement; // _idを消す
await os.apiWithDialog('admin/announcements/update', {
- ...announcement,
+ ...data,
+ id: announcement.id, // TSを黙らすため
isActive: true,
});
refresh();
}
-async function save(announcement) {
+async function save(announcement: (typeof announcements)['value'][number]) {
+ const { _id, ...data } = announcement; // _idを消す
if (announcement.id == null) {
- await os.apiWithDialog('admin/announcements/create', announcement);
+ await os.apiWithDialog('admin/announcements/create', data);
refresh();
} else {
- os.apiWithDialog('admin/announcements/update', announcement);
+ os.apiWithDialog('admin/announcements/update', {
+ ...data,
+ id: announcement.id, // TSを黙らすため
+ });
}
}
@@ -179,7 +198,7 @@ function more() {
loadingMore.value = true;
misskeyApi('admin/announcements/list', {
status: announcementsStatus.value,
- untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id,
+ untilId: announcements.value.reduce((acc, announcement) => announcement.id != null ? announcement : acc).id!,
}).then(announcementResponse => {
announcements.value = announcements.value.concat(announcementResponse);
loadingMore.value = false;