Fix pad not stored in drive when accepting ownership

This commit is contained in:
yflory
2019-09-10 15:30:36 +02:00
parent 16549f40bb
commit 7e238245e6

View File

@@ -856,10 +856,17 @@ define([
pad.href = href; pad.href = href;
}); });
// Add the pad if it does not exist in our drive // If we've just accepted ownership for a pad stored in a shared folder,
if (!contains) { // we need to make a copy of this pad in our drive. We're going to check
var autoStore = Util.find(store.proxy, ['settings', 'general', 'autostore']); // the pad is owned by us BUT is not stored in our main drive
var inMyDrive = datas.some(function (obj) {
return !obj.fId;
});
var ownedByMe = Array.isArray(owners) && owners.indexOf(store.proxy.edPublic) !== -1; var ownedByMe = Array.isArray(owners) && owners.indexOf(store.proxy.edPublic) !== -1;
// Add the pad if it does not exist in our drive
if (!contains || (ownedByMe && !inMyDrive)) {
var autoStore = Util.find(store.proxy, ['settings', 'general', 'autostore']);
if (autoStore !== 1 && !data.forceSave && !data.path && !ownedByMe) { if (autoStore !== 1 && !data.forceSave && !data.path && !ownedByMe) {
// send event to inner to display the corner popup // send event to inner to display the corner popup
postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", { postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", {