diff options
Diffstat (limited to 'src/client/views/PropertiesView.tsx')
-rw-r--r-- | src/client/views/PropertiesView.tsx | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 2b12a7b58..633401d58 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -395,9 +395,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { <div> <div className={'propertiesView-shareDropDown'}> <div className={`propertiesView-shareDropDown${permission}`}> - <div className="propertiesView-shareDropDown"> - {admin && permission !== 'Owner' ? this.getPermissionsSelect(name, permission) : concat(shareImage, ' ', permission)} - </div> + <div className="propertiesView-shareDropDown">{admin && permission !== 'Owner' ? this.getPermissionsSelect(name, permission) : concat(shareImage, ' ', permission)}</div> </div> </div> </div> @@ -425,11 +423,10 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { */ @computed get sharingTable() { // all selected docs - const docs = - SelectionManager.Views().length < 2 && this.selectedDoc ? [this.layoutDocAcls ? this.selectedDoc : this.dataDoc!] : SelectionManager.Views().map(docView => (this.layoutDocAcls ? docView.props.Document : docView.props.Document[DocData])); + const docs = SelectionManager.Views().length < 2 && this.selectedDoc ? [this.selectedDoc] : SelectionManager.Views().map(docView => docView.rootDoc); const target = docs[0]; - const showAdmin = GetEffectiveAcl(target) == AclAdmin + const showAdmin = GetEffectiveAcl(target) == AclAdmin; const individualTableEntries = []; const usersAdded: string[] = []; // all shared users being added - organized by denormalized email @@ -450,27 +447,21 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { usersAdded.sort(this.sortUsers); usersAdded.map(userEmail => { const userKey = `acl-${normalizeEmail(userEmail)}`; - var permission; - if (this.layoutDocAcls){ - if (target[DocAcl][userKey]) permission = HierarchyMapping.get(target[DocAcl][userKey])?.name; - else if (target['embedContainer']) permission = StrCast(Doc.GetProto(DocCast(target['embedContainer']))[userKey]); - else permission = StrCast(Doc.GetProto(target)?.[userKey]); - } - else permission = StrCast(target[userKey]); + var permission = StrCast(target[userKey]); individualTableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission!, false)); // adds each user }); // adds current user var userEmail = Doc.CurrentUserEmail; const userKey = `acl-${normalizeEmail(userEmail)}`; - if (!usersAdded.includes(userEmail) && userEmail != 'guest' && userEmail != target.author) { + if (userEmail == 'guest') userEmail = 'Public'; + if (!usersAdded.includes(userEmail) && userEmail != 'Public' && userEmail != target.author) { var permission; - if (this.layoutDocAcls){ + if (this.layoutDocAcls) { if (target[DocAcl][userKey]) permission = HierarchyMapping.get(target[DocAcl][userKey])?.name; else if (target['embedContainer']) permission = StrCast(Doc.GetProto(DocCast(target['embedContainer']))[userKey]); else permission = StrCast(Doc.GetProto(target)?.[userKey]); - } - else permission = StrCast(target[userKey]); + } else permission = StrCast(target[userKey]); individualTableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission!, false)); // adds each user } @@ -480,36 +471,29 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { // adds groups const groupTableEntries: JSX.Element[] = []; const groupList = GroupManager.Instance?.allGroups || []; - groupList.sort(this.sortGroups) + groupList.sort(this.sortGroups); groupList.map(group => { if (group.title != 'Public' && this.selectedDoc) { const groupKey = 'acl-' + normalizeEmail(StrCast(group.title)); if (this.selectedDoc[groupKey] != '' && this.selectedDoc[groupKey] != undefined) { var permission; - if (this.layoutDocAcls){ - if (target[DocAcl][groupKey]){ + if (this.layoutDocAcls) { + if (target[DocAcl][groupKey]) { permission = HierarchyMapping.get(target[DocAcl][groupKey])?.name; - } - else if (target['embedContainer']) permission = StrCast(Doc.GetProto(DocCast(target['embedContainer']))[groupKey]); + } else if (target['embedContainer']) permission = StrCast(Doc.GetProto(DocCast(target['embedContainer']))[groupKey]); else permission = StrCast(Doc.GetProto(target)?.[groupKey]); - } - else permission = StrCast(target[groupKey]); + } else permission = StrCast(target[groupKey]); groupTableEntries.unshift(this.sharingItem(StrCast(group.title), showAdmin, permission!, false)); } } }); // public permission - let publicPermission = StrCast(target['acl-Public']); - if (this.layoutDocAcls){ - if (target['acl-Public-layout']) publicPermission = StrCast(target['acl-Public-layout']); - else if (target['embedContainer']) publicPermission = StrCast(Doc.GetProto(DocCast(target['embedContainer']))['acl-Public']); - else StrCast(Doc.GetProto(target)['acl-Public']); - } + const publicPermission = StrCast((this.layoutDocAcls ? target : Doc.GetProto(target))['acl-Public']); return ( <div> - <br/> + <br /> Public / Guest Users <div>{this.colorACLDropDown('Public', showAdmin, publicPermission!, false)}</div> <div> @@ -517,7 +501,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { <br></br> Individual Users with Access to this Document{' '} </div> <div className="propertiesView-sharingTable">{<div> {individualTableEntries}</div>}</div> - {groupTableEntries.length>0 ? + {groupTableEntries.length > 0 ? ( <div> <div> {' '} @@ -525,7 +509,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { </div> <div className="propertiesView-sharingTable">{<div> {groupTableEntries}</div>}</div> </div> - : null} + ) : null} </div> ); } |