cafy 5.xに移行
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { INote, isValidText, isValidCw, pack } from '../../../../models/note';
 | 
			
		||||
import { ILocalUser } from '../../../../models/user';
 | 
			
		||||
import Channel, { IChannel } from '../../../../models/channel';
 | 
			
		||||
@@ -11,11 +11,6 @@ import { IApp } from '../../../../models/app';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a note
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @param {any} app
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'visibility' parameter
 | 
			
		||||
@@ -35,11 +30,11 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	if (viaMobileErr) return rej('invalid viaMobile');
 | 
			
		||||
 | 
			
		||||
	// Get 'tags' parameter
 | 
			
		||||
	const [tags = [], tagsErr] = $(params.tags).optional.array('string').unique().eachQ(t => t.range(1, 32)).$;
 | 
			
		||||
	const [tags = [], tagsErr] = $(params.tags).optional.array($().string().range(1, 32)).unique().$;
 | 
			
		||||
	if (tagsErr) return rej('invalid tags');
 | 
			
		||||
 | 
			
		||||
	// Get 'geo' parameter
 | 
			
		||||
	const [geo, geoErr] = $(params.geo).optional.nullable.strict.object()
 | 
			
		||||
	const [geo, geoErr] = $(params.geo).optional.nullable.object(true)
 | 
			
		||||
		.have('coordinates', $().array().length(2)
 | 
			
		||||
			.item(0, $().number().range(-180, 180))
 | 
			
		||||
			.item(1, $().number().range(-90, 90)))
 | 
			
		||||
@@ -52,7 +47,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	if (geoErr) return rej('invalid geo');
 | 
			
		||||
 | 
			
		||||
	// Get 'mediaIds' parameter
 | 
			
		||||
	const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array('id').unique().range(1, 4).$;
 | 
			
		||||
	const [mediaIds, mediaIdsErr] = $(params.mediaIds).optional.array($().type(ID)).unique().range(1, 4).$;
 | 
			
		||||
	if (mediaIdsErr) return rej('invalid mediaIds');
 | 
			
		||||
 | 
			
		||||
	let files = [];
 | 
			
		||||
@@ -79,7 +74,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get 'renoteId' parameter
 | 
			
		||||
	const [renoteId, renoteIdErr] = $(params.renoteId).optional.id().$;
 | 
			
		||||
	const [renoteId, renoteIdErr] = $(params.renoteId).optional.type(ID).$;
 | 
			
		||||
	if (renoteIdErr) return rej('invalid renoteId');
 | 
			
		||||
 | 
			
		||||
	let renote: INote = null;
 | 
			
		||||
@@ -100,7 +95,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get 'replyId' parameter
 | 
			
		||||
	const [replyId, replyIdErr] = $(params.replyId).optional.id().$;
 | 
			
		||||
	const [replyId, replyIdErr] = $(params.replyId).optional.type(ID).$;
 | 
			
		||||
	if (replyIdErr) return rej('invalid replyId');
 | 
			
		||||
 | 
			
		||||
	let reply: INote = null;
 | 
			
		||||
@@ -121,7 +116,7 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get 'channelId' parameter
 | 
			
		||||
	const [channelId, channelIdErr] = $(params.channelId).optional.id().$;
 | 
			
		||||
	const [channelId, channelIdErr] = $(params.channelId).optional.type(ID).$;
 | 
			
		||||
	if (channelIdErr) return rej('invalid channelId');
 | 
			
		||||
 | 
			
		||||
	let channel: IChannel = null;
 | 
			
		||||
