Removal of issue label not reflected in webhook POST data #3572

Closed
opened 2025-11-02 05:17:42 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @dodedodo on GitHub (Jul 11, 2019).

How to reproduce

Step 1 Add label to issue
result: Webhook posts the issue data, including the right label information (the recently added label)

Step 2: Remove that same label (BUG)
result: Webhook posts the issue data, but this still includes the recently removed label! I'm expecting the webhook to remove the removed label from it's post data (issue.label).

Step 3: generate another webhook (like adding a comment)
result: The webhook provides the right label data again. So the label removed in step2 is not included in issue.labels


It looks like Gitea is sending it's webhook POST before it has actually updated the values internally. Because of this, te Gitea webhook is sending out-of-date information. A simple workaround is to request the labels when receiving the label_updated action, but that kind of defeats the purpose.

EDIT: this link actually shows the requests Gitea sent. Nice!
image

Originally created by @dodedodo on GitHub (Jul 11, 2019). - Gitea version (or commit ref): - 1.8.3 - Operating system: - Alpine linux v3.10 hardened - Database - [x] MySQL (mariadb actually) - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (https://try.gitea.io/testLabels/testLabels/issues/1) ## How to reproduce **Step 1 Add label to issue** result: Webhook posts the issue data, including the right label information (the recently added label) **Step 2: Remove that same label** _(BUG)_ result: Webhook posts the issue data, but this still includes the recently removed label! I'm expecting the webhook to remove the removed label from it's post data (issue.label). **Step 3: generate another webhook (like adding a comment)** result: The webhook provides the right label data again. So the label removed in step2 is not included in issue.labels --- It looks like Gitea is sending it's webhook POST before it has actually updated the values internally. Because of this, te Gitea webhook is sending out-of-date information. A simple workaround is to request the labels when receiving the label_updated action, but that kind of defeats the purpose. EDIT: [this link](https://try.gitea.io/testLabels/testLabels/settings/hooks/221) actually shows the requests Gitea sent. Nice! ![image](https://user-images.githubusercontent.com/3252036/61065307-b3ce2700-a403-11e9-8bc2-1209ab49709a.png)
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 05:17:42 -06:00
Author
Owner

@stale[bot] commented on GitHub (Sep 9, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Sep 9, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@davidsvantesson commented on GitHub (Sep 12, 2019):

I posted a similar issue (#7838). I think there are some cases for webhooks that the code write the new data to database, but the data served to the webhook is the old data. It could be solved by either writing the data to the structure as well before handling the webhook, or to reload the data from the database.

@davidsvantesson commented on GitHub (Sep 12, 2019): I posted a similar issue (#7838). I think there are some cases for webhooks that the code write the new data to database, but the data served to the webhook is the old data. It could be solved by either writing the data to the structure as well before handling the webhook, or to reload the data from the database.
Author
Owner

@stale[bot] commented on GitHub (Nov 13, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Nov 13, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Nov 27, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Nov 27, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Author
Owner

@lunny commented on GitHub (Nov 28, 2019):

@dodedodo I want to know more detail about this issue and the repository on try site has been deleted.

  1. Which gitea version were you using?
  2. Which type webhook did you tested?
@lunny commented on GitHub (Nov 28, 2019): @dodedodo I want to know more detail about this issue and the repository on try site has been deleted. 1) Which gitea version were you using? 2) Which type webhook did you tested?
Author
Owner

@guillep2k commented on GitHub (Nov 28, 2019):

I posted a similar issue (#7838). I think there are some cases for webhooks that the code write the new data to database, but the data served to the webhook is the old data. It could be solved by either writing the data to the structure as well before handling the webhook, or to reload the data from the database.

@davidsvantesson With the recent code refactoring that @lunny has been doing, I think this particular scenario should have been eliminated because one of the things he did was to move the webhook call outside of the model transaction. Unless of course some webhooks still require refactoring. All of this has been done in the 1.11 branch, however.

@guillep2k commented on GitHub (Nov 28, 2019): > > > I posted a similar issue (#7838). I think there are some cases for webhooks that the code write the new data to database, but the data served to the webhook is the old data. It could be solved by either writing the data to the structure as well before handling the webhook, or to reload the data from the database. @davidsvantesson With the recent code refactoring that @lunny has been doing, I think this particular scenario should have been eliminated because one of the things he did was to move the webhook call outside of the model transaction. Unless of course some webhooks still require refactoring. All of this has been done in the 1.11 branch, however.
Author
Owner

@davidsvantesson commented on GitHub (Nov 28, 2019):

@guillep2k I have not worked on webhooks lately, might be that many update issues are solved.

@davidsvantesson commented on GitHub (Nov 28, 2019): @guillep2k I have not worked on webhooks lately, might be that many update issues are solved.
Author
Owner

@b1tray3r commented on GitHub (Nov 3, 2020):

Hi all,

This should be fixed in 1.13.

Here is the PR: https://github.com/go-gitea/gitea/pull/13007

KR

Alex

@b1tray3r commented on GitHub (Nov 3, 2020): Hi all, This should be fixed in 1.13. Here is the PR: https://github.com/go-gitea/gitea/pull/13007 KR Alex
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3572