aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/LinkManager.ts4
-rw-r--r--src/client/util/SharingManager.tsx4
-rw-r--r--src/client/util/SnappingManager.ts5
-rw-r--r--src/fields/util.ts8
4 files changed, 10 insertions, 11 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);
+ }
}
diff --git a/src/fields/util.ts b/src/fields/util.ts
index fd409a54e..881f301f3 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -12,8 +12,6 @@ import { ScriptCast, StrCast, DateCast, Cast, NumCast } from "./Types";
import { returnZero } from "../Utils";
import CursorField from "./CursorField";
import { List } from "./List";
-import { listSpec } from "./Schema";
-import { DateField } from "./DateField";
import { SnappingManager } from "../client/util/SnappingManager";
function _readOnlySetter(): never {
@@ -167,7 +165,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number,
// if the current user is the author of the document / the current user is a member of the admin group
const userChecked = user || Doc.CurrentUserEmail;
if (userChecked === (target.__fields?.author || target.author)) return AclAdmin;
- if (SnappingManager.GetCachedGroups().includes("Admin")) return AclAdmin;
+ if (SnappingManager.GetCachedGroupByName("Admin")) return AclAdmin;
if (target[AclSym] && Object.keys(target[AclSym]).length) {
@@ -188,7 +186,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number,
// there are issues with storing fields with . in the name, so they are replaced with _ during creation
// as a result we need to restore them again during this comparison.
const entity = denormalizeEmail(key.substring(4)); // an individual or a group
- if (SnappingManager.GetCachedGroups().includes(entity) || userChecked === entity) {
+ if (SnappingManager.GetCachedGroupByName(entity) || userChecked === entity) {
if (HierarchyMapping.get(value as symbol)! > HierarchyMapping.get(effectiveAcl)!) {
effectiveAcl = value as symbol;
if (effectiveAcl === AclAdmin) return effectiveAcl;
@@ -369,7 +367,7 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
diff?.op === "$addToSet" ? { '$addToSet': { ["fields." + prop]: SerializationHelper.Serialize(new List<Doc>(diff.items)) } } :
diff?.op === "$remFromSet" ? { '$remFromSet': { ["fields." + prop]: SerializationHelper.Serialize(new List<Doc>(diff.items)) } }
: { '$set': { ["fields." + prop]: SerializationHelper.Serialize(value) } };
- !op['$set'] && ((op as any).length = diff.length);
+ !op.$set && ((op as any).length = diff.length);
const oldValue = current;
const newValue = ObjectField.MakeCopy(value);