fix: cannot change the user's own avatar (#4777)

#### 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
解决无用户管理权限的用户无法上传头像的问题
```
pull/4785/head
Takagi 2023-10-27 16:50:53 +08:00 committed by GitHub
parent 2dbfbd1bd0
commit 921518aef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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(() => {
@ -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"] });