From f47d8b610d9a737dcbdb6f262923ff457071e3c8 Mon Sep 17 00:00:00 2001 From: dewanakl Date: Sat, 5 Oct 2024 21:46:22 +0700 Subject: [PATCH] fix: persistent presence --- js/admin.js | 1 - js/comment.js | 7 ++++++- js/guest.js | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/admin.js b/js/admin.js index 10bcdd8..9954641 100644 --- a/js/admin.js +++ b/js/admin.js @@ -212,7 +212,6 @@ export const admin = (() => { } if (!session.isAdmin() || (JSON.parse(atob((session.getToken() ?? '.').split('.')[1])).exp ?? 0) < ((new Date()).getTime() / 1000)) { - comment.renderLoading(); (new bootstrap.Modal('#loginModal')).show(); return; } diff --git a/js/comment.js b/js/comment.js index ac26ad9..26577a4 100644 --- a/js/comment.js +++ b/js/comment.js @@ -124,6 +124,12 @@ export const comment = (() => { document.getElementById(`inner-${id}`).remove(); document.getElementById(`content-${id}`).innerHTML = card.convertMarkdownToHTML(util.escapeHtml(form.value)); + const formPresence = document.getElementById('form-presence'); + if (presence) { + formPresence.value = isPresent ? "1" : "2"; + storage('information').set('presence', isPresent); + } + if (!presence || !badge) { return; } @@ -428,6 +434,5 @@ export const comment = (() => { update, comment, showOrHide, - renderLoading: card.renderLoading, } })(); \ No newline at end of file diff --git a/js/guest.js b/js/guest.js index 3e1f743..9aa040c 100644 --- a/js/guest.js +++ b/js/guest.js @@ -109,7 +109,6 @@ export const guest = (() => { }; const init = () => { - if (session.isAdmin()) { storage('user').clear(); storage('owns').clear();