From 61dbf94f2d8079bcf0fe763f7454df0c8d1426e8 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 22 Feb 2018 15:56:23 +0100 Subject: [PATCH] Fix pad attributes not working for readonly pads if you know the edit hash --- www/common/sframe-common-outer.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 70d1f72ac..260efeda9 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -331,17 +331,27 @@ define([ }); sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) { + var href; + if (readOnly && hashes.editHash) { + // If we have a stronger hash, use it for pad attributes + href = window.location.pathname + '#' + hashes.editHash; + } Cryptpad.getPadAttribute(data.key, function (e, data) { cb({ error: e, data: data }); - }); + }, href); }); sframeChan.on('Q_SET_PAD_ATTRIBUTE', function (data, cb) { + var href; + if (readOnly && hashes.editHash) { + // If we have a stronger hash, use it for pad attributes + href = window.location.pathname + '#' + hashes.editHash; + } Cryptpad.setPadAttribute(data.key, data.value, function (e) { cb({error:e}); - }); + }, href); }); sframeChan.on('Q_GET_ATTRIBUTE', function (data, cb) {