From 66d7d93496f4f2ab547793010e6c3b32cb168f30 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 3 Oct 2019 11:18:43 +0200 Subject: [PATCH] Send an event to all the teams when adding a pad to a drive --- www/common/outer/async-store.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 56c3de5dd..12083244e 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -603,9 +603,14 @@ define([ s.manager.addPad(data.path, pad, function (e) { if (e) { return void cb({error: e}); } var send = data.teamId ? s.sendEvent : sendDriveEvent; - send('DRIVE_CHANGE', { - path: ['drive', UserObject.FILES_DATA] - }, clientId); + // Send a CHANGE events to all the teams because we may have just + // added a pad to a shared folder stored in multiple teams + getAllStores().forEach(function (_s) { + var send = _s.id ? _s.sendEvent : sendDriveEvent; + send('DRIVE_CHANGE', { + path: ['drive', UserObject.FILES_DATA] + }, clientId); + }); onSync(data.teamId, cb); }); }; @@ -994,7 +999,6 @@ define([ }); }).nThen(cb); }; - // XXX Teams. encrypted href... Store.setPadTitle = function (clientId, data, cb) { var title = data.title; var href = data.href; @@ -1808,7 +1812,8 @@ define([ //var data = cmdData.data; var s = getStore(cmdData.teamId); 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) { var send = _s.id ? _s.sendEvent : sendDriveEvent; send('DRIVE_CHANGE', {