wip
This commit is contained in:
parent
afc3c3f0c7
commit
a1c87d21c4
|
@ -1098,6 +1098,8 @@ export interface Locale {
|
||||||
"doYouAgree": string;
|
"doYouAgree": string;
|
||||||
"beSureToReadThisAsItIsImportant": string;
|
"beSureToReadThisAsItIsImportant": string;
|
||||||
"iHaveReadXCarefullyAndAgree": string;
|
"iHaveReadXCarefullyAndAgree": string;
|
||||||
|
"dialog": string;
|
||||||
|
"icon": string;
|
||||||
"_announcement": {
|
"_announcement": {
|
||||||
"forExistingUsers": string;
|
"forExistingUsers": string;
|
||||||
"forExistingUsersDescription": string;
|
"forExistingUsersDescription": string;
|
||||||
|
|
|
@ -1096,6 +1096,7 @@ doYouAgree: "同意しますか?"
|
||||||
beSureToReadThisAsItIsImportant: "重要ですので必ずお読みください。"
|
beSureToReadThisAsItIsImportant: "重要ですので必ずお読みください。"
|
||||||
iHaveReadXCarefullyAndAgree: "「{x}」の内容をよく読み、同意します。"
|
iHaveReadXCarefullyAndAgree: "「{x}」の内容をよく読み、同意します。"
|
||||||
dialog: "ダイアログ"
|
dialog: "ダイアログ"
|
||||||
|
icon: "アイコン"
|
||||||
|
|
||||||
_announcement:
|
_announcement:
|
||||||
forExistingUsers: "既存ユーザーのみ"
|
forExistingUsers: "既存ユーザーのみ"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
export class RefineAnnouncement21691657412740 {
|
||||||
|
name = 'RefineAnnouncement21691657412740'
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "announcement" ADD "icon" character varying(256) NOT NULL DEFAULT 'info'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "announcement" DROP COLUMN "icon"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,6 +66,7 @@ export class AnnouncementService {
|
||||||
title: values.title,
|
title: values.title,
|
||||||
text: values.text,
|
text: values.text,
|
||||||
imageUrl: values.imageUrl,
|
imageUrl: values.imageUrl,
|
||||||
|
icon: values.icon,
|
||||||
display: values.display,
|
display: values.display,
|
||||||
forExistingUsers: values.forExistingUsers,
|
forExistingUsers: values.forExistingUsers,
|
||||||
needConfirmationToRead: values.needConfirmationToRead,
|
needConfirmationToRead: values.needConfirmationToRead,
|
||||||
|
@ -118,6 +119,7 @@ export class AnnouncementService {
|
||||||
text: announcement.text,
|
text: announcement.text,
|
||||||
title: announcement.title,
|
title: announcement.title,
|
||||||
imageUrl: announcement.imageUrl,
|
imageUrl: announcement.imageUrl,
|
||||||
|
icon: announcement.icon,
|
||||||
display: announcement.display,
|
display: announcement.display,
|
||||||
needConfirmationToRead: announcement.needConfirmationToRead,
|
needConfirmationToRead: announcement.needConfirmationToRead,
|
||||||
forYou: announcement.userId === me?.id,
|
forYou: announcement.userId === me?.id,
|
||||||
|
|
|
@ -39,6 +39,13 @@ export class Announcement {
|
||||||
})
|
})
|
||||||
public imageUrl: string | null;
|
public imageUrl: string | null;
|
||||||
|
|
||||||
|
// info, warning, error, success
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 256, nullable: false,
|
||||||
|
default: 'info',
|
||||||
|
})
|
||||||
|
public icon: string;
|
||||||
|
|
||||||
// normal ... お知らせページ掲載
|
// normal ... お知らせページ掲載
|
||||||
// banner ... お知らせページ掲載 + バナー表示
|
// banner ... お知らせページ掲載 + バナー表示
|
||||||
// dialog ... お知らせページ掲載 + ダイアログ表示
|
// dialog ... お知らせページ掲載 + ダイアログ表示
|
||||||
|
|
|
@ -34,6 +34,10 @@ export const packedAnnouncementSchema = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: true,
|
optional: false, nullable: true,
|
||||||
},
|
},
|
||||||
|
icon: {
|
||||||
|
type: 'string',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
},
|
||||||
display: {
|
display: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
|
|
@ -55,6 +55,7 @@ export const paramDef = {
|
||||||
title: { type: 'string', minLength: 1 },
|
title: { type: 'string', minLength: 1 },
|
||||||
text: { type: 'string', minLength: 1 },
|
text: { type: 'string', minLength: 1 },
|
||||||
imageUrl: { type: 'string', nullable: true, minLength: 1 },
|
imageUrl: { type: 'string', nullable: true, minLength: 1 },
|
||||||
|
icon: { type: 'string', enum: ['info', 'warning', 'error', 'success'], default: 'info' },
|
||||||
display: { type: 'string', enum: ['normal', 'banner', 'dialog'], default: 'normal' },
|
display: { type: 'string', enum: ['normal', 'banner', 'dialog'], default: 'normal' },
|
||||||
forExistingUsers: { type: 'boolean', default: false },
|
forExistingUsers: { type: 'boolean', default: false },
|
||||||
needConfirmationToRead: { type: 'boolean', default: false },
|
needConfirmationToRead: { type: 'boolean', default: false },
|
||||||
|
@ -76,6 +77,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
title: ps.title,
|
title: ps.title,
|
||||||
text: ps.text,
|
text: ps.text,
|
||||||
imageUrl: ps.imageUrl,
|
imageUrl: ps.imageUrl,
|
||||||
|
icon: ps.icon,
|
||||||
display: ps.display,
|
display: ps.display,
|
||||||
forExistingUsers: ps.forExistingUsers,
|
forExistingUsers: ps.forExistingUsers,
|
||||||
needConfirmationToRead: ps.needConfirmationToRead,
|
needConfirmationToRead: ps.needConfirmationToRead,
|
||||||
|
|
|
@ -108,6 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
title: announcement.title,
|
title: announcement.title,
|
||||||
text: announcement.text,
|
text: announcement.text,
|
||||||
imageUrl: announcement.imageUrl,
|
imageUrl: announcement.imageUrl,
|
||||||
|
icon: announcement.icon,
|
||||||
display: announcement.display,
|
display: announcement.display,
|
||||||
isActive: announcement.isActive,
|
isActive: announcement.isActive,
|
||||||
forExistingUsers: announcement.forExistingUsers,
|
forExistingUsers: announcement.forExistingUsers,
|
||||||
|
|
|
@ -31,12 +31,13 @@ export const paramDef = {
|
||||||
title: { type: 'string', minLength: 1 },
|
title: { type: 'string', minLength: 1 },
|
||||||
text: { type: 'string', minLength: 1 },
|
text: { type: 'string', minLength: 1 },
|
||||||
imageUrl: { type: 'string', nullable: true, minLength: 0 },
|
imageUrl: { type: 'string', nullable: true, minLength: 0 },
|
||||||
|
icon: { type: 'string', enum: ['info', 'warning', 'error', 'success'] },
|
||||||
display: { type: 'string', enum: ['normal', 'banner', 'dialog'] },
|
display: { type: 'string', enum: ['normal', 'banner', 'dialog'] },
|
||||||
forExistingUsers: { type: 'boolean' },
|
forExistingUsers: { type: 'boolean' },
|
||||||
needConfirmationToRead: { type: 'boolean' },
|
needConfirmationToRead: { type: 'boolean' },
|
||||||
isActive: { type: 'boolean' },
|
isActive: { type: 'boolean' },
|
||||||
},
|
},
|
||||||
required: ['id', 'title', 'text', 'imageUrl', 'display', 'forExistingUsers', 'needConfirmationToRead', 'isActive'],
|
required: ['id', 'title', 'text', 'imageUrl', 'icon', 'display', 'forExistingUsers', 'needConfirmationToRead', 'isActive'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@ -58,6 +59,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
|
/* eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- 空の文字列の場合、nullを渡すようにするため */
|
||||||
imageUrl: ps.imageUrl || null,
|
imageUrl: ps.imageUrl || null,
|
||||||
display: ps.display,
|
display: ps.display,
|
||||||
|
icon: ps.icon,
|
||||||
forExistingUsers: ps.forExistingUsers,
|
forExistingUsers: ps.forExistingUsers,
|
||||||
needConfirmationToRead: ps.needConfirmationToRead,
|
needConfirmationToRead: ps.needConfirmationToRead,
|
||||||
isActive: ps.isActive,
|
isActive: ps.isActive,
|
||||||
|
|
|
@ -89,7 +89,14 @@ export async function mainBoot() {
|
||||||
}, {}, 'closed');
|
}, {}, 'closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: announcementCreatedイベント監視
|
stream.on('announcementCreated', (ev) => {
|
||||||
|
const announcement = ev.announcement;
|
||||||
|
if (announcement.display === 'dialog') {
|
||||||
|
popup(defineAsyncComponent(() => import('@/components/MkAnnouncementDialog.vue')), {
|
||||||
|
announcement,
|
||||||
|
}, {}, 'closed');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if ($i.isDeleted) {
|
if ($i.isDeleted) {
|
||||||
alert({
|
alert({
|
||||||
|
|
|
@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, shallowRef } from 'vue';
|
import { onMounted, shallowRef } from 'vue';
|
||||||
import * as misskey from 'misskey-js';
|
import * as misskey from 'misskey-js';
|
||||||
|
import * as os from '@/os';
|
||||||
import MkModal from '@/components/MkModal.vue';
|
import MkModal from '@/components/MkModal.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
@ -29,6 +30,7 @@ const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||||
|
|
||||||
function ok() {
|
function ok() {
|
||||||
modal.value.close();
|
modal.value.close();
|
||||||
|
os.api('i/read-announcement', { announcementId: props.announcement.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -69,6 +69,7 @@ function add() {
|
||||||
title: '',
|
title: '',
|
||||||
text: '',
|
text: '',
|
||||||
imageUrl: null,
|
imageUrl: null,
|
||||||
|
icon: 'info',
|
||||||
display: 'normal',
|
display: 'normal',
|
||||||
forExistingUsers: false,
|
forExistingUsers: false,
|
||||||
needConfirmationToRead: false,
|
needConfirmationToRead: false,
|
||||||
|
|
|
@ -415,6 +415,7 @@ export type Announcement = {
|
||||||
title: string;
|
title: string;
|
||||||
imageUrl: string | null;
|
imageUrl: string | null;
|
||||||
display: 'normal' | 'banner' | 'dialog';
|
display: 'normal' | 'banner' | 'dialog';
|
||||||
|
icon: 'info' | 'warning' | 'error' | 'success';
|
||||||
needConfirmationToRead: boolean;
|
needConfirmationToRead: boolean;
|
||||||
forYou: boolean;
|
forYou: boolean;
|
||||||
isRead?: boolean;
|
isRead?: boolean;
|
||||||
|
|
Loading…
Reference in New Issue