aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-06-15 18:00:25 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-06-15 18:00:25 -0400
commit182aef3ef47a3005e1b8a60bad8195769ce07733 (patch)
treee791fba45183e512a008cf446c6e6041fdd25659 /src/fields
parent279e71d098053dc2ca5b69e6e502a95dab230daa (diff)
fixed acls for text hyperlinks (mostly) by not allowing links to be traversed
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/Doc.ts20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index a72088d04..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;
}
}