diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-16 00:23:42 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-16 00:23:42 -0500 |
commit | 5a1a8b2c19bda271e6471e457fad59094c5c0449 (patch) | |
tree | 7fbec72a4dd9aa1a4d5e3d06e32470b5b1c44147 /src/fields/Doc.ts | |
parent | e2c60eaad49da3d0485b6f5f236fb0aabb84bef0 (diff) | |
parent | aee958a85c61927970e55ede004c91a0251a9405 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_schema_view
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index a72088d04..70aa2d60b 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -100,7 +100,7 @@ export const UpdatingFromServer = Symbol("UpdatingFromServer"); const CachedUpdates = Symbol("Cached updates"); -function fetchProto(doc: Doc) { +export function fetchProto(doc: Doc) { if (doc.author !== Doc.CurrentUserEmail) { const acl = Doc.Get(doc, "ACL", true); switch (acl) { @@ -116,21 +116,9 @@ function fetchProto(doc: Doc) { } } - const proto = doc.proto; - if (proto instanceof Promise) { - proto.then(proto => { - if (proto.author !== Doc.CurrentUserEmail) { - if (proto.ACL === "ownerOnly") { - proto[AclSym] = doc[AclSym] = AclPrivate; - return undefined; - } else if (proto.ACL === "readOnly") { - proto[AclSym] = doc[AclSym] = AclReadonly; - } else if (proto.ACL === "addOnly") { - proto[AclSym] = doc[AclSym] = AclAddonly; - } - } - }); - return proto; + if (doc.proto instanceof Promise) { + doc.proto.then(fetchProto); + return doc.proto; } } |