]> source.dussan.org Git - rspamd.git/commitdiff
Fixes greylist form vanish
authorfiredranzer <rupeshharode@gmail.com>
Mon, 5 Mar 2018 15:29:22 +0000 (20:59 +0530)
committerfiredranzer <rupeshharode@gmail.com>
Mon, 5 Mar 2018 15:29:22 +0000 (20:59 +0530)
interface/js/app/config.js

index 3346d3936f8a5a3666b00f4b4892d9080afa81f3..c6d4a9b488056d1c901e3add2fb32b02bfc8a814 100644 (file)
@@ -217,17 +217,31 @@ function($) {
 
                 $('#saveActionsClusterBtn').on('click', function() {
                     var elts = loadActionsFromForm();
-                    rspamd.queryNeighbours('saveactions', null, null, "POST", {}, {
-                        data: elts,
-                        dataType: "json",
-                    });
+                    // String to array for comparison
+                    var eltsArray = JSON.parse(loadActionsFromForm());
+                    if(eltsArray[2]>=0){
+                        rspamd.queryNeighbours('saveactions', null, null, "POST", {}, {
+                            data: elts,
+                            dataType: "json",
+                        });
+                    }
+                    else{
+                        alert("Greylist can not be negative");
+                    }
                 });
                 $('#saveActionsBtn').on('click', function() {
                     var elts = loadActionsFromForm();
-                    rspamd.queryLocal('saveactions', null, null, "POST", {}, {
-                        data: elts,
-                        dataType: "json",
-                    });
+                    // String to array for comparison
+                    var eltsArray = JSON.parse(loadActionsFromForm());
+                    if(eltsArray[2]>=0){
+                        rspamd.queryLocal('saveactions', null, null, "POST", {}, {
+                            data: elts,
+                            dataType: "json",
+                        });
+                    }
+                    else{
+                        alert("Greylist can not be negative");
+                    }
                 });
             },
         });