1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fix some webhooks bugs (#3981)

* fix some webhooks bugs

* update vendor

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix test

* fix clearlabels

* fix pullrequest webhook bug fix #3492

* update release webhook description

* remove unused code

* fix push webhook in pull request

* small changes
This commit is contained in:
Lunny Xiao
2018-05-21 10:28:29 +08:00
committed by GitHub
parent dc0ef38950
commit 6bdc556b7f
16 changed files with 277 additions and 45 deletions

View File

@@ -54,28 +54,30 @@ func newIssueUsers(e Engine, repo *Repository, issue *Issue) error {
func updateIssueAssignee(e *xorm.Session, issue *Issue, assigneeID int64) (removed bool, err error) {
// Check if the user exists
_, err = GetUserByID(assigneeID)
assignee, err := GetUserByID(assigneeID)
if err != nil {
return false, err
}
// Check if the submitted user is already assigne, if yes delete him otherwise add him
var toBeDeleted bool
for _, assignee := range issue.Assignees {
if assignee.ID == assigneeID {
toBeDeleted = true
var i int
for i = 0; i < len(issue.Assignees); i++ {
if issue.Assignees[i].ID == assigneeID {
break
}
}
assigneeIn := IssueAssignees{AssigneeID: assigneeID, IssueID: issue.ID}
toBeDeleted := i < len(issue.Assignees)
if toBeDeleted {
issue.Assignees = append(issue.Assignees[:i], issue.Assignees[i:]...)
_, err = e.Delete(assigneeIn)
if err != nil {
return toBeDeleted, err
}
} else {
issue.Assignees = append(issue.Assignees, assignee)
_, err = e.Insert(assigneeIn)
if err != nil {
return toBeDeleted, err