aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SharingManager.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/SharingManager.tsx')
-rw-r--r--src/client/util/SharingManager.tsx25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx
index 59a88b404..0f7ce26d2 100644
--- a/src/client/util/SharingManager.tsx
+++ b/src/client/util/SharingManager.tsx
@@ -214,9 +214,7 @@ export class SharingManager extends React.Component<{}> {
const docs = SelectionManager.Views().length < 2 ? [target] : SelectionManager.Views().map(docView => docView.props.Document);
- if (acl == 'acl-Public' && this.layoutDocAcls){
- acl = 'acl-Public-layout';
- }
+ if (acl == 'acl-Public' && this.layoutDocAcls) acl = 'acl-Public-layout';
// ! ensures it returns true if document has been shared successfully, false otherwise
return !docs
.map(doc => (this.layoutDocAcls ? doc : doc[DocData]))
@@ -274,7 +272,8 @@ export class SharingManager extends React.Component<{}> {
/**
* Called from the properties sidebar to change permissions of a user.
*/
- shareFromPropertiesSidebar = (shareWith: string, permission: SharingPermissions, docs: Doc[]) => {
+ shareFromPropertiesSidebar = (shareWith: string, permission: SharingPermissions, docs: Doc[], layout: boolean) => {
+ if (layout) this.layoutDocAcls = true;
if (shareWith !== 'Public' && shareWith !== 'Override') {
const user = this.users.find(({ user: { email } }) => email === (shareWith === 'Me' ? Doc.CurrentUserEmail : shareWith));
docs.forEach(doc => {
@@ -285,11 +284,17 @@ export class SharingManager extends React.Component<{}> {
const dashboards = DocListCast(Doc.MyDashboards.data);
docs.forEach(doc => {
const isDashboard = dashboards.indexOf(doc) !== -1;
- if (this.overridePrevious) this.shareFromPropertiesSidebar(shareWith, permission, DocListCast(doc.data));
- if (GetEffectiveAcl(doc) === AclAdmin) distributeAcls(`acl-${shareWith}`, permission, doc, undefined, undefined, isDashboard);
+ if (this.overridePrevious) {
+ this.shareFromPropertiesSidebar(shareWith, permission, DocListCast(doc.data), layout);
+ }
+ if (GetEffectiveAcl(doc) === AclAdmin) {
+ if ( shareWith == 'Public' && layout) shareWith = 'Public-layout';
+ distributeAcls(`acl-${shareWith}`, permission, doc, undefined, undefined, isDashboard);
+ }
this.setDashboardBackground(doc, permission as SharingPermissions);
});
}
+ this.layoutDocAcls = false;
};
/**
@@ -607,16 +612,12 @@ export class SharingManager extends React.Component<{}> {
// const permissions = uniform ? StrCast(targetDoc?.[`acl-${StrCast(group.title)}`]) : '-multiple-';
let permissions = this.layoutDocAcls ? (targetDoc[DocAcl][groupKey] ? HierarchyMapping.get(targetDoc[DocAcl][groupKey])?.name : StrCast(Doc.GetProto(targetDoc)[groupKey])) : StrCast(targetDoc[groupKey]);
if (this.layoutDocAcls){
- if (groupKey == 'acl-Public'){
- groupKey = 'acl-Public-layout'
- }
+ if (groupKey == 'acl-Public') groupKey = 'acl-Public-layout';
if (targetDoc[DocAcl][groupKey]){
permissions = HierarchyMapping.get(targetDoc[DocAcl][groupKey])?.name;
}
else{
- if (groupKey == 'acl-Public-layout'){
- groupKey = 'acl-Public'
- }
+ if (groupKey == 'acl-Public-layout') groupKey = 'acl-Public';
if (targetDoc['embedContainer']){
permissions = StrCast(Doc.GetProto(DocCast(targetDoc['embedContainer']))[groupKey]);
}