aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-16 19:37:50 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-16 19:37:50 -0400
commit7b3c348de46b07d3296fff1cafba13e568ef7494 (patch)
tree9c49bda8737224f41cb1db937d65625211861405 /src/fields/Doc.ts
parentb45ed3ca06509318c810e3a51844eacc95cb62e7 (diff)
parent4a0332994b38c8910077e6cc711e9e78c2964b67 (diff)
Merge branch 'master' into script_documents
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index ffef9a384..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;
}
}
@@ -442,7 +430,8 @@ export namespace Doc {
if (allowDuplicates !== true) {
const pind = list.reduce((l, d, i) => d instanceof Doc && d[Id] === doc[Id] ? i : l, -1);
if (pind !== -1) {
- list.splice(pind, 1);
+ return true;
+ //list.splice(pind, 1); // bcz: this causes schemaView docs in the Catalog to move to the bottom of the schema view when they are dragged even though they haven't left the collection
}
}
if (first) {