Skip to content

Commit

Permalink
Merge pull request Expensify#12878 from tienifr/fix/12066-PR2
Browse files Browse the repository at this point in the history
Fix/12077: Manage members - When removing a user offline from workspace, user is not crossed out
  • Loading branch information
Julesssss authored Nov 24, 2022
2 parents d0fbcf8 + bd976e8 commit 159f8ec
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -250,26 +252,26 @@ 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: ''})}>
<TouchableOpacity
style={[styles.peopleRow, !item.errors && styles.peopleRowBorderBottom, !canBeRemoved && styles.cursorDisabled]}
onPress={() => this.toggleUser(item.login)}
onPress={() => this.toggleUser(item.login, item.pendingAction)}
activeOpacity={0.7}
>
<CheckboxWithTooltip
style={[styles.peopleRowCell]}
isChecked={_.contains(this.state.selectedEmployees, item.login)}
disabled={!canBeRemoved}
onPress={() => 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')}
/>
<View style={styles.flex1}>
<OptionRow
onSelectRow={() => this.toggleUser(item.login)}
onSelectRow={() => this.toggleUser(item.login, item.pendingAction)}
forceTextUnreadStyle
isDisabled={!canBeRemoved}
option={{
Expand Down Expand Up @@ -301,8 +303,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 (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});
Expand Down

0 comments on commit 159f8ec

Please sign in to comment.