From 0f4119b74fe75785f4cf8bfacd79f4db06482d5f Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Sun, 8 Dec 2019 23:47:49 +0000 Subject: [PATCH] submit trust functionality --- webui/src/main/js/search.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/webui/src/main/js/search.js b/webui/src/main/js/search.js index ebe06eaa..5c7052a2 100644 --- a/webui/src/main/js/search.js +++ b/webui/src/main/js/search.js @@ -220,7 +220,7 @@ function markTrusted(host) { } function markNeutral(host) { - publishTrust(host, null, "NEUTRAL") + publishTrust(host, "", "neutral") } function markDistrusted(host) { @@ -240,12 +240,12 @@ function markDistrusted(host) { function submitTrust(host) { var reason = document.getElementById("trust-reason-"+host).value - publishTrust(host, reason, "TRUSTED") + publishTrust(host, reason, "trust") } function submitDistrust(host) { var reason = document.getElementById("trust-reason-"+host).value - publishTrust(host, reason, "DISTRUSTED") + publishTrust(host, reason, "distrust") } function cancelTrust(host) { @@ -267,7 +267,18 @@ function cancelDistrust(host) { } function publishTrust(host, reason, trust) { - + var xmlhttp = new XMLHttpRequest() + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + if (refreshType == "Sender") + refreshGroupBySender(uuid) + else if (refreshType == "File") + refreshGroupByFile(uuid) + } + } + xmlhttp.open("POST","/MuWire/Trust", true) + xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xmlhttp.send("action=" + trust + "&reason=" + reason + "&persona=" + host) } function updateSender(senderName) {