diff --git a/app/client/lib/ACUserManager.ts b/app/client/lib/ACUserManager.ts index cb006125..84fb8492 100644 --- a/app/client/lib/ACUserManager.ts +++ b/app/client/lib/ACUserManager.ts @@ -83,7 +83,7 @@ export function buildACMemberEmail( .filter(item => item.cleanText.includes(cleanText)) .sort((a, b) => a.cleanText.localeCompare(b.cleanText)); results.items = items; - if (!results.items.length) { + if (!results.items.length && cleanText) { const newObject = { value: text, cleanText, diff --git a/app/client/models/UserManagerModel.ts b/app/client/models/UserManagerModel.ts index 90d1bf6f..88322485 100644 --- a/app/client/models/UserManagerModel.ts +++ b/app/client/models/UserManagerModel.ts @@ -66,6 +66,7 @@ export interface IEditableMember { origAccess: roles.Role|null; isNew: boolean; isRemoved: boolean; + isTeamMember?: boolean; } // An option for the select elements used in the UserManager. @@ -87,6 +88,7 @@ interface IBuildMemberOptions { picture?: string|null; access: roles.Role|null; parentAccess: roles.BasicRole|null; + isTeamMember?: boolean; } /** @@ -309,6 +311,7 @@ export class UserManagerModelImpl extends Disposable implements UserManagerModel picture: m.picture, access: m.access, parentAccess: m.parentAccess || null, + isTeamMember: m.isMember, }) ); } @@ -375,6 +378,7 @@ export class UserManagerModelImpl extends Disposable implements UserManagerModel origAccess: member.access, isNew: false, isRemoved: false, + isTeamMember: member.isTeamMember, }; } } diff --git a/app/client/ui/UserManager.ts b/app/client/ui/UserManager.ts index bb8849d2..dae49890 100644 --- a/app/client/ui/UserManager.ts +++ b/app/client/ui/UserManager.ts @@ -551,7 +551,10 @@ export class ACMemberEmail extends Disposable { } public buildDom() { - const acUserItem = this._members.map((member: IEditableMember) => getUserItem(member)); + const acUserItem = this._members + // Only suggest team members in autocomplete. + .filter((member: IEditableMember) => member.isTeamMember) + .map((member: IEditableMember) => getUserItem(member)); const acIndex = new ACIndexImpl(acUserItem); return buildACMemberEmail(this, diff --git a/app/gen-server/lib/HomeDBManager.ts b/app/gen-server/lib/HomeDBManager.ts index 3e570cf8..6e0eeb52 100644 --- a/app/gen-server/lib/HomeDBManager.ts +++ b/app/gen-server/lib/HomeDBManager.ts @@ -2208,10 +2208,14 @@ export class HomeDBManager extends EventEmitter { } const org: Organization = queryResult.data; const userRoleMap = getMemberUserRoles(org, this.defaultGroupNames); - const users = getResourceUsers(org).filter(u => userRoleMap[u.id]).map(u => ({ - ...this.makeFullUser(u), - access: userRoleMap[u.id] - })); + const users = getResourceUsers(org).filter(u => userRoleMap[u.id]).map(u => { + const access = userRoleMap[u.id]; + return { + ...this.makeFullUser(u), + access, + isMember: access !== 'guests', + }; + }); const personal = this._filterAccessData(scope, users, null); return { status: 200, @@ -2250,12 +2254,15 @@ export class HomeDBManager extends EventEmitter { const wsMap = getMemberUserRoles(workspace, this.defaultCommonGroupNames); // The orgMap gives the org access inherited by each user. const orgMap = getMemberUserRoles(workspace.org, this.defaultBasicGroupNames); + const orgMapWithMembership = getMemberUserRoles(workspace.org, this.defaultGroupNames); // Iterate through the org since all users will be in the org. const users: UserAccessData[] = getResourceUsers([workspace, workspace.org]).map(u => { + const orgAccess = orgMapWithMembership[u.id] || null; return { ...this.makeFullUser(u), access: wsMap[u.id] || null, - parentAccess: roles.getEffectiveRole(orgMap[u.id] || null) + parentAccess: roles.getEffectiveRole(orgMap[u.id] || null), + isMember: orgAccess && orgAccess !== 'guests', }; }); const maxInheritedRole = this._getMaxInheritedRole(workspace); @@ -2319,7 +2326,7 @@ export class HomeDBManager extends EventEmitter { parentAccess: roles.getEffectiveRole( roles.getStrongestRole(wsMap[u.id] || null, inheritFromOrg) ), - isMember: orgAccess !== 'guests' && orgAccess !== null, + isMember: orgAccess && orgAccess !== 'guests', isSupport: u.id === this.getSupportUserId() ? true : undefined, }; });