diff options
-rw-r--r-- | .vscode/launch.json | 3 | ||||
-rw-r--r-- | src/client/util/SharingManager.tsx | 19 |
2 files changed, 16 insertions, 6 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 829f8f492..26c45a9d3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,7 +44,8 @@ "name": "Launch Chrome against Dash server", "sourceMaps": true, "breakOnLoad": true, - "url": "http://dash-web.eastus2.cloudapp.azure.com:1050/login", + "url": "https://browndash.com/login", + //"url": "http://dash-web.eastus2.cloudapp.azure.com:1050/login", "webRoot": "${workspaceFolder}", }, { diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index d2e25dc26..c022974da 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -123,19 +123,28 @@ export class SharingManager extends React.Component<{}> { populateUsers = async () => { if (!this.populating) { this.populating = true; - runInAction(() => this.users = []); const userList = await RequestPromise.get(Utils.prepend("/getUsers")); const raw = JSON.parse(userList) as User[]; + const sharingDocs: ValidatedUser[] = []; const evaluating = raw.map(async user => { const isCandidate = user.email !== Doc.CurrentUserEmail; if (isCandidate) { - const userSharingDoc = await DocServer.GetRefField(user.sharingDocumentId); - if (userSharingDoc instanceof Doc) { - runInAction(() => this.users.push({ user, sharingDoc: userSharingDoc, userColor: StrCast(userSharingDoc.userColor) })); + const sharingDoc = await DocServer.GetRefField(user.sharingDocumentId); + if (sharingDoc instanceof Doc) { + sharingDocs.push({ user, sharingDoc, userColor: StrCast(sharingDoc.color) }); } } }); - return Promise.all(evaluating).then(() => this.populating = false); + return Promise.all(evaluating).then(() => { + runInAction(() => { + for (let i = 0; i < sharingDocs.length; i++) { + if (!this.users.find(user => user.user.email === sharingDocs[i].user.email)) { + this.users.push(sharingDocs[i]); + } + } + }); + this.populating = false; + }); } } |