@zenginehq/frontend-config
Advanced tools
Comparing version 3.17.0 to 3.17.1
{ | ||
"name": "@zenginehq/frontend-config", | ||
"version": "3.17.0", | ||
"version": "3.17.1", | ||
"description": "Helper module for implementing Zengine plugin configuration forms.", | ||
@@ -28,5 +28,5 @@ "scripts": { | ||
"jshint": "^2.9.6", | ||
"node-sass": "^4.9.3", | ||
"node-sass": "^4.13.0", | ||
"standard-version": "^4.4.0" | ||
} | ||
} |
@@ -213,5 +213,6 @@ plugin.controller('wgnConfigCtrl', ['$scope', '$q', '$routeParams', 'znData', 'znModal', 'znMessage', 'wgnConfigSrv', | ||
$scope.editing.config.enabled = false; | ||
var stateChange = true; | ||
return doRunHook('disable', $scope.editing.config).finally(function () { | ||
return doSaveConfig($scope.editing.config).then(function () { | ||
return doSaveConfig($scope.editing.config, stateChange).then(function () { | ||
return _webhook | ||
@@ -241,5 +242,6 @@ ? Array.isArray(_webhook.options) | ||
$scope.editing.config.enabled = true; | ||
var stateChange = true; | ||
return doRunHook('enable', $scope.editing.config).finally(function () { | ||
return doSaveConfig($scope.editing.config).then(function () { | ||
return doSaveConfig($scope.editing.config, stateChange).then(function () { | ||
return _webhook | ||
@@ -502,5 +504,7 @@ ? Array.isArray(_webhook.options) | ||
$scope.onConfigToggle = function (config) { | ||
var stateChange = true; | ||
if (config.enabled) { | ||
doRunHook('enable', config).finally(function () { | ||
return doSaveConfig(config).then(function () { | ||
return doSaveConfig(config, stateChange).then(function () { | ||
znMessage('Configuration ' + config.name + ' enabled!', 'saved'); | ||
@@ -518,3 +522,3 @@ return _webhook | ||
doRunHook('disable', config).finally(function () { | ||
return doSaveConfig(config).then(function () { | ||
return doSaveConfig(config, stateChange).then(function () { | ||
znMessage('Configuration ' + config.name + ' disabled!', 'saved'); | ||
@@ -887,7 +891,7 @@ return _webhook | ||
*/ | ||
function doSaveConfig (config) { | ||
function doSaveConfig (config, stateChange) { | ||
var promise = $q.when(config); | ||
var multiWebhooks = _webhook && Array.isArray(_webhook.options); | ||
if (_webhook && !('webhookId' in config || 'webhook0Id' in config)) { | ||
if (_webhook && !stateChange) { | ||
var options = multiWebhooks | ||
@@ -899,2 +903,10 @@ ? _webhook.options.map(function (opts) { | ||
var webhookStatus = $scope.editing.config.enabled; | ||
var hasWebhookStatus = false; | ||
if ('webhookId' in config || 'webhook0Id' in config) { | ||
hasWebhookStatus = true; | ||
_webhook.service.delete(config.webhookId); | ||
} | ||
if (multiWebhooks) { | ||
@@ -908,2 +920,7 @@ promise = $q.all(options.map(function (opts) { | ||
// if there was already a webhook in the settings, keep the status | ||
if (hasWebhookStatus) { | ||
opts['isActive'] = webhookStatus; | ||
} | ||
if (opts.filter) { | ||
@@ -933,2 +950,7 @@ opts.filter = reconstructFilter(opts.filter, config); | ||
// if there was already a webhook in the settings, keep the status | ||
if (hasWebhookStatus) { | ||
options['isActive'] = webhookStatus; | ||
} | ||
if (options.filter) { | ||
@@ -950,3 +972,4 @@ options.filter = reconstructFilter(options.filter, config); | ||
} else if ( | ||
_webhook && ( | ||
_webhook && | ||
!stateChange && ( | ||
_webhook.options.filter || Array.isArray(_webhook.options) && _webhook.options.some(function (opts) { | ||
@@ -953,0 +976,0 @@ return opts.filter; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
311473
2298