@@ -162,8 +157,8 @@ module.exports = (params, user: ILocalUser, app: IApp) => new Promise(async (res
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get 'poll' parameter
 | 
			
		||||
	const [poll, pollErr] = $(params.poll).optional.strict.object()
 | 
			
		||||
		.have('choices', $().array('string')
 | 
			
		||||
	const [poll, pollErr] = $(params.poll).optional.object(true)
 | 
			
		||||
		.have('choices', $().array($().string())
 | 
			
		||||
			.unique()
 | 
			
		||||
			.range(2, 10)
 | 
			
		||||
			.each(c => c.length > 0 && c.length < 50))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,16 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
 | 
			
		||||
import Favorite from '../../../../../models/favorite';
 | 
			
		||||
import Note from '../../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Favorite a note
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get favoritee
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,16 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
 | 
			
		||||
import Favorite from '../../../../../models/favorite';
 | 
			
		||||
import Note from '../../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Unfavorite a note
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get favoritee
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import Mute from '../../../../models/mute';
 | 
			
		||||
import { pack } from '../../../../models/note';
 | 
			
		||||
@@ -15,11 +15,11 @@ module.exports = async (params, user, app) => {
 | 
			
		||||
	if (limitErr) throw 'invalid limit param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
 | 
			
		||||
	if (sinceIdErr) throw 'invalid sinceId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
 | 
			
		||||
	if (untilIdErr) throw 'invalid untilId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceDate' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import Mute from '../../../../models/mute';
 | 
			
		||||
import { pack } from '../../../../models/note';
 | 
			
		||||
@@ -15,11 +15,11 @@ module.exports = async (params, user, app) => {
 | 
			
		||||
	if (limitErr) throw 'invalid limit param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
 | 
			
		||||
	if (sinceIdErr) throw 'invalid sinceId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
 | 
			
		||||
	if (untilIdErr) throw 'invalid untilId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceDate' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import { getFriendIds } from '../../common/get-friends';
 | 
			
		||||
import { pack } from '../../../../models/note';
 | 
			
		||||
@@ -24,11 +24,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	if (limitErr) return rej('invalid limit param');
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
 | 
			
		||||
	if (sinceIdErr) return rej('invalid sinceId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
 | 
			
		||||
	if (untilIdErr) return rej('invalid untilId param');
 | 
			
		||||
 | 
			
		||||
	// Check if both of sinceId and untilId is specified
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,6 @@ import Note, { pack } from '../../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get recommended polls
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
 | 
			
		||||
import Vote from '../../../../../models/poll-vote';
 | 
			
		||||
import Note from '../../../../../models/note';
 | 
			
		||||
import Watching from '../../../../../models/note-watching';
 | 
			
		||||
@@ -11,14 +11,10 @@ import notify from '../../../../../publishers/notify';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Vote poll of a note
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get votee
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import Reaction, { pack } from '../../../../models/note-reaction';
 | 
			
		||||
 | 
			
		||||
@@ -14,7 +14,7 @@ import Reaction, { pack } from '../../../../models/note-reaction';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../../models/note';
 | 
			
		||||
import create from '../../../../../services/note/reaction/create';
 | 
			
		||||
import { validateReaction } from '../../../../../models/note-reaction';
 | 
			
		||||
@@ -11,7 +11,7 @@ import { validateReaction } from '../../../../../models/note-reaction';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'reaction' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,16 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
 | 
			
		||||
import Reaction from '../../../../../models/note-reaction';
 | 
			
		||||
import Note from '../../../../../models/note';
 | 
			
		||||
// import event from '../../../publishers/stream';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Unreact to a note
 | 
			
		||||
 *
 | 
			
		||||
 * @param {any} params
 | 
			
		||||
 * @param {any} user
 | 
			
		||||
 * @return {Promise<any>}
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Fetch unreactee
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'limit' parameter
 | 
			
		||||
@@ -21,11 +21,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	if (limitErr) return rej('invalid limit param');
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
 | 
			
		||||
	if (sinceIdErr) return rej('invalid sinceId param');
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
 | 
			
		||||
	if (untilIdErr) return rej('invalid untilId param');
 | 
			
		||||
 | 
			
		||||
	// Check if both of sinceId and untilId is specified
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
const escapeRegexp = require('escape-regexp');
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import User from '../../../../models/user';
 | 
			
		||||
@@ -22,19 +22,19 @@ module.exports = (params, me) => new Promise(async (res, rej) => {
 | 
			
		||||
	if (textError) return rej('invalid text param');
 | 
			
		||||
 | 
			
		||||
	// Get 'includeUserIds' parameter
 | 
			
		||||
	const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array('id').$;
 | 
			
		||||
	const [includeUserIds = [], includeUserIdsErr] = $(params.includeUserIds).optional.array($().type(ID)).$;
 | 
			
		||||
	if (includeUserIdsErr) return rej('invalid includeUserIds param');
 | 
			
		||||
 | 
			
		||||
	// Get 'excludeUserIds' parameter
 | 
			
		||||
	const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array('id').$;
 | 
			
		||||
	const [excludeUserIds = [], excludeUserIdsErr] = $(params.excludeUserIds).optional.array($().type(ID)).$;
 | 
			
		||||
	if (excludeUserIdsErr) return rej('invalid excludeUserIds param');
 | 
			
		||||
 | 
			
		||||
	// Get 'includeUserUsernames' parameter
 | 
			
		||||
	const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array('string').$;
 | 
			
		||||
	const [includeUserUsernames = [], includeUserUsernamesErr] = $(params.includeUserUsernames).optional.array($().string()).$;
 | 
			
		||||
	if (includeUserUsernamesErr) return rej('invalid includeUserUsernames param');
 | 
			
		||||
 | 
			
		||||
	// Get 'excludeUserUsernames' parameter
 | 
			
		||||
	const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array('string').$;
 | 
			
		||||
	const [excludeUserUsernames = [], excludeUserUsernamesErr] = $(params.excludeUserUsernames).optional.array($().string()).$;
 | 
			
		||||
	if (excludeUserUsernamesErr) return rej('invalid excludeUserUsernames param');
 | 
			
		||||
 | 
			
		||||
	// Get 'following' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -13,7 +13,7 @@ import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 */
 | 
			
		||||
module.exports = (params, user) => new Promise(async (res, rej) => {
 | 
			
		||||
	// Get 'noteId' parameter
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).id().$;
 | 
			
		||||
	const [noteId, noteIdErr] = $(params.noteId).type(ID).$;
 | 
			
		||||
	if (noteIdErr) return rej('invalid noteId param');
 | 
			
		||||
 | 
			
		||||
	// Get note
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note from '../../../../models/note';
 | 
			
		||||
import Mute from '../../../../models/mute';
 | 
			
		||||
import ChannelWatching from '../../../../models/channel-watching';
 | 
			
		||||
@@ -17,11 +17,11 @@ module.exports = async (params, user, app) => {
 | 
			
		||||
	if (limitErr) throw 'invalid limit param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceId' parameter
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
 | 
			
		||||
	const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).$;
 | 
			
		||||
	if (sinceIdErr) throw 'invalid sinceId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'untilId' parameter
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
 | 
			
		||||
	const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).$;
 | 
			
		||||
	if (untilIdErr) throw 'invalid untilId param';
 | 
			
		||||
 | 
			
		||||
	// Get 'sinceDate' parameter
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * Module dependencies
 | 
			
		||||
 */
 | 
			
		||||
const ms = require('ms');
 | 
			
		||||
import $ from 'cafy';
 | 
			
		||||
import $ from 'cafy'; import ID from '../../../../cafy-id';
 | 
			
		||||
import Note, { pack } from '../../../../models/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user