diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/.DS_Store | bin | 10244 -> 10244 bytes | |||
-rw-r--r-- | src/client/util/SharingManager.scss | 3 | ||||
-rw-r--r-- | src/client/util/SharingManager.tsx | 31 | ||||
-rw-r--r-- | src/client/views/DocumentDecorations.tsx | 4 | ||||
-rw-r--r-- | src/client/views/PropertiesView.tsx | 50 |
5 files changed, 71 insertions, 17 deletions
diff --git a/src/.DS_Store b/src/.DS_Store Binary files differindex be99aa5af..06389d6ae 100644 --- a/src/.DS_Store +++ b/src/.DS_Store diff --git a/src/client/util/SharingManager.scss b/src/client/util/SharingManager.scss index aa1e11ef5..80d5807b4 100644 --- a/src/client/util/SharingManager.scss +++ b/src/client/util/SharingManager.scss @@ -107,6 +107,7 @@ .group-container { width: 50%; display: flex; + top:0; flex-direction: column; .user-sort { @@ -199,7 +200,7 @@ display: flex; position: relative; margin-top: 5px; - margin-bottom: 10px; + // margin-bottom: 10px; font-size: 22px; -webkit-user-select: none; -moz-user-select: none; diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 6112b5b69..78e502e6e 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -526,7 +526,7 @@ export class SharingManager extends React.Component<{}> { docToUse = Doc.GetProto(this.targetDoc!); const userKey = `acl-${normalizeEmail(user.email)}`; - const uniform = docs.map(doc => (this.layoutDocAcls ? doc : doc[DataSym])).every(doc => doc?.[AclSym]?.[userKey] === docs[0]?.[AclSym]?.[userKey]); + const uniform = docs.map(doc => (this.layoutDocAcls ? doc : doc[DocData])).every(doc => doc?.[DocAcl]?.[userKey] === docs[0]?.[DocAcl]?.[userKey]); const permissions = uniform ? StrCast(targetDoc?.[userKey]) : '-multiple-'; return !permissions ? null : ( @@ -574,8 +574,8 @@ export class SharingManager extends React.Component<{}> { const groupListContents = groupListMap.map(group => { const groupKey = `acl-${StrCast(group.title)}`; const uniform = docs - .map(doc => (this.layoutDocAcls ? doc : doc[DataSym])) - .every(doc => (this.layoutDocAcls ? doc?.[AclSym]?.[groupKey] === docs[0]?.[AclSym]?.[groupKey] : doc?.[DataSym]?.[AclSym]?.[groupKey] === docs[0]?.[DataSym]?.[AclSym]?.[groupKey])); + .map(doc => (this.layoutDocAcls ? doc : doc[DocData])) + .every(doc => (this.layoutDocAcls ? doc?.[DocAcl]?.[groupKey] === docs[0]?.[DocAcl]?.[groupKey] : doc?.[DocData]?.[DocAcl]?.[groupKey] === docs[0]?.[DocData]?.[DocAcl]?.[groupKey])); const permissions = uniform ? StrCast(targetDoc?.[`acl-${StrCast(group.title)}`]) : '-multiple-'; return !permissions ? null : ( @@ -670,14 +670,21 @@ export class SharingManager extends React.Component<{}> { </div> <div className={'group-container'}> <div className="user-sort" onClick={action(() => (this.groupSort = this.groupSort === 'ascending' ? 'descending' : this.groupSort === 'descending' ? 'none' : 'ascending'))}> - Groups{' '} - {this.groupSort === 'ascending' ? ( - <FontAwesomeIcon icon={'caret-up'} size={'xs'} /> - ) : this.groupSort === 'descending' ? ( - <FontAwesomeIcon icon={'caret-down'} size={'xs'} /> - ) : ( - <FontAwesomeIcon icon={'caret-right'} size={'xs'} /> - )} + <div className="container"> + Groups + + <div className="group-info" onClick={action(() => (GroupManager.Instance?.open()))}> + <FontAwesomeIcon icon={'info-circle'} color={'#e8e8e8'} size={'sm'} style={{ backgroundColor: '#1e89d7', borderRadius: '100%', border: '1px solid #1e89d7' }} /> + </div> + + {this.groupSort === 'ascending' ? ( + <FontAwesomeIcon icon={'caret-up'} size={'xs'} /> + ) : this.groupSort === 'descending' ? ( + <FontAwesomeIcon icon={'caret-down'} size={'xs'} /> + ) : ( + <FontAwesomeIcon icon={'caret-right'} size={'xs'} /> + )} + </div> </div> <div className={'groups-list'}>{groupListContents}</div> </div> @@ -690,4 +697,4 @@ export class SharingManager extends React.Component<{}> { render() { return <MainViewModal contents={this.sharingInterface} isDisplayed={this.isOpen} interactive={true} dialogueBoxDisplayedOpacity={this.dialogueBoxOpacity} overlayDisplayedOpacity={this.overlayOpacity} closeOnExternalClick={this.close} />; } -} +}
\ No newline at end of file diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 74cf58c7b..0cd92e2cf 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -760,8 +760,8 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P } // sharing - const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-Public']; - // const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-'+normalizeEmail(Doc.CurrentUserEmail)]; + // const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-Public']; + const docShareMode = Doc.GetProto(seldocview.rootDoc)['acl-'+normalizeEmail(Doc.CurrentUserEmail)]; const shareMode = StrCast(docShareMode); var shareSymbolIcon = null; switch (shareMode) { diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index b6699c3bf..ca27e244d 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -6,7 +6,11 @@ import { Checkbox, Tooltip } from '@material-ui/core'; import { action, computed, Lambda, observable } from 'mobx'; import { observer } from 'mobx-react'; import { ColorState, SketchPicker } from 'react-color'; +<<<<<<< Updated upstream import { AclAdmin, AclSym, DataSym, Doc, Field, FieldResult, HeightSym, HierarchyMapping, NumListCast, Opt, StrListCast, WidthSym } from '../../fields/Doc'; +======= +import { AclAdmin, AclSym, DataSym, Doc, Field, FieldResult, HeightSym, NumListCast, Opt, StrListCast, WidthSym } from '../../fields/Doc'; +>>>>>>> Stashed changes import { Id } from '../../fields/FieldSymbols'; import { InkField } from '../../fields/InkField'; import { List } from '../../fields/List'; @@ -33,6 +37,8 @@ import { PropertiesDocBacklinksSelector } from './PropertiesDocBacklinksSelector import { PropertiesDocContextSelector } from './PropertiesDocContextSelector'; import './PropertiesView.scss'; import { DefaultStyleProvider } from './StyleProvider'; +import { GroupManager } from '../util/GroupManager'; +import { intersection } from 'lodash'; const higflyout = require('@hig/flyout'); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -384,6 +390,9 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { ); } + /** + * @returns a colored dropdown bar reflective of the permission + */ colorACLDropDown(name: string, admin: boolean, permission: string, showExpansionIcon?: boolean) { var dropDownText = ''; switch (StrCast(permission)) { @@ -411,7 +420,6 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { {' '} {dropDownText} {admin && permission !== 'Owner' ? this.getPermissionsSelect(name, permission) : permission} - {/* {(permission === 'Owner' && name == 'Me') || showExpansionIcon ? this.expansionIcon : null} */} </div> </div> </div> @@ -427,6 +435,13 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { }; /** + * Sorting algorithm to sort groups. + */ + sortGroups = (g1: Doc, g2: Doc) => { + return g1 > g2 ? -1 : g1 === g2 ? 0 : 1; + }; + + /** * @returns the sharing and permissions panel. */ @computed get sharingTable() { @@ -451,6 +466,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { const tableEntries = []; const usersAdded: string[] = []; // all shared users being added - organized by denormalized email +<<<<<<< Updated upstream // DocCastAsync(Doc.UserDoc().sidebarUsersDisplayed).then(sidebarUsersDisplayed => { if (commonKeys.length) { for (const key of commonKeys) { @@ -458,6 +474,15 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { const uniform = docs.every(doc => doc?.[AclSym]?.[key] === docs[0]?.[AclSym]?.[key]); if (name !== Doc.CurrentUserEmail && name !== target.author && name !== 'Public' && name !== 'Override' /* && sidebarUsersDisplayed![name] !== false*/) { tableEntries.push(this.sharingItem(name, showAdmin, uniform ? HierarchyMapping.get(target[AclSym][key])!.name : '-multiple-')); +======= + // adds each user to usersAdded + SharingManager.Instance.users.forEach(eachUser => { + var userOnDashboard = true; + var permission = StrCast(target[`acl-${normalizeEmail(eachUser.user.email)}`]); + if (Doc.ActiveDashboard) { + if (Doc.ActiveDashboard['acl-' + normalizeEmail(eachUser.user.email)] == '' || Doc.ActiveDashboard['acl-' + normalizeEmail(eachUser.user.email)] == undefined) { + userOnDashboard = false; +>>>>>>> Stashed changes } } if (userOnDashboard && !usersAdded.includes(eachUser.user.email) && eachUser.user.email != 'Public' && eachUser.user.email != target.author) { @@ -466,6 +491,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { } }); +<<<<<<< Updated upstream const ownerSame = Doc.CurrentUserEmail !== target.author && docs.filter(doc => doc).every(doc => doc.author === docs[0].author); // shifts the current user, owner, public to the top of the doc. // tableEntries.unshift(this.sharingItem("Override", showAdmin, docs.filter(doc => doc).every(doc => doc["acl-Override"] === docs[0]["acl-Override"]) ? (AclMap.get(target[AclSym]?.["acl-Override"]) || "None") : "-multiple-")); @@ -479,8 +505,16 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { !ownerSame ) ); +======= + // adds each user to the table + usersAdded.sort(this.sortUsers); + usersAdded.map(userEmail => { + const permission = StrCast(target[`acl-${normalizeEmail(userEmail)}`]); + tableEntries.unshift(this.sharingItem(userEmail, showAdmin, permission, false)); // adds each user + }); +>>>>>>> Stashed changes - // add current user + // adds current user var userEmail = Doc.CurrentUserEmail; if (userEmail == 'guest') userEmail = 'Public'; if (!usersAdded.includes(userEmail) && userEmail != 'Public' && userEmail != target.author) { @@ -488,6 +522,18 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { usersAdded.push(userEmail); } + // adds groups + const groupList = GroupManager.Instance?.allGroups || []; + const groups = groupList.slice().sort(this.sortGroups); + const commonKeys = intersection(...docs.map(doc => (this.layoutDocAcls ? doc : doc[DataSym])).map(doc => doc?.[AclSym] && Object.keys(doc[AclSym]))); + const groupListMap: (Doc | { title: string })[] = groups.filter(({ title }) => (docs.length > 1 ? commonKeys.includes(`acl-${normalizeEmail(StrCast(title))}`) : true)); + groupListMap.map(group => { + if (group.title != 'Public'){ + const permission = StrCast(target[`acl-${StrCast(group.title)}`]); + tableEntries.unshift(this.sharingItem(StrCast(group.title), showAdmin, permission, false)); + } + }) + // shift owner to top tableEntries.unshift(this.sharingItem(StrCast(target.author), showAdmin, 'Owner'), false); |