]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix fuzzy adding in webui
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 16 Jul 2016 22:53:07 +0000 (23:53 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 16 Jul 2016 22:53:07 +0000 (23:53 +0100)
interface/js/rspamd.js

index c7e4840eebb4135ee1af0073627a2d74811fadd4..6d6a7c5c5460c7fa1d7873bf8372d18f5e1f454a 100644 (file)
         });
 
         // @upload text
-        function uploadText(data, source) {
+        function uploadText(data, source, headers) {
             if (source === 'spam') {
                 var url = 'learnspam';
             }
                 var url = 'learnham';
             }
             else if (source == 'fuzzy') {
-                var url = 'learnfuzzy';
+                var url = 'fuzzyadd';
             }
             else if (source === 'scan') {
                 var url = 'scan';
                 url: url,
                 beforeSend: function (xhr) {
                     xhr.setRequestHeader('Password', getPassword());
+                    $.each(headers, function (name, value) {
+                        xhr.setRequestHeader(name, value);
+                    });
                 },
                 success: function (data) {
                     cleanTextUpload(source);
         $('[data-upload]').on('click', function () {
             var source = $(this).data('upload');
             var data;
+            var headers = {};
+            data = $('#' + source + 'TextSource').val();
             if (source == 'fuzzy') {
                 //To access the proper
-                data = new String($('#' + source + 'TextSource').val());
-                data.flag = $('#fuzzyFlagText').val();
-                data.weigth = $('#fuzzyWeightText').val();
-                data.string = data.toString();
+                headers.flag = $('#fuzzyFlagText').val();
+                headers.weigth = $('#fuzzyWeightText').val();
             }
             else {
                 data = $('#' + source + 'TextSource').val();
                     scanText(data);
                 }
                 else {
-                    uploadText(data, source);
+                    uploadText(data, source, headers);
                 }
             }
             return false;