From 02bb99ac029e8fc12aec384717341f603052d7c0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 23 Apr 2018 15:27:01 +0900 Subject: 他のMisskeyインスタンスにリアクション情報を伝えるように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/api/endpoints/notes/reactions/create.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'src/server/api/endpoints') diff --git a/src/server/api/endpoints/notes/reactions/create.ts b/src/server/api/endpoints/notes/reactions/create.ts index c80c5416b1..9e217cc3e0 100644 --- a/src/server/api/endpoints/notes/reactions/create.ts +++ b/src/server/api/endpoints/notes/reactions/create.ts @@ -4,6 +4,7 @@ import $ from 'cafy'; import Note from '../../../../../models/note'; import create from '../../../../../services/note/reaction/create'; +import { validateReaction } from '../../../../../models/note-reaction'; /** * React to a note @@ -14,17 +15,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => { if (noteIdErr) return rej('invalid noteId param'); // Get 'reaction' parameter - const [reaction, reactionErr] = $(params.reaction).string().or([ - 'like', - 'love', - 'laugh', - 'hmm', - 'surprise', - 'congrats', - 'angry', - 'confused', - 'pudding' - ]).$; + const [reaction, reactionErr] = $(params.reaction).string().pipe(validateReaction.ok).$; if (reactionErr) return rej('invalid reaction param'); // Fetch reactee -- cgit v1.2.3-freya