Closed
Description
Description
Hello,
I have an issue with 2 labels A
and B
(A
is exclusive but I don't think that matters). When I remove B
via the web interface, then I get a label_updated
webhook json with an empty labels
array.
When I do this via the api with DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id}
I get a correct labels
array with A
in it.
Gitea Version
1.23.8
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
I don't know
Database
None
Activity
badhezi commentedon Jun 1, 2025
it appears also the API returns empty response when deleting a label from an issue.
https://github.com/badhezi/gitea/blob/main/routers/api/v1/repo/issue_label.go#L196
can you show an example where
DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id}
returns a list of current labels after the deletion?anyhow it's seems like this is not implemented, AFAIK.
I can implement that if needed, github's API does that.
edit: I see what you mean, when triggering a delete from API the webhook payload does include the labels. looking into that
badhezi commentedon Jun 1, 2025
Found the issue
when removing an issue label from web, this function is first being called
gitea/routers/web/repo/issue.go
Line 184 in bb6377d
which calls
issue.LoadAttributes(ctx)
, that setsissue.isLabelsLoaded = true
this prevents this function
gitea/models/issues/issue_label.go
Line 203 in bb6377d
from loading the updated labels after the deletion of the requested labels, resulting in the webhook returning
labels = nil
this flow is not triggered with calling from API as there is no need to render the issue labels for the user prior to the request.
kim2048 commentedon Jun 2, 2025
Sorry, was on vacation. Glad to see you've found something :)
Fix issue label delete incorrect labels webhook payload (#34575)
Fix issue label delete incorrect labels webhook payload (go-gitea#34575)
Fix issue label delete incorrect labels webhook payload (#34575) (#34603