Fix noDrive uid always modified

This commit is contained in:
yflory 2021-03-19 15:09:28 +01:00
parent 31414ca7b0
commit 3e969dd9a5
2 changed files with 10 additions and 2 deletions

View file

@ -586,11 +586,14 @@ define([
var proxy = store.proxy || {}; var proxy = store.proxy || {};
var disableThumbnails = Util.find(proxy, ['settings', 'general', 'disableThumbnails']); var disableThumbnails = Util.find(proxy, ['settings', 'general', 'disableThumbnails']);
var teams = (store.modules['team'] && store.modules['team'].getTeamsData(app)) || {}; var teams = (store.modules['team'] && store.modules['team'].getTeamsData(app)) || {};
if (!proxy.uid) {
store.noDriveUid = store.noDriveUid || Hash.createChannelId();
}
var metadata = { var metadata = {
// "user" is shared with everybody via the userlist // "user" is shared with everybody via the userlist
user: { user: {
name: proxy[Constants.displayNameKey] || store.noDriveName || "", 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']), avatar: Util.find(proxy, ['profile', 'avatar']),
profile: Util.find(proxy, ['profile', 'view']), profile: Util.find(proxy, ['profile', 'view']),
color: getUserColor(), color: getUserColor(),
@ -858,6 +861,7 @@ define([
Store.setDisplayName = function (clientId, value, cb) { Store.setDisplayName = function (clientId, value, cb) {
if (!store.proxy) { if (!store.proxy) {
store.noDriveName = value; store.noDriveName = value;
broadcast([clientId], "UPDATE_METADATA");
return void cb(); return void cb();
} }
if (store.modules['profile']) { if (store.modules['profile']) {
@ -2836,7 +2840,10 @@ define([
store.driveMetadata = info.metadata; store.driveMetadata = info.metadata;
if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; } if (!rt.proxy.drive || typeof(rt.proxy.drive) !== 'object') { rt.proxy.drive = {}; }
if (!rt.proxy[Constants.displayNameKey] && store.noDriveName) { 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 // deprecating localStorage migration as of 4.2.0

View file

@ -44,6 +44,7 @@ define([
meta.debugDrive = drive; meta.debugDrive = drive;
}; };
SFCommonO.start({ SFCommonO.start({
noDrive: true,
addData:addData addData:addData
}); });
}); });