diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-06-15 13:41:48 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-06-15 13:41:48 -0400 |
commit | a366394a1db42628b7299947e6c1be2845c9a77d (patch) | |
tree | ab5b9adf07e6b43acd6a181f390fa1ec3abd8732 /src | |
parent | 93d9daeda0cf2f411e8f642bc90fa561d1877c60 (diff) |
fixed group sharing distribution bug and group sharing in the properties menu
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/SharingManager.tsx | 13 | ||||
-rw-r--r-- | src/client/util/UndoManager.ts | 2 | ||||
-rw-r--r-- | src/client/views/PropertiesView.tsx | 11 | ||||
-rw-r--r-- | src/fields/util.ts | 1 |
4 files changed, 16 insertions, 11 deletions
diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index a51a71268..6cbc060fa 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -200,13 +200,14 @@ export class SharingManager extends React.Component<{}> { const acl = `acl-${key}`; const isDashboard = DocListCast(Doc.MyDashboards.data).indexOf(target) !== -1; - // setting the same acl for a docs within the doc being shared - if (this.overridePrivate) { - var childDocs = DocListCast(target.data); - childDocs.map(doc => { + // setting the same acl for a docs within the doc being shared if they haven't been set yet + // or if the 'Override Private' checkbox is selected + var childDocs = DocListCast(target.data); + childDocs.map(doc => { + if (this.overridePrivate || doc[acl]==undefined){ this.setInternalGroupSharing(group, permission, doc); - }); - } + } + }); const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document); diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts index 6fef9d660..d4532c8ef 100644 --- a/src/client/util/UndoManager.ts +++ b/src/client/util/UndoManager.ts @@ -95,7 +95,7 @@ export namespace UndoManager { export function AddEvent(event: UndoEvent, value?: any): void { if (currentBatch && batchCounter.get() && !undoing) { - console.log(' '.slice(0, batchCounter.get()) + 'UndoEvent : ' + event.prop + ' = ' + value); + // console.log(' '.slice(0, batchCounter.get()) + 'UndoEvent : ' + event.prop + ' = ' + value); currentBatch.push(event); tempEvents?.push(event); } diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx index 43ac2aa88..4674bc0f4 100644 --- a/src/client/views/PropertiesView.tsx +++ b/src/client/views/PropertiesView.tsx @@ -463,7 +463,6 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { // 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; @@ -496,9 +495,13 @@ export class PropertiesView extends React.Component<PropertiesViewProps> { const commonKeys = intersection(...docs.map(doc => (this.layoutDocAcls ? doc : doc[DocData])).map(doc => doc?.[DocAcl] && Object.keys(doc[DocAcl]))); 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)); + if (group.title != 'Public' && Doc.ActiveDashboard) { + const groupKey = 'acl-' + normalizeEmail(StrCast(group.title)); + if (Doc.ActiveDashboard[groupKey] != '' && Doc.ActiveDashboard[groupKey] != undefined) { + const permission = StrCast(target[groupKey]); + console.log(permission) + tableEntries.unshift(this.sharingItem(StrCast(group.title), showAdmin, permission, false)); + } } }); diff --git a/src/fields/util.ts b/src/fields/util.ts index 9c0f4ba1f..469e4d944 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -195,6 +195,7 @@ export function SetCachedGroups(groups: string[]) { } function getEffectiveAcl(target: any, user?: string): symbol { const targetAcls = target[DocAcl]; + console.log(target.title, targetAcls) if (targetAcls?.['acl-Me'] === AclAdmin || GetCachedGroupByName('Admin')) return AclAdmin; const userChecked = user || Doc.CurrentUserEmail; // if the current user is the author of the document / the current user is a member of the admin group |