Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit b1625d3

Browse files
authored
Fix notification logic (#2751)
* Fix notification logic This bug was preventing the rest of the NewFils logic to proceed if no notification was associated with the container * build fix
1 parent 61685e6 commit b1625d3

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/ApiService/ApiService/onefuzzlib/NotificationOperations.cs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,31 @@ public NotificationOperations(ILogTracer log, IOnefuzzContext context)
2020
public async Async.Task NewFiles(Container container, string filename, bool isLastRetryAttempt) {
2121
var notifications = GetNotifications(container);
2222
var hasNotifications = await notifications.AnyAsync();
23-
24-
if (!hasNotifications) {
25-
return;
26-
}
27-
2823
var reportOrRegression = await _context.Reports.GetReportOrRegression(container, filename, expectReports: hasNotifications);
29-
var done = new List<NotificationTemplate>();
30-
await foreach (var notification in notifications) {
31-
if (done.Contains(notification.Config)) {
32-
continue;
33-
}
24+
if (hasNotifications) {
25+
var done = new List<NotificationTemplate>();
26+
await foreach (var notification in notifications) {
27+
if (done.Contains(notification.Config)) {
28+
continue;
29+
}
3430

35-
done.Add(notification.Config);
31+
done.Add(notification.Config);
3632

37-
if (notification.Config is TeamsTemplate teamsTemplate) {
38-
await _context.Teams.NotifyTeams(teamsTemplate, container, filename, reportOrRegression!, notification.NotificationId);
39-
}
33+
if (notification.Config is TeamsTemplate teamsTemplate) {
34+
await _context.Teams.NotifyTeams(teamsTemplate, container, filename, reportOrRegression!, notification.NotificationId);
35+
}
4036

41-
if (reportOrRegression == null) {
42-
continue;
43-
}
37+
if (reportOrRegression == null) {
38+
continue;
39+
}
4440

45-
if (notification.Config is AdoTemplate adoTemplate) {
46-
await _context.Ado.NotifyAdo(adoTemplate, container, filename, reportOrRegression, isLastRetryAttempt, notification.NotificationId);
47-
}
41+
if (notification.Config is AdoTemplate adoTemplate) {
42+
await _context.Ado.NotifyAdo(adoTemplate, container, filename, reportOrRegression, isLastRetryAttempt, notification.NotificationId);
43+
}
4844

49-
if (notification.Config is GithubIssuesTemplate githubIssuesTemplate) {
50-
await _context.GithubIssues.GithubIssue(githubIssuesTemplate, container, filename, reportOrRegression, notification.NotificationId);
45+
if (notification.Config is GithubIssuesTemplate githubIssuesTemplate) {
46+
await _context.GithubIssues.GithubIssue(githubIssuesTemplate, container, filename, reportOrRegression, notification.NotificationId);
47+
}
5148
}
5249
}
5350

0 commit comments

Comments
 (0)