From cb700501eb6aaf74b75ca62ce128cd5864bbe7b3 Mon Sep 17 00:00:00 2001 From: Jhonatan Cruz Date: Sat, 13 Apr 2019 23:51:53 -0400 Subject: [PATCH] hide chat thread Id, and username of user --- views/chat.hbs | 47 +++++++---------------------------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/views/chat.hbs b/views/chat.hbs index 841cf4b3..d7b13557 100644 --- a/views/chat.hbs +++ b/views/chat.hbs @@ -149,7 +149,7 @@ img{ max-width:100%;}
sunil
- +
{{this.selectedPersonSelling}} Dec 25

Item: {{this.selectedPostTitle}}

@@ -161,12 +161,11 @@ img{ max-width:100%;}
- +
-
@@ -198,8 +197,8 @@ img{ max-width:100%;} $('input[type="radio"]').click(function(){ var threadId = $("input[type='radio']:checked"). val() console.log("Radio Button Selected", threadId); + $("#chatroom").empty(); sendInfoForMessages(threadId); - // getMessages(); }) }) @@ -229,7 +228,10 @@ img{ max-width:100%;} var messagesArray= message[0].messages; var i; for (i in messagesArray) { - $("#chatroom").append("

"+JSON.stringify(messagesArray[i])+"

"); + console.log(JSON.stringify(messagesArray[i])); + message= JSON.stringify(messagesArray[i].message); + byWho = JSON.stringify(messagesArray[i].byWho); + $("#chatroom").append("

"+eval(byWho)+": "+eval(message)+"

"); } $("#message").val(" "); @@ -238,43 +240,8 @@ img{ max-width:100%;} function sendInfoForMessages(threadId){ console.log("Inside getMessages:",threadId); var xhttp = new XMLHttpRequest(); - // xhttp.onreadystatechange = function() { - // if (xhttp.readyState == XMLHttpRequest.DONE) { - // response= xhttp.responseText - // alert(response); - // - // } - // } xhttp.open('POST', '/chat/messages/getInfo', true); xhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xhttp.send('threadId='+threadId); } - - - // function getMessages(){ - // var xhttp = new XMLHttpRequest(); - // xhttp.onreadystatechange = function() { - // if (xhttp.readyState == XMLHttpRequest.DONE) { - // response= xhttp.responseText - // alert(response); - // // addMessages(response); - // } - // } - // xhttp.open('GET', '/chat/messages/getInfo', true); - // xhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - // xhttp.send(); - // } - - // xhttp.open("POST", "/chat/messages/getInfo", true); - // xhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - // xhttp.send("threadId="+threadId); - // xhttp.onreadystatechange = function() { - // if (xhttp.readyState == XMLHttpRequest.DONE) { - // response= xhttp.responseText - // alert(response); - // // addMessages(response); - // } - // } - -