feat: 時限ミュート

#7677
This commit is contained in:
syuilo
2022-03-04 20:23:53 +09:00
parent 82f9d5501b
commit e68278f93e
12 changed files with 116 additions and 6 deletions

View File

@ -38,6 +38,7 @@ export const paramDef = {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
expiresAt: { type: 'integer', nullable: true },
},
required: ['userId'],
} as const;
@ -67,10 +68,15 @@ export default define(meta, paramDef, async (ps, user) => {
throw new ApiError(meta.errors.alreadyMuting);
}
if (ps.expiresAt && ps.expiresAt <= Date.now()) {
return;
}
// Create mute
await Mutings.insert({
id: genId(),
createdAt: new Date(),
expiresAt: ps.expiresAt ? new Date(ps.expiresAt) : null,
muterId: muter.id,
muteeId: mutee.id,
} as Muting);