From 9b35b84d09818be36972e90a2b43dc1a6b156ca6 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Fri, 18 Nov 2022 17:38:04 +0700
Subject: [PATCH 01/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 67091d53c92c..89ad9d9d26b7 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -301,7 +301,7 @@ class WorkspaceMembersPage extends React.Component {
         const removableMembers = [];
         let data = [];
         _.each(policyMemberList, (policyMember, email) => {
-            if (policyMember.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { return; }
+            // if (policyMember.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { return; }
             if (email !== this.props.session.email && email !== this.props.policy.owner) {
                 removableMembers.push(email);
             }

From 9ae6d4493483762ee2fe3e2acb303358d4a56732 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Sat, 19 Nov 2022 13:35:09 +0700
Subject: [PATCH 02/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 89ad9d9d26b7..e325c1e9ff8c 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -301,7 +301,6 @@ class WorkspaceMembersPage extends React.Component {
         const removableMembers = [];
         let data = [];
         _.each(policyMemberList, (policyMember, email) => {
-            // if (policyMember.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { return; }
             if (email !== this.props.session.email && email !== this.props.policy.owner) {
                 removableMembers.push(email);
             }

From 6a220f57d73fb8ac27ce18ae0487af92e242ef71 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Mon, 21 Nov 2022 23:17:16 +0700
Subject: [PATCH 03/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index e325c1e9ff8c..5d0ef4f6d658 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -301,7 +301,7 @@ class WorkspaceMembersPage extends React.Component {
         const removableMembers = [];
         let data = [];
         _.each(policyMemberList, (policyMember, email) => {
-            if (email !== this.props.session.email && email !== this.props.policy.owner) {
+            if (email !== this.props.session.email && email !== this.props.policy.owner && policyMember.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
                 removableMembers.push(email);
             }
             const details = lodashGet(this.props.personalDetails, email, {displayName: email, login: email, avatar: Expensicons.FallbackAvatar});

From affe60b42dcc3077577783d990f5057ad24cba1a Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Tue, 22 Nov 2022 22:11:14 +0700
Subject: [PATCH 04/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 5d0ef4f6d658..e22013a78e17 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -261,7 +261,7 @@ class WorkspaceMembersPage extends React.Component {
                     >
                         <CheckboxWithTooltip
                             style={[styles.peopleRowCell]}
-                            isChecked={_.contains(this.state.selectedEmployees, item.login)}
+                            isChecked={_.contains(this.state.selectedEmployees, item.login) && item.pendingDelete === false}
                             disabled={!canBeRemoved}
                             onPress={() => this.toggleUser(item.login)}
                             toggleTooltip={this.state.showTooltipForLogin === item.login}
@@ -305,9 +305,11 @@ class WorkspaceMembersPage extends React.Component {
                 removableMembers.push(email);
             }
             const details = lodashGet(this.props.personalDetails, email, {displayName: email, login: email, avatar: Expensicons.FallbackAvatar});
+            const pendingDelete = policyMember.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
             data.push({
                 ...policyMember,
                 ...details,
+                pendingDelete,
             });
         });
         data = _.sortBy(data, value => value.displayName.toLowerCase());

From b4b7e87e6a7dcaa1da810e525fcaf53be0a125bf Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Wed, 23 Nov 2022 13:41:04 +0700
Subject: [PATCH 05/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index e22013a78e17..88dda3f18f2b 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -256,22 +256,22 @@ class WorkspaceMembersPage extends React.Component {
                 <Hoverable onHoverIn={() => this.willTooltipShowForLogin(item.login, true)} onHoverOut={() => this.setState({showTooltipForLogin: ''})}>
                     <TouchableOpacity
                         style={[styles.peopleRow, !item.errors && styles.peopleRowBorderBottom, !canBeRemoved && styles.cursorDisabled]}
-                        onPress={() => this.toggleUser(item.login)}
+                        onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
                         activeOpacity={0.7}
                     >
                         <CheckboxWithTooltip
                             style={[styles.peopleRowCell]}
                             isChecked={_.contains(this.state.selectedEmployees, item.login) && item.pendingDelete === false}
-                            disabled={!canBeRemoved}
-                            onPress={() => this.toggleUser(item.login)}
+                            disabled={!canBeRemoved || item.pendingDelete === true}
+                            onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
                             toggleTooltip={this.state.showTooltipForLogin === item.login}
                             text={this.props.translate('workspace.people.error.cannotRemove')}
                         />
                         <View style={styles.flex1}>
                             <OptionRow
-                                onSelectRow={() => this.toggleUser(item.login)}
+                                onSelectRow={() => item.pendingDelete === false && this.toggleUser(item.login)}
                                 forceTextUnreadStyle
-                                isDisabled={!canBeRemoved}
+                                isDisabled={!canBeRemoved || item.pendingDelete === true}
                                 option={{
                                     text: Str.removeSMSDomain(item.displayName),
                                     alternateText: Str.removeSMSDomain(item.login),
@@ -316,6 +316,8 @@ class WorkspaceMembersPage extends React.Component {
         const policyID = lodashGet(this.props.route, 'params.policyID');
         const policyName = lodashGet(this.props.policy, 'name');
 
+        console.log(this.state.selectedEmployees);
+
         return (
             <ScreenWrapper style={[styles.defaultModalContainer]}>
                 <FullPageNotFoundView shouldShow={_.isEmpty(this.props.policy)}>

From 89592090f26f95ada624256c4272bda705072f08 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Wed, 23 Nov 2022 13:49:35 +0700
Subject: [PATCH 06/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 88dda3f18f2b..85563757798a 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -315,9 +315,6 @@ class WorkspaceMembersPage extends React.Component {
         data = _.sortBy(data, value => value.displayName.toLowerCase());
         const policyID = lodashGet(this.props.route, 'params.policyID');
         const policyName = lodashGet(this.props.policy, 'name');
-
-        console.log(this.state.selectedEmployees);
-
         return (
             <ScreenWrapper style={[styles.defaultModalContainer]}>
                 <FullPageNotFoundView shouldShow={_.isEmpty(this.props.policy)}>

From 71e06581fab7774ef18d5fa71255b7d508b66675 Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:11:19 +0700
Subject: [PATCH 07/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 85563757798a..d61807cd3b51 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -256,7 +256,7 @@ class WorkspaceMembersPage extends React.Component {
                 <Hoverable onHoverIn={() => this.willTooltipShowForLogin(item.login, true)} onHoverOut={() => this.setState({showTooltipForLogin: ''})}>
                     <TouchableOpacity
                         style={[styles.peopleRow, !item.errors && styles.peopleRowBorderBottom, !canBeRemoved && styles.cursorDisabled]}
-                        onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
+                        onPress={() => this.toggleUser(item.login, item.pendingAction)}
                         activeOpacity={0.7}
                     >
                         <CheckboxWithTooltip

From be1805b5a8bec39b27ccbb3a83690f1cf0748018 Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:11:34 +0700
Subject: [PATCH 08/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index d61807cd3b51..40226b0f0e39 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -261,7 +261,7 @@ class WorkspaceMembersPage extends React.Component {
                     >
                         <CheckboxWithTooltip
                             style={[styles.peopleRowCell]}
-                            isChecked={_.contains(this.state.selectedEmployees, item.login) && item.pendingDelete === false}
+                            isChecked={_.contains(this.state.selectedEmployees, item.login)}
                             disabled={!canBeRemoved || item.pendingDelete === true}
                             onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
                             toggleTooltip={this.state.showTooltipForLogin === item.login}

From fd30bd82b95b93d97e5925353cd3278e17f7b53a Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:11:44 +0700
Subject: [PATCH 09/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 40226b0f0e39..1398398a1bd8 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -262,7 +262,7 @@ class WorkspaceMembersPage extends React.Component {
                         <CheckboxWithTooltip
                             style={[styles.peopleRowCell]}
                             isChecked={_.contains(this.state.selectedEmployees, item.login)}
-                            disabled={!canBeRemoved || item.pendingDelete === true}
+                            disabled={!canBeRemoved}
                             onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
                             toggleTooltip={this.state.showTooltipForLogin === item.login}
                             text={this.props.translate('workspace.people.error.cannotRemove')}

From e9c4c8f3e65bae334e22bd20ad7a5bc6f7d7efbc Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:11:51 +0700
Subject: [PATCH 10/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 1398398a1bd8..62eeae1abe4a 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -263,7 +263,7 @@ class WorkspaceMembersPage extends React.Component {
                             style={[styles.peopleRowCell]}
                             isChecked={_.contains(this.state.selectedEmployees, item.login)}
                             disabled={!canBeRemoved}
-                            onPress={() => item.pendingDelete === false && this.toggleUser(item.login)}
+                            onPress={() => this.toggleUser(item.login, item.pendingAction)}
                             toggleTooltip={this.state.showTooltipForLogin === item.login}
                             text={this.props.translate('workspace.people.error.cannotRemove')}
                         />

From 33b41d75547272530653095d93592a618f0ad5cc Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:12:05 +0700
Subject: [PATCH 11/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 62eeae1abe4a..e5b4268975ca 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -309,7 +309,6 @@ class WorkspaceMembersPage extends React.Component {
             data.push({
                 ...policyMember,
                 ...details,
-                pendingDelete,
             });
         });
         data = _.sortBy(data, value => value.displayName.toLowerCase());

From 1981225377d5846d19f4e5970d738a325d8414e5 Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:12:18 +0700
Subject: [PATCH 12/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index e5b4268975ca..15136ef6bffc 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -305,7 +305,6 @@ class WorkspaceMembersPage extends React.Component {
                 removableMembers.push(email);
             }
             const details = lodashGet(this.props.personalDetails, email, {displayName: email, login: email, avatar: Expensicons.FallbackAvatar});
-            const pendingDelete = policyMember.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
             data.push({
                 ...policyMember,
                 ...details,

From 068fa39ca63d64685b1affd6850a5060641e1a23 Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:12:27 +0700
Subject: [PATCH 13/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index 15136ef6bffc..f362b5c999c4 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -271,7 +271,7 @@ class WorkspaceMembersPage extends React.Component {
                             <OptionRow
                                 onSelectRow={() => item.pendingDelete === false && this.toggleUser(item.login)}
                                 forceTextUnreadStyle
-                                isDisabled={!canBeRemoved || item.pendingDelete === true}
+                                isDisabled={!canBeRemoved}
                                 option={{
                                     text: Str.removeSMSDomain(item.displayName),
                                     alternateText: Str.removeSMSDomain(item.login),

From 598e4ece94e90245c984ee3f900abf6ab0404813 Mon Sep 17 00:00:00 2001
From: tienifr <113963320+tienifr@users.noreply.github.com>
Date: Wed, 23 Nov 2022 18:12:35 +0700
Subject: [PATCH 14/15] Update src/pages/workspace/WorkspaceMembersPage.js

Co-authored-by: Sobit Neupane <073bct543.sobit@pcampus.edu.np>
---
 src/pages/workspace/WorkspaceMembersPage.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index f362b5c999c4..d83303a607d2 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -269,7 +269,7 @@ class WorkspaceMembersPage extends React.Component {
                         />
                         <View style={styles.flex1}>
                             <OptionRow
-                                onSelectRow={() => item.pendingDelete === false && this.toggleUser(item.login)}
+                                onSelectRow={() => this.toggleUser(item.login, item.pendingAction)}
                                 forceTextUnreadStyle
                                 isDisabled={!canBeRemoved}
                                 option={{

From bd976e88eefdd8b6e4df0b412f442344695dc1e6 Mon Sep 17 00:00:00 2001
From: tienifr <christianwen18@gmail.com>
Date: Wed, 23 Nov 2022 18:19:36 +0700
Subject: [PATCH 15/15] fix: issue

---
 src/pages/workspace/WorkspaceMembersPage.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js
index d83303a607d2..6ff197f4f55e 100644
--- a/src/pages/workspace/WorkspaceMembersPage.js
+++ b/src/pages/workspace/WorkspaceMembersPage.js
@@ -152,9 +152,11 @@ class WorkspaceMembersPage extends React.Component {
      * Toggle user from the selectedEmployees list
      *
      * @param {String} login
+     * @param {String} pendingAction
+     *
      */
-    toggleUser(login) {
-        if (this.willTooltipShowForLogin(login)) {
+    toggleUser(login, pendingAction) {
+        if (this.willTooltipShowForLogin(login) || pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
             return;
         }
 
@@ -250,7 +252,7 @@ class WorkspaceMembersPage extends React.Component {
     renderItem({
         item,
     }) {
-        const canBeRemoved = this.props.policy.owner !== item.login && this.props.session.email !== item.login;
+        const canBeRemoved = this.props.policy.owner !== item.login && this.props.session.email !== item.login && item.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
         return (
             <OfflineWithFeedback errorRowStyles={[styles.peopleRowBorderBottom]} onClose={() => this.dismissError(item)} pendingAction={item.pendingAction} errors={item.errors}>
                 <Hoverable onHoverIn={() => this.willTooltipShowForLogin(item.login, true)} onHoverOut={() => this.setState({showTooltipForLogin: ''})}>
@@ -313,6 +315,7 @@ class WorkspaceMembersPage extends React.Component {
         data = _.sortBy(data, value => value.displayName.toLowerCase());
         const policyID = lodashGet(this.props.route, 'params.policyID');
         const policyName = lodashGet(this.props.policy, 'name');
+
         return (
             <ScreenWrapper style={[styles.defaultModalContainer]}>
                 <FullPageNotFoundView shouldShow={_.isEmpty(this.props.policy)}>
