Skip to content

Commit eaaa158

Browse files
GiteaBotlunny
andauthored
Add webhook assigning test and fix possible bug (#34420) (#34551)
Backport #34420 by lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent f549842 commit eaaa158

File tree

3 files changed

+235
-185
lines changed

3 files changed

+235
-185
lines changed

services/issue/assignee.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ func ToggleAssigneeWithNotify(ctx context.Context, issue *issues_model.Issue, do
5454
if err != nil {
5555
return false, nil, err
5656
}
57+
issue.AssigneeID = assigneeID
58+
issue.Assignee = assignee
5759

5860
notify_service.IssueChangeAssignee(ctx, doer, issue, assignee, removed, comment)
5961

tests/integration/issue_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ func testNewIssue(t *testing.T, session *TestSession, user, repo, title, content
151151
return issueURL
152152
}
153153

154+
func testIssueAssign(t *testing.T, session *TestSession, repoLink string, issueID, assigneeID int64) {
155+
req := NewRequestWithValues(t, "POST", fmt.Sprintf(repoLink+"/issues/assignee?issue_ids=%d", issueID), map[string]string{
156+
"_csrf": GetUserCSRFToken(t, session),
157+
"id": strconv.FormatInt(assigneeID, 10),
158+
"action": "", // empty action means assign
159+
})
160+
session.MakeRequest(t, req, http.StatusOK)
161+
}
162+
154163
func testIssueAddComment(t *testing.T, session *TestSession, issueURL, content, status string) int64 {
155164
req := NewRequest(t, "GET", issueURL)
156165
resp := session.MakeRequest(t, req, http.StatusOK)

0 commit comments

Comments
 (0)