diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-04-11 16:21:04 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2023-04-12 13:55:59 +0200 |
| commit | dc4aafee511399ae7135a8f8d9e4cdcd9cca8fee (patch) | |
| tree | 834e66681d318e5067102dc6bfacf31b15b5a8c8 | |
| parent | 7d014f2c405f05d9ca3471b794e90940d7b852c6 (diff) | |
dashboard: ignore syzbot replies to unknown messages
Don't create such discussion entities as they are typically syzbot
replies to non-public patch testing requests.
| -rw-r--r-- | dashboard/app/discussion.go | 4 | ||||
| -rw-r--r-- | dashboard/app/discussion_test.go | 37 |
2 files changed, 41 insertions, 0 deletions
diff --git a/dashboard/app/discussion.go b/dashboard/app/discussion.go index ca287f72e..b586d151d 100644 --- a/dashboard/app/discussion.go +++ b/dashboard/app/discussion.go @@ -38,6 +38,10 @@ func saveDiscussionMessage(c context.Context, msg *newDiscussionMessage) error { if err == nil { discUpdate.ID = d.ID discUpdate.Type = dashapi.DiscussionType(d.Type) + } else if !msg.external { + // Most likely it's a public bot's reply to a non-public + // patch testing request. Ignore it. + return nil } // If the original discussion is not in the DB, it means we // were likely only mentioned in some further discussion. diff --git a/dashboard/app/discussion_test.go b/dashboard/app/discussion_test.go index 3ab61d1c8..a06ee216e 100644 --- a/dashboard/app/discussion_test.go +++ b/dashboard/app/discussion_test.go @@ -323,3 +323,40 @@ Link: https://testapp.appspot.com/bug?extid=%v client.expectEQ(got[0].Link, "https://lore.kernel.org/all/2345/T/") client.expectEQ(got[0].Subject, "[PATCH v3] A lot of fixes") } + +func TestIgnoreBotReplies(t *testing.T) { + c := NewCtx(t) + defer c.Close() + + client := c.publicClient + + build := testBuild(1) + client.UploadBuild(build) + + crash := testCrash(build, 1) + client.ReportCrash(crash) + msg := client.pollEmailBug() + _, extBugID, err := email.RemoveAddrContext(msg.Sender) + c.expectOK(err) + + incoming1 := fmt.Sprintf(`Date: Tue, 15 Aug 2017 14:59:00 -0700 +Message-ID: <2345> +Subject: Re: Patch testing request +From: %v +To: lore@email.com +In-Reply-To: <1234> +Content-Type: text/plain + +Hello! +`, msg.Sender) + _, err = c.POST("/_ah/mail/lore@email.com", incoming1) + c.expectOK(err) + + bug, _, err := findBugByReportingID(c.ctx, extBugID) + c.expectOK(err) + + // We have not seen the start of the discussion, but it should not go ignored. + got, err := getBugDiscussionsUI(c.ctx, bug) + c.expectOK(err) + client.expectEQ(len(got), 0) +} |
