Merge tag '2023.12.0-beta.3' into merge-upstream
This commit is contained in:
commit
e77ddfce91
423 changed files with 42868 additions and 10814 deletions
|
@ -95,7 +95,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, shallowRef, watch, computed } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import XHeader from './_header_.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
|
@ -110,12 +110,12 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
|
||||
const announceTitleEl = $shallowRef<HTMLInputElement | null>(null);
|
||||
const announceTitleEl = shallowRef<HTMLInputElement | null>(null);
|
||||
const user = ref<misskey.entities.UserLite | null>(null);
|
||||
const offset = ref(0);
|
||||
const hasMore = ref(false);
|
||||
|
||||
let announcements: any[] = $ref([]);
|
||||
const announcements = ref<any[]>([]);
|
||||
|
||||
function selectUserFilter(): void {
|
||||
os.selectUser().then(_user => {
|
||||
|
@ -131,11 +131,11 @@ function editUser(announcement): void {
|
|||
}
|
||||
|
||||
function insertEmoji(ev: MouseEvent): void {
|
||||
os.openEmojiPicker((ev.currentTarget ?? ev.target) as HTMLElement, {}, announceTitleEl);
|
||||
os.openEmojiPicker((ev.currentTarget ?? ev.target) as HTMLElement, {}, announceTitleEl.value);
|
||||
}
|
||||
|
||||
function add() {
|
||||
announcements.unshift({
|
||||
announcements.value.unshift({
|
||||
_id: Math.random().toString(36),
|
||||
id: null,
|
||||
title: 'New announcement',
|
||||
|
@ -157,7 +157,7 @@ function del(announcement) {
|
|||
text: i18n.t('deleteAreYouSure', { x: announcement.title }),
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
announcements = announcements.filter(x => x !== announcement);
|
||||
announcements.value = announcements.value.filter(x => x !== announcement);
|
||||
os.api('admin/announcements/delete', announcement);
|
||||
});
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ async function save(announcement): Promise<void> {
|
|||
|
||||
function fetch(resetOffset = false): void {
|
||||
if (resetOffset) {
|
||||
announcements = [];
|
||||
announcements.value = [];
|
||||
offset.value = 0;
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ function fetch(resetOffset = false): void {
|
|||
limit: 10,
|
||||
userId: user.value?.id,
|
||||
}).then(announcementResponse => {
|
||||
announcements = announcements.concat(announcementResponse);
|
||||
announcements.value = announcements.value.concat(announcementResponse);
|
||||
hasMore.value = announcementResponse?.length === 10;
|
||||
offset.value += announcementResponse?.length ?? 0;
|
||||
});
|
||||
|
@ -200,14 +200,14 @@ function fetch(resetOffset = false): void {
|
|||
watch(user, () => fetch(true));
|
||||
fetch(true);
|
||||
|
||||
const headerActions = $computed(() => [{
|
||||
const headerActions = computed(() => [{
|
||||
asFullButton: true,
|
||||
icon: 'ti ti-plus',
|
||||
text: i18n.ts.add,
|
||||
handler: add,
|
||||
}]);
|
||||
|
||||
const headerTabs = $computed(() => []);
|
||||
const headerTabs = computed(() => []);
|
||||
|
||||
definePageMetadata({
|
||||
title: i18n.ts.announcements,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue