aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-08-17 17:45:08 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-08-17 17:45:08 -0500
commit4eb34dd81ebf0b5f64c4552265dd55ec0290e332 (patch)
tree719778179122aba9bfb9d66abf15171a6dfdb93f /src/fields/Doc.ts
parent5adf15574ac6423e09617b3d756d98ea8cdc75c5 (diff)
parent39e49bbb6943a546123765f8969ea4f054157ae5 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into menu_restructure
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index ea53bc9a2..0dcb8ab42 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -195,6 +195,8 @@ export class Doc extends RefField {
@observable
private ___fieldKeys: any = {};
+ @observable
+ public [AclSym]: { [key: string]: symbol };
private [UpdatingFromServer]: boolean = false;
@@ -204,17 +206,9 @@ export class Doc extends RefField {
private [Self] = this;
private [SelfProxy]: any;
- public [FieldsSym] = (clear?: boolean) => {
- if (clear) {
- this.___fields = {};
- this.___fieldKeys = {};
- }
- return this.___fields;
- }
- @observable
- public [AclSym]: { [key: string]: symbol };
- public [WidthSym] = () => NumCast(this[SelfProxy]._width);
- public [HeightSym] = () => NumCast(this[SelfProxy]._height);
+ public [FieldsSym](clear?: boolean) { return clear ? this.___fields = this.___fieldKeys = {} : this.___fields; }
+ public [WidthSym]() { return NumCast(this[SelfProxy]._width); }
+ public [HeightSym]() { return NumCast(this[SelfProxy]._height); }
public [ToScriptString]() { return `DOC-"${this[Self][Id]}"-`; }
public [ToString]() { return `Doc(${GetEffectiveAcl(this) === AclPrivate ? "-inaccessible-" : this.title})`; }
public get [LayoutSym]() { return this[SelfProxy].__LAYOUT__; }
@@ -781,6 +775,7 @@ export namespace Doc {
if (doc) {
const delegate = new Doc(id, true);
delegate.proto = doc;
+ delegate.author = Doc.CurrentUserEmail;
title && (delegate.title = title);
return delegate;
}
@@ -790,7 +785,9 @@ export namespace Doc {
let _applyCount: number = 0;
export function ApplyTemplate(templateDoc: Doc) {
if (templateDoc) {
- const target = Doc.MakeDelegate(new Doc());
+ const proto = new Doc();
+ proto.author = Doc.CurrentUserEmail;
+ const target = Doc.MakeDelegate(proto);
const targetKey = StrCast(templateDoc.layoutKey, "layout");
const applied = ApplyTemplateTo(templateDoc, target, targetKey, templateDoc.title + "(..." + _applyCount++ + ")");
target.layoutKey = targetKey;