aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-15 19:27:59 -0700
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-15 19:27:59 -0700
commit099a1942440efc2784bc9b2c5896777cf85842ec (patch)
tree56a598398fab001fb6625e20fb8c9797f71c733d /src/fields/Doc.ts
parent3cb0b3aac05d9525d6deb4683328ce1309beee32 (diff)
parent163e1f579d5a6b111645953b12e665839694585c (diff)
pull from master and cleaning up code
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..b205a4a10 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(proto => fetchProto(proto));
+ 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) {