diff options
Diffstat (limited to 'src/fields')
-rw-r--r-- | src/fields/Doc.ts | 25 | ||||
-rw-r--r-- | src/fields/documentSchemas.ts | 8 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 981025483..6f712f2ed 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -93,7 +93,7 @@ export const HeightSym = Symbol("Height"); export const DataSym = Symbol("Data"); export const LayoutSym = Symbol("Layout"); export const AclSym = Symbol("Acl"); -export const AclPrivate = Symbol("AclNoAccess"); +export const AclPrivate = Symbol("AclOwnerOnly"); export const AclReadonly = Symbol("AclReadOnly"); export const AclAddonly = Symbol("AclAddonly"); export const UpdatingFromServer = Symbol("UpdatingFromServer"); @@ -102,13 +102,17 @@ const CachedUpdates = Symbol("Cached updates"); function fetchProto(doc: Doc) { if (doc.author !== Doc.CurrentUserEmail) { - if (doc.ACL === "noAccess") { - doc[AclSym] = AclPrivate; - return undefined; - } else if (doc.ACL === "readOnly") { - doc[AclSym] = AclReadonly; - } else if (doc.ACL === "addOnly") { - doc[AclSym] = AclAddonly; + const acl = Doc.Get(doc, "ACL", true); + switch (acl) { + case "ownerOnly": + doc[AclSym] = AclPrivate; + return undefined; + case "readOnly": + doc[AclSym] = AclReadonly; + break; + case "addOnly": + doc[AclSym] = AclAddonly; + break; } } @@ -116,7 +120,7 @@ function fetchProto(doc: Doc) { if (proto instanceof Promise) { proto.then(proto => { if (proto.author !== Doc.CurrentUserEmail) { - if (proto.ACL === "noAccess") { + if (proto.ACL === "ownerOnly") { proto[AclSym] = doc[AclSym] = AclPrivate; return undefined; } else if (proto.ACL === "readOnly") { @@ -483,6 +487,7 @@ 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; return alias; } @@ -685,7 +690,7 @@ export namespace Doc { } } }); - + copy["author"] = Doc.CurrentUserEmail; return copy; } diff --git a/src/fields/documentSchemas.ts b/src/fields/documentSchemas.ts index 31f589ec0..6474ed148 100644 --- a/src/fields/documentSchemas.ts +++ b/src/fields/documentSchemas.ts @@ -22,10 +22,10 @@ export const documentSchema = createSchema({ y: "number", // y coordinate when in a freeform view z: "number", // z "coordinate" - non-zero specifies the overlay layer of a freeformview zIndex: "number", // zIndex of a document in a freeform view - scrollY: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that ) - scrollX: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that ) - scrollTop: "number", // scroll position of a scrollable document (pdf, text, web) - scrollLeft: "number", // scroll position of a scrollable document (pdf, text, web) + _scrollY: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that ) + _scrollX: "number", // "command" to scroll a document to a position on load (the value will be reset to 0 after that ) + _scrollTop: "number", // scroll position of a scrollable document (pdf, text, web) + _scrollLeft: "number", // scroll position of a scrollable document (pdf, text, web) // appearance properties on the layout _autoHeight: "boolean", // whether the height of the document should be computed automatically based on its contents |