Fix 'store in cryptdrive' displayed when creating a pad from the drive

pull/1/head
yflory 3 years ago
parent ac7409f7ef
commit afa799867a

@ -1170,7 +1170,7 @@ define([
// If it is stored, update its data, otherwise ask the user if they want to store it // If it is stored, update its data, otherwise ask the user if they want to store it
var allData = []; var allData = [];
var sendTo = []; var sendTo = [];
var inTargetDrive; var inTargetDrive, inMyDrive;
getAllStores().forEach(function (s) { getAllStores().forEach(function (s) {
// If this is an edit link but we don't have edit rights, this entry is not useful // If this is an edit link but we don't have edit rights, this entry is not useful
if (h.mode === "edit" && s.id && !s.secondaryKey) { if (h.mode === "edit" && s.id && !s.secondaryKey) {
@ -1189,6 +1189,8 @@ define([
} }
} }
if (!s.id) { inMyDrive = res.length; }
Array.prototype.push.apply(allData, res); Array.prototype.push.apply(allData, res);
}); });
var contains = allData.length !== 0; var contains = allData.length !== 0;
@ -1253,7 +1255,7 @@ define([
// Let inner know that dropped files shouldn't trigger the popup // Let inner know that dropped files shouldn't trigger the popup
postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", { postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", {
stored: true, stored: true,
inMyDrive: !contains && data.teamId // display "store in cryptdrive" entry inMyDrive: inMyDrive || (!contains && !data.teamId) // display "store in cryptdrive" entry
}); });
return; return;
} }
@ -1268,7 +1270,7 @@ define([
// Let inner know that dropped files shouldn't trigger the popup // Let inner know that dropped files shouldn't trigger the popup
postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", { postMessage(clientId, "AUTOSTORE_DISPLAY_POPUP", {
stored: true, stored: true,
inMyDrive: true inMyDrive: inMyDrive
}); });
nThen(function (waitFor) { nThen(function (waitFor) {
sendTo.forEach(function (teamId) { sendTo.forEach(function (teamId) {

Loading…
Cancel
Save