Fix pad attributes not working for readonly pads if you know the edit hash

This commit is contained in:
yflory
2018-02-22 15:56:23 +01:00
parent 7ff9bbe2b0
commit 61dbf94f2d

View File

@@ -331,17 +331,27 @@ define([
}); });
sframeChan.on('Q_GET_PAD_ATTRIBUTE', function (data, cb) { 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) { Cryptpad.getPadAttribute(data.key, function (e, data) {
cb({ cb({
error: e, error: e,
data: data data: data
}); });
}); }, href);
}); });
sframeChan.on('Q_SET_PAD_ATTRIBUTE', function (data, cb) { 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) { Cryptpad.setPadAttribute(data.key, data.value, function (e) {
cb({error:e}); cb({error:e});
}); }, href);
}); });
sframeChan.on('Q_GET_ATTRIBUTE', function (data, cb) { sframeChan.on('Q_GET_ATTRIBUTE', function (data, cb) {