From 3e969dd9a5e52c38aa997f25a8de13e3f16ade2a Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 19 Mar 2021 15:09:28 +0100 Subject: [PATCH] Fix noDrive uid always modified --- www/common/outer/async-store.js | 11 +++++++++-- www/debug/main.js | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 60dc9ca73..d4f49014f 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -586,11 +586,14 @@ define([ var proxy = store.proxy || {}; var disableThumbnails = Util.find(proxy, ['settings', 'general', 'disableThumbnails']); var teams = (store.modules['team'] && store.modules['team'].getTeamsData(app)) || {}; + if (!proxy.uid) { + store.noDriveUid = store.noDriveUid || Hash.createChannelId(); + } var metadata = { // "user" is shared with everybody via the userlist user: { name: proxy[Constants.displayNameKey] || store.noDriveName || "", - uid: proxy.uid || Hash.createChannelId(), // Random uid in nodrive mode + uid: proxy.uid || store.noDriveUid, // Random uid in nodrive mode avatar: Util.find(proxy, ['profile', 'avatar']), profile: Util.find(proxy, ['profile', 'view']), color: getUserColor(), @@ -858,6 +861,7 @@ define([ Store.setDisplayName = function (clientId, value, cb) { if (!store.proxy) { store.noDriveName = value; + broadcast([clientId], "UPDATE_METADATA"); return void cb(); } if (store.modules['profile']) { @@ -2836,7 +2840,10 @@ define([ store.driveMetadata = info.metadata; if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; } if (!rt.proxy[Constants.displayNameKey] && store.noDriveName) { - store.proxy[Constants.displayNameKey] = store.noDriveName; + rt.proxy[Constants.displayNameKey] = store.noDriveName; + } + if (!rt.proxy.uid && store.noDriveUid) { + rt.proxy.uid = store.noDriveUid; } /* // deprecating localStorage migration as of 4.2.0 diff --git a/www/debug/main.js b/www/debug/main.js index 9053dfbf6..6f855e1db 100644 --- a/www/debug/main.js +++ b/www/debug/main.js @@ -44,6 +44,7 @@ define([ meta.debugDrive = drive; }; SFCommonO.start({ + noDrive: true, addData:addData }); });