From b480416375d290fa7d89246f7644c29141cdf189 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 15 Mar 2020 10:52:58 +0000 Subject: [PATCH] toolbar: the "star" button no longer disappears when visiting a read-only pad Before this patch, visiting the read-only URL for a random pad would remove the "Save Revision" (the "star" icon) from all the other RW pads. The only way to make it appear again was to restart the server. This change does not fix the underlying bug: after visiting a read only link the "star" button would still disapper, but it is explictly reinserted via an ad-hoc condition. Fixes #3702 --- src/node/utils/toolbar.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js index 2fa9dcf8b..f2dfbb351 100644 --- a/src/node/utils/toolbar.js +++ b/src/node/utils/toolbar.js @@ -260,6 +260,19 @@ module.exports = { // Remove Save Revision from the right menu removeItem(buttons[0],"savedrevision"); } + }else{ + /* This pad is not read only + * + * Readd the savedrevision button (the "star") if is not already there. + * + * This is a quick fix for #3702: it was sufficient to visit a single read + * only pad to cause the disappearence of the star button from all the + * pads. + */ + if(buttons[0].indexOf("savedrevision") === -1){ + // Add item back in for savedrevision + buttons[0].push("savedrevision"); + } } var groups = _.map(buttons, function (group) {