mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
resolving conflicts
This commit is contained in:
@@ -2,16 +2,16 @@ import refPush from '../libs/refPush';
|
||||
import validator from 'validator';
|
||||
import i18n from '../i18n';
|
||||
import {
|
||||
NotFound,
|
||||
BadRequest,
|
||||
} from '../libs/errors';
|
||||
import _ from 'lodash';
|
||||
|
||||
module.exports = function(user, req) {
|
||||
var wh;
|
||||
module.exports = function addWebhook (user, req = {}) {
|
||||
let wh;
|
||||
wh = user.preferences.webhooks;
|
||||
|
||||
if(!validator.isURL(req.body.url)) throw new BadRequest(i18n.t('invalidUrl', req.language));
|
||||
if(!validator.isBoolean(req.body.enabled)) throw new BadRequest(i18n.t('invalidEnabled', req.language));
|
||||
if (!validator.isURL(_.get(req, 'body.url'))) throw new BadRequest(i18n.t('invalidUrl', req.language));
|
||||
if (!validator.isBoolean(_.get(req, 'body.enabled'))) throw new BadRequest(i18n.t('invalidEnabled', req.language));
|
||||
|
||||
user.markModified('preferences.webhooks');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user