Commit 347ee6cc authored by Lin Jen-Shin's avatar Lin Jen-Shin

Alloy empty reply for new issues, but not response

parent a61bf17f
......@@ -44,7 +44,9 @@ module Gitlab
raise NoteableNotFoundError unless sent_notification.noteable
note = create_note(handle_reply(project))
reply = handle_reply(project)
raise EmptyEmailError if reply.blank?
note = create_note(reply)
unless note.persisted?
msg = "The comment could not be created for the following reasons:"
......@@ -104,8 +106,6 @@ module Gitlab
def handle_reply(project)
reply = ReplyParser.new(message).execute.strip
raise EmptyEmailError if reply.blank?
add_attachments(reply, project)
reply
......
Return-Path: <jake@adventuretime.ooo>
Received: from iceking.adventuretime.ooo ([unix socket]) by iceking (Cyrus v2.2.13-Debian-2.2.13-19+squeeze3) with LMTPA; Thu, 13 Jun 2013 17:03:50 -0400
Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) by iceking.adventuretime.ooo (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5DL3nFJ016967 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 17:03:50 -0400
Received: by mail-ie0-f180.google.com with SMTP id f4so21977375iea.25 for <incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo>; Thu, 13 Jun 2013 14:03:48 -0700
Received: by 10.0.0.1 with HTTP; Thu, 13 Jun 2013 14:03:48 -0700
Date: Thu, 13 Jun 2013 17:03:48 -0400
From: Jake the Dog <jake@adventuretime.ooo>
To: incoming+gitlabhq/gitlabhq@appmail.adventuretime.ooo
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
Subject: New Issue by email
Mime-Version: 1.0
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Sieve: CMU Sieve 2.2
X-Received: by 10.0.0.1 with SMTP id n7mr11234144ipb.85.1371157428600; Thu,
13 Jun 2013 14:03:48 -0700 (PDT)
X-Scanned-By: MIMEDefang 2.69 on IPv6:2001:470:1d:165::1
......@@ -167,7 +167,6 @@ describe Gitlab::Email::Receiver, lib: true do
context "when it's trying to create a new issue" do
before do
setup_attachment
stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo")
end
......@@ -179,6 +178,8 @@ describe Gitlab::Email::Receiver, lib: true do
context "when everything is fine" do
it "creates a new issue" do
setup_attachment
expect { receiver.execute }.to change { project.issues.count }.by(1)
issue = project.issues.last
......@@ -187,6 +188,19 @@ describe Gitlab::Email::Receiver, lib: true do
expect(issue.description).to include('reply by email')
expect(issue.description).to include(markdown)
end
context "when the reply is blank" do
let!(:email_raw) { fixture_file("emails/valid_new_issue_empty.eml") }
it "creates a new issue" do
expect { receiver.execute }.to change { project.issues.count }.by(1)
issue = project.issues.last
expect(issue.author).to eq(user)
expect(issue.title).to eq('New Issue by email')
expect(issue.description).to eq('')
end
end
end
context "something is wrong" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment