mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
wip: split shared ops
This commit is contained in:
15
common/script/ops/addWebhook.js
Normal file
15
common/script/ops/addWebhook.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import refPush from '../libs/refPush';
|
||||
|
||||
module.exports = function(user, req, cb) {
|
||||
var wh;
|
||||
wh = user.preferences.webhooks;
|
||||
api.refPush(wh, {
|
||||
url: req.body.url,
|
||||
enabled: req.body.enabled || true,
|
||||
id: req.body.id
|
||||
});
|
||||
if (typeof user.markModified === "function") {
|
||||
user.markModified('preferences.webhooks');
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, user.preferences.webhooks) : void 0;
|
||||
};
|
||||
Reference in New Issue
Block a user