Skip to content

Commit

Permalink
[FIX] Unable to edit a user who does not have an email via the admin …
Browse files Browse the repository at this point in the history
…or via the user's profile (#21626)
  • Loading branch information
Jeanstaquet authored May 21, 2021
1 parent 7d7b681 commit 11a40e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/views/account/AccountProfileForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function AccountProfileForm({ values, handlers, user, settings, onSaveStateChang
[statusText, t],
);
const {
emails: [{ verified = false }],
emails: [{ verified = false } = { verified: false }],
} = user;

const canSave = !![
Expand Down
4 changes: 2 additions & 2 deletions client/views/admin/users/EditUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const getInitialValue = (data) => ({
status: data.status,
bio: data.bio ?? '',
nickname: data.nickname ?? '',
email: (data.emails && data.emails[0].address) || '',
verified: (data.emails && data.emails[0].verified) || false,
email: (data.emails && data.emails.length && data.emails[0].address) || '',
verified: (data.emails && data.emails.length && data.emails[0].verified) || false,
setRandomPassword: false,
requirePasswordChange: data.setRandomPassword || false,
customFields: data.customFields ?? {},
Expand Down
2 changes: 1 addition & 1 deletion client/views/directory/UserTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function UserTable({ workspace = 'local' }) {
</Flex.Container>
</Table.Cell>
{mediaQuery && canViewFullOtherUserInfo && (
<Table.Cell withTruncatedText>{emails && emails[0].address}</Table.Cell>
<Table.Cell withTruncatedText>{emails && emails.length && emails[0].address}</Table.Cell>
)}
{federation && <Table.Cell withTruncatedText>{domain}</Table.Cell>}
{mediaQuery && (
Expand Down

0 comments on commit 11a40e5

Please sign in to comment.