Send an event to all the teams when adding a pad to a drive

pull/1/head
yflory 5 years ago
parent 3648eec7a6
commit 66d7d93496

@ -603,9 +603,14 @@ define([
s.manager.addPad(data.path, pad, function (e) { s.manager.addPad(data.path, pad, function (e) {
if (e) { return void cb({error: e}); } if (e) { return void cb({error: e}); }
var send = data.teamId ? s.sendEvent : sendDriveEvent; var send = data.teamId ? s.sendEvent : sendDriveEvent;
send('DRIVE_CHANGE', { // Send a CHANGE events to all the teams because we may have just
path: ['drive', UserObject.FILES_DATA] // added a pad to a shared folder stored in multiple teams
}, clientId); getAllStores().forEach(function (_s) {
var send = _s.id ? _s.sendEvent : sendDriveEvent;
send('DRIVE_CHANGE', {
path: ['drive', UserObject.FILES_DATA]
}, clientId);
});
onSync(data.teamId, cb); onSync(data.teamId, cb);
}); });
}; };
@ -994,7 +999,6 @@ define([
}); });
}).nThen(cb); }).nThen(cb);
}; };
// XXX Teams. encrypted href...
Store.setPadTitle = function (clientId, data, cb) { Store.setPadTitle = function (clientId, data, cb) {
var title = data.title; var title = data.title;
var href = data.href; var href = data.href;
@ -1808,7 +1812,8 @@ define([
//var data = cmdData.data; //var data = cmdData.data;
var s = getStore(cmdData.teamId); var s = getStore(cmdData.teamId);
var cb2 = function (data2) { var cb2 = function (data2) {
// Send the CHANGE event to all the stores because the command may have
// affected data from a shared folder used by multiple teams.
getAllStores().forEach(function (_s) { getAllStores().forEach(function (_s) {
var send = _s.id ? _s.sendEvent : sendDriveEvent; var send = _s.id ? _s.sendEvent : sendDriveEvent;
send('DRIVE_CHANGE', { send('DRIVE_CHANGE', {

Loading…
Cancel
Save