diff options
author | bobzel <zzzman@gmail.com> | 2020-10-02 00:34:30 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-10-02 00:34:30 -0400 |
commit | 1dee63242684f02543cf7667b53baa00d10ab6c1 (patch) | |
tree | 105996e5a21d9e242c338496dc9c44fcf7a66dc4 /src | |
parent | 3c7f85dbcddca0ffacd82c2d39e88bba8c4b3f3a (diff) |
fixed email (de)normalization. fixed sharing to hide objects whose permissions have been revoked
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 7 | ||||
-rw-r--r-- | src/client/views/nodes/FontIconBox.tsx | 2 | ||||
-rw-r--r-- | src/fields/util.ts | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 649b8c175..fa80c8062 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -1,6 +1,6 @@ import { action, computed, IReactionDisposer, reaction, observable, runInAction } from "mobx"; import CursorField from "../../../fields/CursorField"; -import { Doc, Opt, Field, DocListCast } from "../../../fields/Doc"; +import { Doc, Opt, Field, DocListCast, AclPrivate } from "../../../fields/Doc"; import { Id, ToString } from "../../../fields/FieldSymbols"; import { List } from "../../../fields/List"; import { listSpec } from "../../../fields/Schema"; @@ -101,7 +101,10 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: get childLayoutPairs(): { layout: Doc; data: Doc; }[] { const { Document, DataDoc } = this.props; - const validPairs = this.childDocs.map(doc => Doc.GetLayoutDataDocPair(Document, !this.props.annotationsKey ? DataDoc : undefined, doc)).filter(pair => pair.layout); + const validPairs = this.childDocs.map(doc => Doc.GetLayoutDataDocPair(Document, !this.props.annotationsKey ? DataDoc : undefined, doc)). + filter(pair => { // filter out any documents that have a proto that we don't have permissions to (which we determine by not having any keys + return pair.layout && (!pair.layout.proto || (pair.layout.proto instanceof Doc && Object.keys(pair.layout.proto).length)); + }); return validPairs.map(({ data, layout }) => ({ data: data as Doc, layout: layout! })); // this mapping is a bit of a hack to coerce types } get childDocList() { diff --git a/src/client/views/nodes/FontIconBox.tsx b/src/client/views/nodes/FontIconBox.tsx index 6e96513c7..156256fe5 100644 --- a/src/client/views/nodes/FontIconBox.tsx +++ b/src/client/views/nodes/FontIconBox.tsx @@ -105,7 +105,7 @@ export class FontIconBadge extends React.Component<FontIconBadgeProps> { render() { if (!(this.props.collection instanceof Doc)) return (null); - const length = DocListCast(this.props.collection.data).length; + const length = DocListCast(this.props.collection.data).filter(d => Object.keys(d).length).length; // filter out any documents that we can't read return <div className="fontIconBadge-container" style={{ width: 15, height: 15, top: 12 }} ref={this._notifsRef}> <div className="fontIconBadge" style={length > 0 ? { "display": "initial" } : { "display": "none" }} onPointerDown={this.onPointerDown} > diff --git a/src/fields/util.ts b/src/fields/util.ts index 6c92aef81..4da9fce74 100644 --- a/src/fields/util.ts +++ b/src/fields/util.ts @@ -117,10 +117,10 @@ export function OVERRIDE_acl(val: boolean) { } export function normalizeEmail(email: string) { - return email.replace('.', '__'); + return email.replace(/\./g, '__'); } export function denormalizeEmail(email: string) { - return email.replace('__', '.'); + return email.replace(/__/g, '.'); } // playground mode allows the user to add/delete documents or make layout changes without them saving to the server |