From 37e6f30a575db8f40a1e3e5f8a8f3bd71daf7912 Mon Sep 17 00:00:00 2001 From: maxpozdeev Date: Sat, 5 Nov 2022 20:06:39 +0300 Subject: [PATCH] * do not remember last used list for readonly users (GH-47) --- src/content/mytinytodo.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/content/mytinytodo.js b/src/content/mytinytodo.js index 82ae51b..f8e390e 100644 --- a/src/content/mytinytodo.js +++ b/src/content/mytinytodo.js @@ -764,7 +764,7 @@ var mytinytodo = window.mytinytodo = _mtt = { } else { const lastOpenList = getLocalStorageItem('lastList'); - if (lastOpenList) { + if (lastOpenList && !flag.readOnly) { list = res.list.find( item => !item.hidden && lastOpenList == item.id ); } if (!list) { @@ -1551,7 +1551,9 @@ function tabSelect(elementOrId) var newTitle = curList.name + ' - ' + _mtt.options.title; var isFirstLoad = flag.firstLoad; updateHistoryState( { list:id }, _mtt.urlForList(curList), newTitle ); - setLocalStorageItem('lastList', ''+id); + if (!flag.readOnly) { + setLocalStorageItem('lastList', ''+id); + } if (curList.hidden && flag.readOnly != true) { curList.hidden = false; @@ -2643,6 +2645,7 @@ function doAuth(form) if(json.logged) { flag.isLogged = true; + window.location.hash = ''; window.location.reload(); } else {