aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/DocServer.ts3
-rw-r--r--src/client/util/SettingsManager.tsx2
-rw-r--r--src/fields/util.ts12
3 files changed, 7 insertions, 10 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index f5ee6da3c..6fa8cf909 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -9,7 +9,6 @@ import GestureOverlay from './views/GestureOverlay';
import MobileInkOverlay from '../mobile/MobileInkOverlay';
import { runInAction } from 'mobx';
import { ObjectField } from '../fields/ObjectField';
-import { getPlaygroundMode } from '../fields/util';
/**
* This class encapsulates the transfer and cross-client synchronization of
@@ -452,7 +451,7 @@ export namespace DocServer {
}
function _UpdateFieldImpl(id: string, diff: any) {
- (!getPlaygroundMode()) && Utils.Emit(_socket, MessageStore.UpdateField, { id, diff });
+ (!DocServer.Control.isReadOnly()) && Utils.Emit(_socket, MessageStore.UpdateField, { id, diff });
}
let _UpdateField: (id: string, diff: any) => void = errorFunc;
diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index fbdceb43e..207c78964 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -14,7 +14,6 @@ import { Doc } from "../../fields/Doc";
import GroupManager from "./GroupManager";
import HypothesisAuthenticationManager from "../apis/HypothesisAuthenticationManager";
import GoogleAuthenticationManager from "../apis/GoogleAuthenticationManager";
-import { togglePlaygroundMode } from "../../fields/util";
import { DocServer } from "../DocServer";
library.add(fa.faTimes);
@@ -101,7 +100,6 @@ export default class SettingsManager extends React.Component<{}> {
@action
togglePlaygroundMode = () => {
- //togglePlaygroundMode();
this.playgroundMode = !this.playgroundMode;
if (this.playgroundMode) DocServer.Control.makeReadOnly();
else DocServer.Control.makeEditable();
diff --git a/src/fields/util.ts b/src/fields/util.ts
index 608ef506c..d6d9718f2 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -74,7 +74,7 @@ const _setterImpl = action(function (target: any, prop: string | symbol | number
const fromServer = target[UpdatingFromServer];
const sameAuthor = fromServer || (receiver.author === Doc.CurrentUserEmail);
const writeToDoc = sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAdmin || (writeMode !== DocServer.WriteMode.LiveReadonly);
- const writeToServer = (sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAdmin || writeMode === DocServer.WriteMode.Default) && !playgroundMode;
+ const writeToServer = (sameAuthor || effectiveAcl === AclEdit || effectiveAcl === AclAdmin || writeMode === DocServer.WriteMode.Default) && !DocServer.Control.isReadOnly();// && !playgroundMode;
if (writeToDoc) {
if (value === undefined) {
@@ -116,11 +116,11 @@ export function OVERRIDE_ACL(val: boolean) {
}
// playground mode allows the user to add/delete documents or make layout changes without them saving to the server
-let playgroundMode = false;
+// let playgroundMode = false;
-export function togglePlaygroundMode() {
- playgroundMode = !playgroundMode;
-}
+// export function togglePlaygroundMode() {
+// playgroundMode = !playgroundMode;
+// }
// the list of groups that the current user is a member of
let currentUserGroups: string[] = [];
@@ -186,7 +186,7 @@ export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number)
}
}
// if we're in playground mode, return AclEdit (or AclAdmin if that's the user's effectiveAcl)
- return playgroundMode && HierarchyMapping.get(effectiveAcl)! < 3 ? AclEdit : effectiveAcl;
+ return DocServer?.Control?.isReadOnly?.() && HierarchyMapping.get(effectiveAcl)! < 3 ? AclEdit : effectiveAcl;
}
return AclAdmin;
}