Skip to content

Commit

Permalink
[MM-340] Update list of users to notify during multiple events update
Browse files Browse the repository at this point in the history
  • Loading branch information
ayusht2810 committed Apr 3, 2024
1 parent f4d5e9c commit 16bbb47
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion server/webhook/merge_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (w *webhook) handleDMMergeRequest(event *gitlab.MergeEvent) ([]*HandleWebho
message = fmt.Sprintf("[%s](%s) updated the merge request [%s!%v](%s)", senderGitlabUsername, w.gitlabRetreiver.GetUserURL(senderGitlabUsername), event.ObjectAttributes.Target.PathWithNamespace, event.ObjectAttributes.IID, event.ObjectAttributes.URL)
handlers = []*HandleWebhook{{
Message: message,
ToUsers: []string{authorGitlabUsername},
ToUsers: toUsers,
From: senderGitlabUsername,
}}
}
Expand Down
14 changes: 11 additions & 3 deletions server/webhook/merge_request_fixture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,8 @@ const MultipleEventsMergeRequest = `{
"object_kind":"merge_request",
"event_type":"merge_request",
"user":{
"name":"manland",
"username":"manland",
"name":"Administrator",
"username":"root",
"avatar_url":"https://www.gravatar.com/avatar/c6b552a4cd47f7cf1701ea5b650cd2e3?s=80\\u0026d=identicon"
},
"project":{
Expand Down Expand Up @@ -969,7 +969,7 @@ const MultipleEventsMergeRequest = `{
"email":"admin@example.com"
}
},
"assignee_ids": [],
"assignee_ids": [50],
"action":"update"
},
"labels":[
Expand Down Expand Up @@ -1003,6 +1003,14 @@ const MultipleEventsMergeRequest = `{
}]
}
},
"assignees": [
{
"id": 50,
"name": "manland",
"username": "manland",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\\u0026d=identicon"
}
],
"repository":{
"name":"webhook",
"url":"ssh://rmaneschi@localhost:2222/manland/webhook.git",
Expand Down
8 changes: 4 additions & 4 deletions server/webhook/merge_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ var testDataMergeRequest = []testDataMergeRequestStr{
},
},
}, {
testTitle: "Manland updates labels, title and description of merge-request",
testTitle: "Root updates labels, title and description of merge-request",
fixture: MultipleEventsMergeRequest,
gitlabRetreiver: newFakeWebhook([]*subscription.Subscription{}),
res: []*HandleWebhook{{
Message: "[manland](http://my.gitlab.com/manland) updated the merge request [manland/webhook!4](http://localhost:3000/manland/webhook/merge_requests/4)",
ToUsers: []string{"root"},
Message: "[root](http://my.gitlab.com/root) updated the merge request [manland/webhook!4](http://localhost:3000/manland/webhook/merge_requests/4)",
ToUsers: []string{"manland"},
ToChannels: []string{},
From: "manland",
From: "root",
}},
}, {
testTitle: "user assign manland as assignee to the merge-request",
Expand Down

0 comments on commit 16bbb47

Please sign in to comment.