From 915bb3796541116897dfc016a0ed3253c2f856cc Mon Sep 17 00:00:00 2001
From: anika-ahluwalia <anika.ahluwalia@gmail.com>
Date: Thu, 6 Aug 2020 19:22:37 -0500
Subject: temporary fix for novice tools

---
 src/client/views/nodes/DocumentView.tsx | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index b9e685b44..711ca8935 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -571,6 +571,17 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         } else {
             SelectionManager.DeselectAll();
             this.props.removeDocument?.(this.props.Document);
+            const recent = Cast(Doc.UserDoc().myRecentlyClosed, Doc) as Doc;
+            const selected = SelectionManager.SelectedDocuments().slice();
+            SelectionManager.DeselectAll();
+
+            selected.map(dv => {
+                const effectiveAcl = GetEffectiveAcl(dv.props.Document);
+                if (effectiveAcl === AclEdit || effectiveAcl === AclAdmin) { // deletes whatever you have the right to delete
+                    recent && Doc.AddDocToList(recent, "data", dv.props.Document, undefined, true, true);
+                    dv.props.removeDocument?.(dv.props.Document);
+                }
+            });
         }
     }
 
-- 
cgit v1.2.3-70-g09d2


From 42a8ba8f3021d4ccc56cfdf4fea1c0bad9d8e818 Mon Sep 17 00:00:00 2001
From: anika-ahluwalia <anika.ahluwalia@gmail.com>
Date: Fri, 7 Aug 2020 00:31:14 -0500
Subject: delete changes

---
 src/client/views/PropertiesButtons.tsx  | 8 +++++---
 src/client/views/nodes/DocumentView.tsx | 8 ++++----
 src/client/views/nodes/FontIconBox.tsx  | 2 --
 3 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'src/client/views/nodes/DocumentView.tsx')

diff --git a/src/client/views/PropertiesButtons.tsx b/src/client/views/PropertiesButtons.tsx
index 776b50838..a905dc1e7 100644
--- a/src/client/views/PropertiesButtons.tsx
+++ b/src/client/views/PropertiesButtons.tsx
@@ -3,7 +3,7 @@ import { faArrowAltCircleDown, faArrowAltCircleRight, faArrowAltCircleUp, faChec
 import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
 import { action, computed, observable, runInAction } from "mobx";
 import { observer } from "mobx-react";
-import { Doc, DocListCast } from "../../fields/Doc";
+import { Doc, DocListCast, AclEdit, AclAdmin } from "../../fields/Doc";
 import { RichTextField } from '../../fields/RichTextField';
 import { Cast, NumCast, BoolCast } from "../../fields/Types";
 import { emptyFunction, setupMoveUpEvents, Utils } from "../../Utils";
@@ -30,6 +30,7 @@ import { undoBatch, UndoManager } from '../util/UndoManager';
 import { DocumentType } from '../documents/DocumentTypes';
 import { InkField } from '../../fields/InkField';
 import { PresBox } from './nodes/PresBox';
+import { GetEffectiveAcl } from "../../fields/util";
 const higflyout = require("@hig/flyout");
 export const { anchorPoints } = higflyout;
 export const Flyout = higflyout.default;
@@ -428,10 +429,8 @@ export class PropertiesButtons extends React.Component<{}, {}> {
     @undoBatch
     @action
     deleteDocument = () => {
-        this.selectedDocumentView?.props.ContainingCollectionView?.removeDocument(this.selectedDocumentView?.props.Document);
         const recent = Cast(Doc.UserDoc().myRecentlyClosed, Doc) as Doc;
         const selected = SelectionManager.SelectedDocuments().slice();
-        SelectionManager.DeselectAll();
 
         selected.map(dv => {
             const effectiveAcl = GetEffectiveAcl(dv.props.Document);
@@ -440,6 +439,9 @@ export class PropertiesButtons extends React.Component<{}, {}> {
                 dv.props.removeDocument?.(dv.props.Document);
             }
         });
+        this.selectedDoc && (this.selectedDoc.deleted = true);
+        this.selectedDocumentView?.props.ContainingCollectionView?.removeDocument(this.selectedDocumentView?.props.Document);
+        SelectionManager.DeselectAll();
     }
 
     @computed
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 707b7d2a1..3592dc393 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -565,14 +565,11 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
         }
     }
 
-    @undoBatch
+    @undoBatch @action
     deleteClicked = (): void => {
         if (Doc.UserDoc().activeWorkspace === this.props.Document) {
             alert("Can't delete the active workspace");
         } else {
-            SelectionManager.DeselectAll();
-            this.props.Document.deleted = true;
-            this.props.removeDocument?.(this.props.Document);
             const recent = Cast(Doc.UserDoc().myRecentlyClosed, Doc) as Doc;
             const selected = SelectionManager.SelectedDocuments().slice();
             SelectionManager.DeselectAll();
@@ -584,6 +581,9 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
                     dv.props.removeDocument?.(dv.props.Document);
                 }
             });
+
+            this.props.Document.deleted = true;
+            this.props.removeDocument?.(this.props.Document);
         }
     }
 
diff --git a/src/client/views/nodes/FontIconBox.tsx b/src/client/views/nodes/FontIconBox.tsx
index c465bb3bd..95faabb48 100644
--- a/src/client/views/nodes/FontIconBox.tsx
+++ b/src/client/views/nodes/FontIconBox.tsx
@@ -59,8 +59,6 @@ export class FontIconBox extends DocComponent<FieldViewProps, FontIconDocument>(
     }
 
     render() {
-
-        console.log(Doc.UserDoc());
         const label = StrCast(this.rootDoc.label, StrCast(this.rootDoc.title));
         const color = StrCast(this.layoutDoc.color, this._foregroundColor);
         const backgroundColor = StrCast(this.layoutDoc._backgroundColor, StrCast(this.rootDoc.backgroundColor, this.props.backgroundColor?.(this.rootDoc)));
-- 
cgit v1.2.3-70-g09d2

