aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-08-06 19:51:25 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-08-06 19:51:25 +0530
commit3e4329b81d96f139f38eeb182afcbd8359dcd171 (patch)
tree85ec890c68b240506e4255c8549a7f4586886c0b /src
parent6bd5f0b4d211d0395fd5035a5f17d33bb2399976 (diff)
alias and acl related fixes
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/Documents.ts1
-rw-r--r--src/client/views/collections/CollectionView.tsx3
-rw-r--r--src/client/views/collections/collectionFreeForm/PropertiesView.tsx20
-rw-r--r--src/fields/Doc.ts4
-rw-r--r--src/fields/util.ts2
5 files changed, 17 insertions, 13 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 7719b3eef..61a44a39d 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -565,6 +565,7 @@ export namespace Docs {
// without this, if a doc has no annotations but the user has AddOnly privileges, they won't be able to add an annotation because they would have needed to create the field's list which they don't have permissions to do.
dataDoc[fieldKey + "-annotations"] = new List<Doc>();
+ dataDoc.aliases = new List<Doc>();
proto.links = ComputedField.MakeFunction("links(self)");
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index dcd5a31f6..4d1cb670c 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -151,7 +151,8 @@ 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])) {
- distributeAcls(key, this.AclMap.get(value) as SharingPermissions, d, true);
+ if (d.author === Doc.CurrentUserEmail && !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/collectionFreeForm/PropertiesView.tsx b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
index d22c00b1f..5634a438a 100644
--- a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
+++ b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx
@@ -25,6 +25,7 @@ import "./FormatShapePane.scss";
import { discovery_v1 } from "googleapis";
import { PresBox } from "../../nodes/PresBox";
import { DocumentManager } from "../../../util/DocumentManager";
+import FormatShapePane from "./FormatShapePane";
const higflyout = require("@hig/flyout");
export const { anchorPoints } = higflyout;
export const Flyout = higflyout.default;
@@ -51,8 +52,8 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@computed get selectedDocumentView() {
if (SelectionManager.SelectedDocuments().length) {
return SelectionManager.SelectedDocuments()[0];
- } else if (PresBox.Instance._selectedArray.length >= 1) {
- return DocumentManager.Instance.getDocumentView(PresBox.Instance.rootDoc);
+ } else if (PresBox.Instance?._selectedArray.length >= 1) {
+ return DocumentManager.Instance.getDocumentView(PresBox.Instance?.rootDoc);
} else { return undefined; }
}
@computed get isPres(): boolean {
@@ -72,6 +73,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
@observable openTransform: boolean = true;
// @observable selectedUser: string = "";
// @observable addButtonPressed: boolean = false;
+
//Pres Trails booleans:
@observable openAddSlide: boolean = true;
@observable openPresentationTools: boolean = true;
@@ -957,9 +959,9 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
<div className="propertiesView-name">
{this.editableTitle}
<div className="propertiesView-presSelected">
- {PresBox.Instance._selectedArray.length} selected
+ {PresBox.Instance?._selectedArray.length} selected
<div className="propertiesView-selectedList">
- {PresBox.Instance.listOfSelected}
+ {PresBox.Instance?.listOfSelected}
</div>
</div>
</div>
@@ -973,7 +975,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>
</div>
{this.openAddSlide ? <div className="propertiesView-settings-content">
- {PresBox.Instance.newDocumentDropdown}
+ {PresBox.Instance?.newDocumentDropdown}
</div> : null}
</div>
<div className="propertiesView-sharing">
@@ -986,7 +988,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>
</div>
{this.openPresTransitions ? <div className="propertiesView-sharing-content">
- {PresBox.Instance.transitionDropdown}
+ {PresBox.Instance?.transitionDropdown}
</div> : null}
</div>
<div className="propertiesView-sharing">
@@ -999,20 +1001,20 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
</div>
</div>
{this.openPresProgressivize ? <div className="propertiesView-sharing-content">
- {PresBox.Instance.progressivizeDropdown}
+ {PresBox.Instance?.progressivizeDropdown}
</div> : null}
</div>
<div className="propertiesView-sharing">
<div className="propertiesView-sharing-title"
onPointerDown={() => runInAction(() => { this.openSlideOptions = !this.openSlideOptions; })}
style={{ backgroundColor: this.openSlideOptions ? "black" : "" }}>
- &nbsp; <FontAwesomeIcon icon={"cog"} /> &nbsp; {PresBox.Instance.stringType} options
+ &nbsp; <FontAwesomeIcon icon={"cog"} /> &nbsp; {PresBox.Instance?.stringType} options
<div className="propertiesView-sharing-title-icon">
<FontAwesomeIcon icon={this.openSlideOptions ? "caret-down" : "caret-right"} size="lg" color="white" />
</div>
</div>
{this.openSlideOptions ? <div className="propertiesView-sharing-content">
- {PresBox.Instance.optionsDropdown}
+ {PresBox.Instance?.optionsDropdown}
</div> : null}
</div>
<div className="propertiesView-sharing">
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index 6163fedbb..6bfe91378 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -508,9 +508,9 @@ export namespace Doc {
alias.aliasOf = doc;
alias.title = ComputedField.MakeFunction(`renameAlias(this, ${Doc.GetProto(doc).aliasNumber = NumCast(Doc.GetProto(doc).aliasNumber) + 1})`);
alias.author = Doc.CurrentUserEmail;
+ alias[AclSym] = doc[AclSym];
- if (!doc.aliases) doc.aliases = new List<Doc>([alias]);
- else Doc.AddDocToList(doc, "aliases", alias);
+ Doc.AddDocToList(doc[DataSym], "aliases", alias);
return alias;
}
diff --git a/src/fields/util.ts b/src/fields/util.ts
index 44a3317db..4c71572db 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -220,7 +220,7 @@ export function distributeAcls(key: string, acl: SharingPermissions, target: Doc
// maps over the aliases of the document
if (target.aliases) {
DocListCast(target.aliases).map(alias => {
- distributeAcls(key, acl, alias);
+ distributeAcls(key, acl, alias, inheritingFromCollection);
});
}