From 13c85ceb6637e5dbecbc1a9be3dd5915b3e4b95d Mon Sep 17 00:00:00 2001
From: usodhi <61431818+usodhi@users.noreply.github.com>
Date: Tue, 4 Aug 2020 17:32:13 +0530
Subject: owner's acl set when sharing menu opened

---
 src/client/util/SharingManager.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/client/util/SharingManager.tsx')

diff --git a/src/client/util/SharingManager.tsx b/src/client/util/SharingManager.tsx
index adfc8c2bf..97f94692d 100644
--- a/src/client/util/SharingManager.tsx
+++ b/src/client/util/SharingManager.tsx
@@ -88,7 +88,7 @@ export default class SharingManager extends React.Component<{}> {
             this.isOpen = true;
             this.permissions = SharingPermissions.Edit;
         });
-
+        this.targetDoc!.author === Doc.CurrentUserEmail && !this.targetDoc![`ACL-${Doc.CurrentUserEmail.replace(".", "_")}`] && distributeAcls(`ACL-${Doc.CurrentUserEmail.replace(".", "_")}`, SharingPermissions.Admin, this.targetDoc!);
     }
 
     public close = action(() => {
@@ -221,7 +221,10 @@ export default class SharingManager extends React.Component<{}> {
         const key = user.email.replace('.', '_');
         const ACL = `ACL-${key}`;
 
-        target.author === Doc.CurrentUserEmail && distributeAcls(ACL, permission as SharingPermissions, target);
+
+        if (target.author === Doc.CurrentUserEmail) {
+            distributeAcls(ACL, permission as SharingPermissions, target);
+        }
 
         if (permission !== SharingPermissions.None) {
             Doc.IndexOf(target, DocListCast(notificationDoc[storage])) === -1 && Doc.AddDocToList(notificationDoc, storage, target);
-- 
cgit v1.2.3-70-g09d2

