Pin images included in the spreadsheets
This commit is contained in:
@@ -88,6 +88,32 @@ define([
|
||||
}, cb);
|
||||
});
|
||||
});
|
||||
sframeChan.on('EV_OO_PIN_IMAGES', function (list) {
|
||||
Cryptpad.getPadAttribute('ooImages', function (err, res) {
|
||||
if (err) { return; }
|
||||
if (!res || !Array.isArray(res)) { res = []; }
|
||||
var toPin = [];
|
||||
var toUnpin = [];
|
||||
res.forEach(function (id) {
|
||||
if (list.indexOf(id) === -1) {
|
||||
toUnpin.push(id);
|
||||
}
|
||||
});
|
||||
list.forEach(function (id) {
|
||||
if (res.indexOf(id) === -1) {
|
||||
toPin.push(id);
|
||||
}
|
||||
});
|
||||
toPin = Utils.Util.deduplicateString(toPin);
|
||||
toUnpin = Utils.Util.deduplicateString(toUnpin);
|
||||
Cryptpad.pinPads(toPin, function () {});
|
||||
Cryptpad.unpinPads(toUnpin, function () {});
|
||||
if (!toPin.length && !toUnpin.length) { return; }
|
||||
Cryptpad.setPadAttribute('ooImages', list, function (err) {
|
||||
if (err) { console.error(err); }
|
||||
});
|
||||
});
|
||||
});
|
||||
sframeChan.on('Q_OO_COMMAND', function (obj, cb) {
|
||||
if (obj.cmd === 'SEND_MESSAGE') {
|
||||
obj.data.msg = Utils.crypto.encrypt(JSON.stringify(obj.data.msg));
|
||||
|
||||
Reference in New Issue
Block a user