From d568eb0290549696fb060dbf0506db559c87724a Mon Sep 17 00:00:00 2001 From: webplusai Date: Tue, 24 Dec 2024 09:21:57 +0000 Subject: [PATCH] #8856 fix profile button rendering for guest users --- .../multiwikiserver/modules/routes/handlers/get-index.js | 1 + .../multiwikiserver/modules/routes/handlers/manage-user.js | 1 + plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js index 5dd58ffb66c..47aadda254d 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/get-index.js @@ -51,6 +51,7 @@ exports.handler = function(request,response,state) { "first-guest-user": state.firstGuestUser ? "yes" : "no", "show-anon-config": state.showAnonConfig ? "yes" : "no", "user": JSON.stringify(state.authenticatedUser), + "has-profile-access": !!state.authenticatedUser ? "yes" : "no" }}); response.write(html); response.end(); diff --git a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js index 89617aa5c09..5b1ecc383db 100644 --- a/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js +++ b/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/manage-user.js @@ -91,6 +91,7 @@ exports.handler = function(request,response,state) { "username": state.authenticatedUser ? state.authenticatedUser.username : state.firstGuestUser ? "Anonymous User" : "Guest", "user-is-admin": state.authenticatedUser && state.authenticatedUser.isAdmin ? "yes" : "no", "user-id": user_id, + "has-profile-access": !!state.authenticatedUser ? "yes" : "no" } }); response.write(html); diff --git a/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid b/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid index c9e72510755..0d45a2f5f31 100644 --- a/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid +++ b/plugins/tiddlywiki/multiwikiserver/templates/mws-header.tid @@ -27,7 +27,7 @@ title: $:/plugins/tiddlywiki/multiwikiserver/templates/mws-header - <% elseif [!match[Guest]]+[match[no]] %> + <% elseif [match[yes]] %> <$set name="userId" value={{{ [jsonget[user_id]] }}}> addprefix[/admin/users/]] }}}>