Merge branch 'staging' into foldersColor
This commit is contained in:
@@ -66,7 +66,7 @@ define([
|
||||
}
|
||||
broadcast([clientId], "UPDATE_METADATA");
|
||||
if (Array.isArray(path) && path[0] === 'profile' && store.messenger) {
|
||||
store.messenger.updateMyData();
|
||||
Messaging.updateMyData(store);
|
||||
}
|
||||
onSync(cb);
|
||||
};
|
||||
@@ -85,6 +85,20 @@ define([
|
||||
cb({});
|
||||
};
|
||||
|
||||
Store.restoreSharedFolder = function (clientId, data, cb) {
|
||||
if (!data.sfId || !data.drive) { return void cb({error:'EINVAL'}); }
|
||||
if (store.sharedFolders[data.sfId]) {
|
||||
Object.keys(data.drive).forEach(function (k) {
|
||||
store.sharedFolders[data.sfId].proxy[k] = data.drive[k];
|
||||
});
|
||||
Object.keys(store.sharedFolders[data.sfId].proxy).forEach(function (k) {
|
||||
if (data.drive[k]) { return; }
|
||||
delete store.sharedFolders[data.sfId].proxy[k];
|
||||
});
|
||||
}
|
||||
onSync(cb);
|
||||
};
|
||||
|
||||
Store.hasSigningKeys = function () {
|
||||
if (!store.proxy) { return; }
|
||||
return typeof(store.proxy.edPrivate) === 'string' &&
|
||||
@@ -327,15 +341,6 @@ define([
|
||||
account.note = obj.note;
|
||||
cb(obj);
|
||||
});
|
||||
|
||||
arePinsSynced(function (err, yes) {
|
||||
if (!yes) {
|
||||
resetPins(function (err) {
|
||||
if (err) { return console.error(err); }
|
||||
console.log('RESET DONE');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -644,7 +649,7 @@ define([
|
||||
}
|
||||
store.proxy[Constants.displayNameKey] = value;
|
||||
broadcast([clientId], "UPDATE_METADATA");
|
||||
if (store.messenger) { store.messenger.updateMyData(); }
|
||||
Messaging.updateMyData(store);
|
||||
onSync(cb);
|
||||
};
|
||||
|
||||
@@ -1441,6 +1446,30 @@ define([
|
||||
};
|
||||
registerProxyEvents = function (proxy, fId) {
|
||||
proxy.on('change', [], function (o, n, p) {
|
||||
if (fId) {
|
||||
// Pin the new pads
|
||||
if (p[0] === UserObject.FILES_DATA && typeof(n) === "object" && n.channel && !n.owners) {
|
||||
var toPin = [n.channel];
|
||||
// Also pin the onlyoffice channels if they exist
|
||||
if (n.rtChannel) { toPin.push(n.rtChannel); }
|
||||
if (n.lastVersion) { toPin.push(n.lastVersion); }
|
||||
Store.pinPads(null, toPin, function (obj) { console.error(obj); });
|
||||
}
|
||||
// Unpin the deleted pads (deleted <=> changed to undefined)
|
||||
if (p[0] === UserObject.FILES_DATA && typeof(o) === "object" && o.channel && !n) {
|
||||
var toUnpin = [o.channel];
|
||||
var c = store.manager.findChannel(o.channel);
|
||||
var exists = c.some(function (data) {
|
||||
return data.fId !== fId;
|
||||
});
|
||||
if (!exists) { // Unpin
|
||||
// Also unpin the onlyoffice channels if they exist
|
||||
if (o.rtChannel) { toUnpin.push(o.rtChannel); }
|
||||
if (o.lastVersion) { toUnpin.push(o.lastVersion); }
|
||||
Store.unpinPads(null, toUnpin, function (obj) { console.error(obj); });
|
||||
}
|
||||
}
|
||||
}
|
||||
sendDriveEvent('DRIVE_CHANGE', {
|
||||
id: fId,
|
||||
old: o,
|
||||
@@ -1645,14 +1674,16 @@ define([
|
||||
});
|
||||
userObject.migrate(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
Store.initAnonRpc(null, null, waitFor());
|
||||
Store.initRpc(null, null, waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
loadMailbox(waitFor);
|
||||
Migrate(proxy, waitFor(), function (version, progress) {
|
||||
postMessage(clientId, 'LOADING_DRIVE', {
|
||||
state: (2 + (version / 10)),
|
||||
progress: progress
|
||||
});
|
||||
});
|
||||
Store.initAnonRpc(null, null, waitFor());
|
||||
Store.initRpc(null, null, waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
postMessage(clientId, 'LOADING_DRIVE', {
|
||||
state: 3
|
||||
@@ -1662,10 +1693,18 @@ define([
|
||||
loadMessenger();
|
||||
loadCursor();
|
||||
loadOnlyOffice();
|
||||
loadMailbox(waitFor);
|
||||
loadUniversal(Profile, 'profile', waitFor);
|
||||
cleanFriendRequests();
|
||||
}).nThen(function () {
|
||||
arePinsSynced(function (err, yes) {
|
||||
if (!yes) {
|
||||
resetPins(function (err) {
|
||||
if (err) { return console.error(err); }
|
||||
console.log('RESET DONE');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var requestLogin = function () {
|
||||
broadcast([], "REQUEST_LOGIN");
|
||||
};
|
||||
@@ -1817,8 +1856,8 @@ define([
|
||||
|
||||
// Ping clients regularly to make sure one tab was not closed without sending a removeClient()
|
||||
// command. This allow us to avoid phantom viewers in pads.
|
||||
var PING_INTERVAL = 30000;
|
||||
var MAX_PING = 5000;
|
||||
var PING_INTERVAL = 120000;
|
||||
var MAX_PING = 30000;
|
||||
var MAX_FAILED_PING = 2;
|
||||
|
||||
setInterval(function () {
|
||||
|
||||
Reference in New Issue
Block a user