From: firedranzer Date: Tue, 6 Mar 2018 20:43:09 +0000 (+0530) Subject: Refactores code and added order of actions X-Git-Tag: 1.7.0~54^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=46334417c2915535c802727abf0abc12b1dda705;p=rspamd.git Refactores code and added order of actions --- diff --git a/interface/js/app/config.js b/interface/js/app/config.js index 3af4005d0..ec36dce48 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -215,51 +215,35 @@ function($) { $('#actionsFormField').attr('disabled', true); } - $('#saveActionsClusterBtn').on('click', function() { + function saveActions(callback) { var elts = loadActionsFromForm(); // String to array for comparison var eltsArray = JSON.parse(loadActionsFromForm()); - if(eltsArray[0]>=0 && eltsArray[1]>=0 && eltsArray[2]>=0){ - rspamd.queryNeighbours('saveactions', null, null, "POST", {}, { - data: elts, - dataType: "json", - }); + if(eltsArray[0]<0){ + rspamd.alertMessage('alert-modal alert-error', 'Spam can not be negative'); } - else{ - if(eltsArray[0]<0){ - rspamd.alertMessage('alert-modal alert-error', 'spam can not be negative'); - } - else if(eltsArray[1]<0){ - rspamd.alertMessage('alert-modal alert-error', 'probable_spam can not be negative'); - } - else if(eltsArray[2]<0){ - rspamd.alertMessage('alert-modal alert-error', 'greylist can not be negative'); - } - + else if(eltsArray[1]<0){ + rspamd.alertMessage('alert-modal alert-error', 'Probable spam can not be negative'); } - }); - $('#saveActionsBtn').on('click', function() { - var elts = loadActionsFromForm(); - // String to array for comparison - var eltsArray = JSON.parse(loadActionsFromForm()); - if(eltsArray[0]>=0 && eltsArray[1]>=0 && eltsArray[2]>=0){ - rspamd.queryLocal('saveactions', null, null, "POST", {}, { + else if(eltsArray[2]<0){ + rspamd.alertMessage('alert-modal alert-error', 'Greylist can not be negative'); + } + else if(eltsArray[2]