diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/email/action.go | 6 | ||||
| -rw-r--r-- | pkg/email/action_test.go | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/pkg/email/action.go b/pkg/email/action.go index 1d9fb22ff..0b5103fc7 100644 --- a/pkg/email/action.go +++ b/pkg/email/action.go @@ -23,6 +23,12 @@ func NewMessageAction(msg *Email, msgType dashapi.DiscussionType, oldThread *Old return ActionNewThread } if oldThread != nil { + // Sometimes patches are sent as replies to the bug report. + // In this case, we'd better report it as a new discussion. + if msgType == dashapi.DiscussionPatch && + msgType != oldThread.ThreadType { + return ActionNewThread + } // Otherwise just append the message. return ActionAppend } diff --git a/pkg/email/action_test.go b/pkg/email/action_test.go index 51b0505f8..c1ef8507b 100644 --- a/pkg/email/action_test.go +++ b/pkg/email/action_test.go @@ -65,6 +65,17 @@ func TestMessageActions(t *testing.T) { oldThread: nil, result: ActionNewThread, }, + { + name: "patch reply to report", + msg: &Email{ + InReplyTo: "<abcd>", + }, + msgType: dashapi.DiscussionPatch, + oldThread: &OldThreadInfo{ + ThreadType: dashapi.DiscussionReport, + }, + result: ActionNewThread, + }, } for _, _test := range tests { test := _test |
