Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use session.accountID instead of session.email in WorkspaceMembersPage #21237

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const propTypes = {

/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user email */
email: PropTypes.string,
/** Currently logged in user accountID */
accountID: PropTypes.number,
}),

...policyPropTypes,
Expand All @@ -67,7 +67,7 @@ const propTypes = {
const defaultProps = {
personalDetails: {},
session: {
email: null,
accountID: 0,
},
...policyDefaultProps,
};
Expand Down Expand Up @@ -330,12 +330,12 @@ function WorkspaceMembersPage(props) {
type: CONST.ICON_TYPE_AVATAR,
},
],
keyForList: item.login,
keyForList: item.accountID,
Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use only String for key but we gave a number which results in this issue. Fixed it here by providing String.

}}
onSelectRow={() => toggleUser(item.accountID, item.pendingAction)}
/>
</View>
{(props.session.email === item.login || item.role === 'admin') && (
{(props.session.accountID === item.accountID || item.role === 'admin') && (
<View style={[styles.badge, styles.peopleBadge]}>
<Text style={[styles.peopleBadgeText]}>{props.translate('common.admin')}</Text>
</View>
Expand All @@ -351,7 +351,7 @@ function WorkspaceMembersPage(props) {
);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[selectedEmployees, errors, props.session.email, dismissError, toggleUser],
[selectedEmployees, errors, props.session.accountID, dismissError, toggleUser],
);

const policyOwner = lodashGet(props.policy, 'owner');
Expand Down Expand Up @@ -383,7 +383,7 @@ function WorkspaceMembersPage(props) {
}

_.each(data, (member) => {
if (member.login === props.session.email || member.login === props.policy.owner || member.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
if (member.accountID === props.session.accountID || member.login === props.policy.owner || member.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) {
return;
}
removableMembers[member.accountID] = member;
Expand Down