api: handle muting notification types

This commit is contained in:
Johann150 2022-06-20 21:03:26 +02:00
parent 58aa7d36aa
commit 321bd24b98
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -1,3 +1,4 @@
import { noteNotificationTypes } from 'foundkey-js';
import { Notes, NoteThreadMutings } from '@/models/index.js'; import { Notes, NoteThreadMutings } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js'; import { genId } from '@/misc/gen-id.js';
import readNote from '@/services/note/read.js'; import readNote from '@/services/note/read.js';
@ -25,6 +26,14 @@ export const paramDef = {
type: 'object', type: 'object',
properties: { properties: {
noteId: { type: 'string', format: 'misskey:id' }, noteId: { type: 'string', format: 'misskey:id' },
mutingNotificationTypes: {
description: 'Defines which notification types from the thread should be muted. Replies are always muted. Applies in addition to the global settings, muting takes precedence.',
type: 'array',
items: {
type: 'string', enum: noteNotificationTypes,
},
uniqueItems: true,
},
}, },
required: ['noteId'], required: ['noteId'],
} as const; } as const;
@ -51,5 +60,6 @@ export default define(meta, paramDef, async (ps, user) => {
createdAt: new Date(), createdAt: new Date(),
threadId: note.threadId || note.id, threadId: note.threadId || note.id,
userId: user.id, userId: user.id,
mutingNotificationTypes: ps.mutingNotificationTypes,
}); });
}); });