From 30743601a9f173d8f2c971de107033770a9de4a3 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 16 May 2019 18:26:35 +0200 Subject: [PATCH] Determine whether user is signed in or not on sidebar --- assets/js/components/sidebar/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/assets/js/components/sidebar/main.js b/assets/js/components/sidebar/main.js index dd747ce3..d89bff44 100644 --- a/assets/js/components/sidebar/main.js +++ b/assets/js/components/sidebar/main.js @@ -226,8 +226,14 @@ ComunicWeb.components.sideBar.main = { onclick: (e) => e.stopImmediatePropagation() }); - if(friend.accepted == 1) - subInfoEl.innerHTML = timeDiffToStr(friend.time_last_activity); + // Check if friendship request has been accepted or not + if(friend.accepted == 1) { + if(ComunicWeb.common.date.time() - friend.time_last_activity < 30) + subInfoEl.innerHTML = "Online"; + else + subInfoEl.innerHTML = timeDiffToStr(friend.time_last_activity); + } + else { const respondRequest = function(accept) {