aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-02 09:22:38 -0400
committerbobzel <zzzman@gmail.com>2020-08-02 09:22:38 -0400
commit63fd10d0940331d68a9ce58b4b77734b11e393f5 (patch)
tree62f9aba141a38d229c238c20f491d75720324591 /src
parent4792b8875f27770882943c8dc0ef021d22a37c06 (diff)
fixed hiding of close button based on permsisions.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/DocumentDecorations.tsx4
-rw-r--r--src/client/views/pdf/PDFViewer.tsx2
-rw-r--r--src/fields/util.ts2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 6e6ffc893..7fc4a5c99 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -586,7 +586,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
if (SnappingManager.GetIsDragging() || bounds.r - bounds.x < 2 || bounds.x === Number.MAX_VALUE || !seldoc || this._hidden || isNaN(bounds.r) || isNaN(bounds.b) || isNaN(bounds.x) || isNaN(bounds.y)) {
return (null);
}
- const canDelete = SelectionManager.SelectedDocuments().map(docView => GetEffectiveAcl(docView.props.Document)).some(permission => permission === AclAdmin || permission === AclEdit);
+ const canDelete = SelectionManager.SelectedDocuments().map(docView => GetEffectiveAcl(docView.props.ContainingCollectionDoc)).some(permission => permission === AclAdmin || permission === AclEdit);
const minimal = bounds.r - bounds.x < 100 ? true : false;
const maximizeIcon = minimal ? (
<Tooltip title={<><div className="dash-tooltip">Show context menu</div></>} placement="top">
@@ -597,7 +597,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
<div className="documentDecorations-closeButton" onClick={this.onCloseClick}>
{/* Currently, this is set to be enabled if there is no ink selected. It might be interesting to think about minimizing ink if it's useful? -syip2*/}
<FontAwesomeIcon className="documentdecorations-times" icon={faTimes} size="lg" />
- </div></Tooltip>) : null;
+ </div></Tooltip>) : (null);
const titleArea = this._edtingTitle ?
<>
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index b81baf417..5a43a076b 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -568,7 +568,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
const effectiveAcl = GetEffectiveAcl(this.props.Document);
const annotationDoc = [AclAddonly, AclEdit, AclAdmin].includes(effectiveAcl) && this.makeAnnotationDocument(color);
annotationDoc && this.addDocument?.(annotationDoc);
- return annotationDoc ?? undefined;
+ return annotationDoc as Doc ?? undefined;
}
/**
diff --git a/src/fields/util.ts b/src/fields/util.ts
index d6d9718f2..957b2c8cd 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -10,6 +10,7 @@ import { DocServer } from "../client/DocServer";
import { ComputedField } from "./ScriptField";
import { ScriptCast, StrCast } from "./Types";
import { returnZero } from "../Utils";
+import { addSyntheticLeadingComment } from "typescript";
function _readOnlySetter(): never {
@@ -155,6 +156,7 @@ export enum SharingPermissions {
* Calculates the effective access right to a document for the current user.
*/
export function GetEffectiveAcl(target: any, in_prop?: string | symbol | number): symbol {
+ if (!target) return AclPrivate;
if (in_prop === UpdatingFromServer || target[UpdatingFromServer]) return AclAdmin;
if (target[AclSym] && Object.keys(target[AclSym]).length) {