Topic API: allow to remove avatar by update
What does this MR do and why?
In !73969 (merged), the Topics API was added, implementing avatar handling similar to projects, users and groups. However, it's unfortunately not possible to remove an avatar via API as discussed in #348148 (closed).
This MR allows to remove the avatar of a topic by update via Topics API using a blank parameter value (as suggested in #348148 (comment 771499472)).
/cc @bufferoverflow
How to set up and validate locally
Initial situation:
$ curl http://localhost:3000/api/v4/topics/1
{"id":1,"name":"topic1","description":"","total_projects_count":0,"avatar_url":"http://localhost:3000/uploads/-/system/projects/topic/avatar/1/image.jpg"}
Before MR:
$ curl --request PUT --header "PRIVATE-TOKEN: <admin token>" http://localhost:3000/api/v4/topics/1 --data "avatar="
{"error":"avatar is invalid"}
After MR:
$ curl --request PUT --header "PRIVATE-TOKEN: <admin token>" http://localhost:3000/api/v4/topics/1 --data "avatar="
{"id":1,"name":"topic1","description":"","total_projects_count":0,"avatar_url":null}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jonas Wälter