Backport #31008 by @lunny Extract from #30995 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> (cherry picked from commit 8446caa813f676398411d3544cc05a42fd708cd1)
This commit is contained in:
parent
3bdf9eae01
commit
7bd9597803
2 changed files with 4 additions and 0 deletions
|
@ -46,6 +46,7 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||||
err = user_service.UploadAvatar(ctx, ctx.Org.Organization.AsUser(), content)
|
err = user_service.UploadAvatar(ctx, ctx.Org.Organization.AsUser(), content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
@ -72,6 +73,7 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||||
err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser())
|
err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
|
|
@ -39,6 +39,7 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||||
err = user_service.UploadAvatar(ctx, ctx.Doer, content)
|
err = user_service.UploadAvatar(ctx, ctx.Doer, content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "UploadAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
@ -57,6 +58,7 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||||
err := user_service.DeleteAvatar(ctx, ctx.Doer)
|
err := user_service.DeleteAvatar(ctx, ctx.Doer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Status(http.StatusNoContent)
|
ctx.Status(http.StatusNoContent)
|
||||||
|
|
Loading…
Add table
Reference in a new issue