From ea11b982ce6d73485a912a50814bbd523396e539 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= <sijanecantonluka@gmail.com>
Date: Sat, 8 Feb 2020 22:28:00 +0100
Subject: always check if it works before commiting

---
 js/messaging.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'js')

diff --git a/js/messaging.js b/js/messaging.js
index 9ae0b99..f275829 100644
--- a/js/messaging.js
+++ b/js/messaging.js
@@ -12,10 +12,6 @@ const API_ENDPOINT = "https://gimb.tk/test.php";
 // const API_ENDPOINT = "http://localhost:5000/test.php";
 
 var receivedmessages = null;
-if(window.location.search.substring(1)) {
-	document.getElementById("full_name").value = window.location.search.substring(1);
-	validateName();
-}
 loadMessages(true, 0);
 
 localforage.setItem('directory', {
@@ -289,7 +285,11 @@ function validateName() {
 		    M.toast({ html: "Unable to read directory of people. Unable to autocomplete the name of the person."});
 		    console.log(err);
 		});
-
+	if(window.location.search.substring(1)) {
+		document.getElementById("full_name").value = decodeURIComponent(window.location.search.substring(1));
+		M.updateTextFields();
+		validateName();
+	}
 	document.getElementById("full_name").addEventListener("blur", validateName);
 	document.getElementById("msg_send").addEventListener("click", function() {
 		localforage.getItem('directory').then(function(value) {
-- 
cgit v1.2.3