diff options
Diffstat (limited to 'src/client/util')
-rw-r--r-- | src/client/util/LinkManager.ts | 4 | ||||
-rw-r--r-- | src/client/util/SharingManager.tsx | 4 | ||||
-rw-r--r-- | src/client/util/SnappingManager.ts | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/client/util/LinkManager.ts b/src/client/util/LinkManager.ts index 0456b4029..e74ce87f8 100644 --- a/src/client/util/LinkManager.ts +++ b/src/client/util/LinkManager.ts @@ -1,6 +1,4 @@ import { Doc, DocListCast, Opt } from "../../fields/Doc"; -import { List } from "../../fields/List"; -import { listSpec } from "../../fields/Schema"; import { Cast, StrCast } from "../../fields/Types"; import { SharingManager } from "./SharingManager"; import { computedFn } from "mobx-utils"; @@ -71,7 +69,7 @@ export class LinkManager { related.push(...LinkManager.Instance.getAllRelatedLinks(anno)); }); return related; - }.bind(this)); + }.bind(this), true); // finds all links that contain the given anchor public getAllRelatedLinks(anchor: Doc): Doc[] { diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx index 271face98..0c8f19eae 100644 --- a/src/client/util/SharingManager.tsx +++ b/src/client/util/SharingManager.tsx @@ -473,7 +473,7 @@ export class SharingManager extends React.Component<{}> { const commonKeys = intersection(...docs.map(doc => this.layoutDocAcls ? doc?.[AclSym] && Object.keys(doc[AclSym]) : doc?.[DataSym]?.[AclSym] && Object.keys(doc[DataSym][AclSym]))); // the list of users shared with - const userListContents: (JSX.Element | null)[] = users.filter(({ user }) => docs.length > 1 ? commonKeys.includes(`acl-${normalizeEmail(user.email)}`) : docs[0]?.author !== user.email).map(({ user, sharingDoc, userColor }) => { + const userListContents: (JSX.Element | null)[] = users.filter(({ user }) => docs.length > 1 ? commonKeys.includes(`acl-${normalizeEmail(user.email)}`) : docs[0]?.author !== user.email).map(({ user, linkDatabase, sharingDoc, userColor }) => { const userKey = `acl-${normalizeEmail(user.email)}`; const uniform = docs.every(doc => this.layoutDocAcls ? doc?.[AclSym]?.[userKey] === docs[0]?.[AclSym]?.[userKey] : doc?.[DataSym]?.[AclSym]?.[userKey] === docs[0]?.[DataSym]?.[AclSym]?.[userKey]); const permissions = uniform ? StrCast(targetDoc?.[userKey]) : "-multiple-"; @@ -489,7 +489,7 @@ export class SharingManager extends React.Component<{}> { <select className={"permissions-dropdown"} value={permissions} - onChange={e => this.setInternalSharing({ user, sharingDoc: sharingDoc, userColor }, e.currentTarget.value)} + onChange={e => this.setInternalSharing({ user, linkDatabase, sharingDoc, userColor }, e.currentTarget.value)} > {this.sharingOptions(uniform)} </select> diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts index d067dff6c..a615f0247 100644 --- a/src/client/util/SnappingManager.ts +++ b/src/client/util/SnappingManager.ts @@ -1,4 +1,5 @@ import { observable, action, runInAction } from "mobx"; +import { computedFn } from "mobx-utils"; export namespace SnappingManager { @@ -32,6 +33,8 @@ export namespace SnappingManager { /// bcz; argh!! TODO; These do not belong here, but there were include order problems with leaving them in util.ts // need to investigate further what caused the mobx update problems and move to a better location. export function SetCachedGroups(groups: string[]) { manager.setCachedGroups(groups); } - export function GetCachedGroups() { return manager.cachedGroups; } + export function GetCachedGroupByName(name: string) { + return computedFn(function (name: string) { return manager.cachedGroups.includes(name); }, true)(name); + } } |