From 62994129e1728580cc3ef5e426b7d6e915cacaff Mon Sep 17 00:00:00 2001 From: Yi EungJun Date: Tue, 28 Oct 2014 15:15:24 +0900 Subject: [PATCH] NotificationMail: Fix incorrect References header A message id of a notification mail for new comment thread should be the message id of the comment thread's first comment. --- app/models/NotificationMail.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/NotificationMail.java b/app/models/NotificationMail.java index eae4a07f5..3b4fea491 100644 --- a/app/models/NotificationMail.java +++ b/app/models/NotificationMail.java @@ -187,7 +187,18 @@ public void addReferences() { Resource container = resource.getContainer(); if (container != null) { - addHeader("References", container.getMessageId()); + String reference; + switch (container.getType()) { + case COMMENT_THREAD: + CommentThread thread = + CommentThread.find.byId(Long.valueOf(container.getId())); + reference = thread.getFirstReviewComment().asResource().getMessageId(); + break; + default: + reference = container.getMessageId(); + break; + } + addHeader("References", reference); } } }