Skip to content

Commit

Permalink
fix: cannot change the user's own avatar (#4777)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

当前用户上传头像时的接口中名字应该是 `-` 而不是具体的 metadata name。

#### How to test it?

使用无用户管理权限的用户登录,查看是否能上传头像。

#### Which issue(s) this PR fixes:

Fixes #4776 

#### Does this PR introduce a user-facing change?
```release-note
解决无用户管理权限的用户无法上传头像的问题
```
  • Loading branch information
LIlGG committed Oct 27, 2023
1 parent 2dbfbd1 commit 921518a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions console/src/modules/system/users/components/UserAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const handleUploadAvatar = () => {
apiClient.user
.uploadUserAvatar({
name: user.value.user.metadata.name,
name: isCurrentUser?.value ? "-" : user.value.user.metadata.name,
file: file,
})
.then(() => {
Expand Down Expand Up @@ -97,7 +97,7 @@ const handleRemoveCurrentAvatar = () => {
apiClient.user
.deleteUserAvatar({
name: user.value.user.metadata.name,
name: isCurrentUser?.value ? "-" : user.value.user.metadata.name,
})
.then(() => {
queryClient.invalidateQueries({ queryKey: ["user-detail"] });
Expand Down

0 comments on commit 921518a

Please sign in to comment.