Skip to content

Webhook label_updated contains no labels when using the web interface #34560

Closed
@kim2048

Description

@kim2048

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

badhezi commented on Jun 1, 2025

@badhezi
Contributor

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

	if err := issue_service.RemoveLabel(ctx, issue, ctx.Doer, label); err != nil {
		ctx.APIErrorInternal(err)
		return
	}

	ctx.Status(http.StatusNoContent)

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

badhezi commented on Jun 1, 2025

@badhezi
Contributor

Found the issue
when removing an issue label from web, this function is first being called

func GetActionIssue(ctx *context.Context) *issues_model.Issue {

which calls issue.LoadAttributes(ctx), that sets issue.isLabelsLoaded = true

this prevents this function

func DeleteIssueLabel(ctx context.Context, issue *Issue, label *Label, doer *user_model.User) error {

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.

added this to the 1.24.0 milestone on Jun 2, 2025
kim2048

kim2048 commented on Jun 2, 2025

@kim2048
Author

Sorry, was on vacation. Glad to see you've found something :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @lunny@badhezi@kemzeb@kim2048

      Issue actions

        Webhook label_updated contains no labels when using the web interface · Issue #34560 · go-gitea/gitea