Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move labels webhooks to notification #8749

Merged
merged 3 commits into from
Nov 2, 2019

Conversation

lunny
Copy link
Member

@lunny lunny commented Oct 30, 2019

As title.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Oct 30, 2019
@lunny lunny changed the title Move webhooks to notification Move labels webhooks to notification Oct 30, 2019
@@ -84,7 +36,7 @@ func AddLabels(issue *models.Issue, doer *models.User, labels []*models.Label) e
return err
}

sendLabelUpdatedWebhook(issue, doer)
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
Copy link
Member

@6543 6543 Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
notification.NotifyIssueChangeLabels(doer, issue, labels, nil)

why not use the new parameter - we can implement the handling at NotifyIssueChangeLabels later?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 30, 2019
@@ -74,7 +26,7 @@ func AddLabel(issue *models.Issue, doer *models.User, label *models.Label) error
return err
}

sendLabelUpdatedWebhook(issue, doer)
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
Copy link
Member

@6543 6543 Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
notification.NotifyIssueChangeLabels(doer, issue, []*models.lable {label}, nil)

same here ...

@@ -106,6 +58,6 @@ func RemoveLabel(issue *models.Issue, doer *models.User, label *models.Label) er
return err
}

sendLabelUpdatedWebhook(issue, doer)
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notification.NotifyIssueChangeLabels(doer, issue, nil, nil)
notification.NotifyIssueChangeLabels(doer, issue, nil, []*models.lable {label})

same here ...

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Oct 30, 2019
@6543
Copy link
Member

6543 commented Oct 30, 2019

@lunny optional changes aboth ... beside that approved :D

@codecov-io
Copy link

codecov-io commented Oct 30, 2019

Codecov Report

Merging #8749 into master will decrease coverage by 0.01%.
The diff coverage is 37.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8749      +/-   ##
==========================================
- Coverage   41.39%   41.38%   -0.02%     
==========================================
  Files         541      541              
  Lines       69522    69522              
==========================================
- Hits        28780    28772       -8     
- Misses      37048    37056       +8     
  Partials     3694     3694
Impacted Files Coverage Δ
modules/notification/webhook/webhook.go 47.6% <35.71%> (-1.5%) ⬇️
services/issue/label.go 17.14% <66.66%> (-20.52%) ⬇️
modules/sync/unique_queue.go 78.57% <0%> (-10.72%) ⬇️
modules/log/event.go 64.61% <0%> (-1.03%) ⬇️
modules/notification/notification.go 74.46% <0%> (+4.25%) ⬆️
modules/notification/base/null.go 63.63% <0%> (+4.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 484edb7...b532577. Read the comment docs.

@@ -398,3 +398,50 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models
go models.HookQueue.Add(comment.Issue.Repo.ID)
}
}

func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *models.Issue,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that ClearLabels() doesn't use this function. Is it a whole type of notification?

@lunny
Copy link
Member Author

lunny commented Oct 31, 2019

@6543 all done.
@guillep2k ClearLabels invoked NotifyIssueClearLabels but not NotifyIssueChangeLabels.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 2, 2019
@lunny lunny merged commit 4b8d9e5 into go-gitea:master Nov 2, 2019
@lunny lunny deleted the lunny/move_label_webhook branch November 2, 2019 01:50
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants