diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 11:16:02 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-10 11:16:02 +0530 |
commit | 3dab659503e98fe75a9c0671057771ff666d7e10 (patch) | |
tree | 47c34b69e282cc53642871a664b6f71f33c754e2 /src | |
parent | 3bfb158e4560ca2aa45373d39e46021a25051c96 (diff) |
default acl private setting created + bugfix
Diffstat (limited to 'src')
-rw-r--r-- | src/client/documents/Documents.ts | 2 | ||||
-rw-r--r-- | src/client/util/SettingsManager.scss | 16 | ||||
-rw-r--r-- | src/client/util/SettingsManager.tsx | 6 | ||||
-rw-r--r-- | src/client/views/DocComponent.tsx | 3 | ||||
-rw-r--r-- | src/client/views/collections/CollectionView.tsx | 2 | ||||
-rw-r--r-- | src/fields/Doc.ts | 2 |
6 files changed, 24 insertions, 7 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 7b11cf0b7..a6a697574 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -577,6 +577,8 @@ export namespace Docs { viewDoc.author = Doc.CurrentUserEmail; viewDoc.type !== DocumentType.LINK && DocUtils.MakeLinkToActiveAudio(viewDoc); + if (Doc.UserDoc()?.defaultAclPrivate) viewDoc["ACL-Public"] = dataDoc["ACL-Public"] = "Not Shared"; + return Doc.assign(viewDoc, delegateProps, true); } diff --git a/src/client/util/SettingsManager.scss b/src/client/util/SettingsManager.scss index ca27cfa3c..01dda0aca 100644 --- a/src/client/util/SettingsManager.scss +++ b/src/client/util/SettingsManager.scss @@ -99,8 +99,8 @@ display: flex; .modes-select { - width: 170px; - margin-right: 65px; + // width: 170px; + margin-right: 10px; color: black; border-radius: 5px; @@ -109,10 +109,12 @@ } } - .modes-playground { + .modes-playground, + .default-acl { display: flex; - .playground-check { + .playground-check, + .acl-check { margin-right: 5px; &:hover { @@ -122,7 +124,13 @@ .playground-text { color: black; + margin-right: 10px; } + + .acl-text { + color: black; + } + } } diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx index 8b58880d4..513cece40 100644 --- a/src/client/util/SettingsManager.tsx +++ b/src/client/util/SettingsManager.tsx @@ -40,7 +40,7 @@ export default class SettingsManager extends React.Component<{}> { } public close = action(() => this.isOpen = false); - public open = action(() => (this.isOpen = true) && SelectionManager.DeselectAll()); + public open = action(() => this.isOpen = true); private googleAuthorize = action(() => GoogleAuthenticationManager.Instance.fetchOrGenerateAccessToken(true)); private changePassword = async () => { @@ -136,6 +136,10 @@ export default class SettingsManager extends React.Component<{}> { <input className="playground-check" type="checkbox" checked={this.playgroundMode} onChange={this.playgroundModeToggle} /> <div className="playground-text">Playground Mode</div> </div> + <div className="default-acl"> + <input className="acl-check" type="checkbox" checked={BoolCast(Doc.UserDoc()?.defaultAclPrivate)} onChange={action(() => Doc.UserDoc().defaultAclPrivate = !Doc.UserDoc().defaultAclPrivate)} /> + <div className="acl-text">Default access private</div> + </div> </div>; } diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index 831c246d1..eea133ed9 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -158,7 +158,8 @@ export function ViewBoxAnnotatableComponent<P extends ViewBoxAnnotatableProps, T if (this.props.Document[AclSym]) { added.forEach(d => { for (const [key, value] of Object.entries(this.props.Document[AclSym])) { - distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true); + if (d.author === key.substring(4).replace("_", ".") && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true); + else distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true); } }); } diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index 837ae7e86..0feec3fbd 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -151,7 +151,7 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus if (this.props.Document[AclSym]) { added.forEach(d => { for (const [key, value] of Object.entries(this.props.Document[AclSym])) { - if (d.author === Doc.CurrentUserEmail && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true); + if (d.author === key.substring(4).replace("_", ".") && !d.aliasOf) distributeAcls(key, SharingPermissions.Admin, d, true); else distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true); } }); diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 6bfe91378..b535fea5a 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -770,6 +770,7 @@ export namespace Doc { } }); copy.author = Doc.CurrentUserEmail; + Doc.UserDoc().defaultAclPrivate && (copy["ACL-Public"] = "Not Shared"); return copy; } @@ -794,6 +795,7 @@ export namespace Doc { const applied = ApplyTemplateTo(templateDoc, target, targetKey, templateDoc.title + "(..." + _applyCount++ + ")"); target.layoutKey = targetKey; applied && (Doc.GetProto(applied).type = templateDoc.type); + Doc.UserDoc().defaultAclPrivate && (applied["ACL-Public"] = "Not Shared"); return applied; } return undefined; |