WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13214-fixed-1766145130482.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

IAM: User can’t edit their own email on the user details page ([#13214](https://github.com/linode/manager/pull/13214))
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('UserEmailPanel', () => {
const user = accountUserFactory.build();

const { getByLabelText } = renderWithTheme(
<UserEmailPanel activeUser={user} canUpdateUser={true} />
<UserEmailPanel activeUser={user} />
);

const emailTextField = getByLabelText('Email');
Expand All @@ -45,7 +45,7 @@ describe('UserEmailPanel', () => {
);

const { findByLabelText, getByLabelText, getByText } = renderWithTheme(
<UserEmailPanel activeUser={user} canUpdateUser={false} />
<UserEmailPanel activeUser={user} />
);

const warning = await findByLabelText(
Expand All @@ -70,7 +70,7 @@ describe('UserEmailPanel', () => {
});

const { getByLabelText, getByText } = renderWithTheme(
<UserEmailPanel activeUser={user} canUpdateUser={false} />
<UserEmailPanel activeUser={user} />
);

const warning = getByLabelText('This field can’t be modified.');
Expand All @@ -94,7 +94,7 @@ describe('UserEmailPanel', () => {
username: 'user-1',
});

renderWithTheme(<UserEmailPanel activeUser={user} canUpdateUser={true} />);
renderWithTheme(<UserEmailPanel activeUser={user} />);

const emailInput = screen.getByLabelText('Email');

Expand All @@ -114,7 +114,7 @@ describe('UserEmailPanel', () => {
});

const { getByRole, findByDisplayValue } = renderWithTheme(
<UserEmailPanel activeUser={user} canUpdateUser={false} />
<UserEmailPanel activeUser={user} />
);

await findByDisplayValue(user.email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import type { User } from '@linode/api-v4';

interface Props {
activeUser: User;
canUpdateUser: boolean;
}

export const UserEmailPanel = ({ canUpdateUser, activeUser }: Props) => {
export const UserEmailPanel = ({ activeUser }: Props) => {
const { enqueueSnackbar } = useSnackbar();
const { profileUserName } = useDelegationRole();

Expand Down Expand Up @@ -54,7 +53,7 @@ export const UserEmailPanel = ({ canUpdateUser, activeUser }: Props) => {

// This should be disabled if this is NOT the current user or if the proxy user is viewing their own profile.
const disableEmailField =
profileUserName !== activeUser.username || isProxyUser || !canUpdateUser;
profileUserName !== activeUser.username || isProxyUser;

return (
<Paper>
Expand All @@ -79,11 +78,11 @@ export const UserEmailPanel = ({ canUpdateUser, activeUser }: Props) => {
/>
<Button
buttonType="primary"
disabled={!isDirty || !canUpdateUser}
disabled={!isDirty || disableEmailField}
loading={isSubmitting}
sx={{ mt: 2 }}
tooltipText={
!canUpdateUser
disableEmailField
? 'You do not have permission to update this user.'
: undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const UserProfile = () => {
>
<UserDetailsPanel activeUser={user} assignedRoles={assignedRoles} />
<UsernamePanel activeUser={user} canUpdateUser={isAccountAdmin} />
<UserEmailPanel activeUser={user} canUpdateUser={isAccountAdmin} />
<UserEmailPanel activeUser={user} />
<DeleteUserPanel activeUser={user} canDeleteUser={isAccountAdmin} />
</Stack>
</>
Expand Down