mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-07-29 01:44:35 +02:00
wip
This commit is contained in:
@@ -13,13 +13,13 @@ import User from '../../models/user';
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'current_password' parameter
|
||||
const [currentPassword, currentPasswordErr] = $(params.current_password).string().$;
|
||||
if (currentPasswordErr) return rej('invalid current_password param');
|
||||
// Get 'currentPasword' parameter
|
||||
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().$;
|
||||
if (currentPasswordErr) return rej('invalid currentPasword param');
|
||||
|
||||
// Get 'new_password' parameter
|
||||
const [newPassword, newPasswordErr] = $(params.new_password).string().$;
|
||||
if (newPasswordErr) return rej('invalid new_password param');
|
||||
// Get 'newPassword' parameter
|
||||
const [newPassword, newPasswordErr] = $(params.newPassword).string().$;
|
||||
if (newPasswordErr) return rej('invalid newPassword param');
|
||||
|
||||
// Compare password
|
||||
const same = await bcrypt.compare(currentPassword, user.account.password);
|
||||
|
||||
@@ -21,9 +21,9 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
$(params.following).optional.boolean().$;
|
||||
if (followingError) return rej('invalid following param');
|
||||
|
||||
// Get 'mark_as_read' parameter
|
||||
const [markAsRead = true, markAsReadErr] = $(params.mark_as_read).optional.boolean().$;
|
||||
if (markAsReadErr) return rej('invalid mark_as_read param');
|
||||
// Get 'markAsRead' parameter
|
||||
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().$;
|
||||
if (markAsReadErr) return rej('invalid markAsRead param');
|
||||
|
||||
// Get 'type' parameter
|
||||
const [type, typeErr] = $(params.type).optional.array('string').unique().$;
|
||||
@@ -33,17 +33,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'since_id' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid since_id param');
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'until_id' parameter
|
||||
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid until_id param');
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of since_id and until_id is specified
|
||||
// Check if both of sinceId and untilId is specified
|
||||
if (sinceId && untilId) {
|
||||
return rej('cannot set since_id and until_id');
|
||||
return rej('cannot set sinceId and untilId');
|
||||
}
|
||||
|
||||
const mute = await Mute.find({
|
||||
|
||||
@@ -16,17 +16,17 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).$;
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'since_id' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.since_id).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid since_id param');
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.id().$;
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'until_id' parameter
|
||||
const [untilId, untilIdErr] = $(params.until_id).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid until_id param');
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.id().$;
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of since_id and until_id is specified
|
||||
// Check if both of sinceId and untilId is specified
|
||||
if (sinceId && untilId) {
|
||||
return rej('cannot set since_id and until_id');
|
||||
return rej('cannot set sinceId and untilId');
|
||||
}
|
||||
|
||||
const query = {
|
||||
|
||||
@@ -51,10 +51,10 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
|
||||
if (isBotErr) return rej('invalid isBot param');
|
||||
if (isBot != null) user.account.isBot = isBot;
|
||||
|
||||
// Get 'auto_watch' parameter
|
||||
const [autoWatch, autoWatchErr] = $(params.auto_watch).optional.boolean().$;
|
||||
if (autoWatchErr) return rej('invalid auto_watch param');
|
||||
if (autoWatch != null) user.account.settings.auto_watch = autoWatch;
|
||||
// Get 'autoWatch' parameter
|
||||
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().$;
|
||||
if (autoWatchErr) return rej('invalid autoWatch param');
|
||||
if (autoWatch != null) user.account.settings.autoWatch = autoWatch;
|
||||
|
||||
await User.update(user._id, {
|
||||
$set: {
|
||||
|
||||
Reference in New Issue
Block a user