Commit bf99494f authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch 'issue_337598_2' into 'master'

Allow to create issues by email when it contains only quotes

See merge request gitlab-org/gitlab!74413
parents 0505819a 8cebd721
...@@ -60,7 +60,7 @@ module Gitlab ...@@ -60,7 +60,7 @@ module Gitlab
current_user: author, current_user: author,
params: { params: {
title: mail.subject, title: mail.subject,
description: message_including_reply description: message_including_reply_or_only_quotes
}, },
spam_params: nil spam_params: nil
).execute ).execute
......
...@@ -35,6 +35,10 @@ module Gitlab ...@@ -35,6 +35,10 @@ module Gitlab
@message_with_reply ||= process_message(trim_reply: false) @message_with_reply ||= process_message(trim_reply: false)
end end
def message_including_reply_or_only_quotes
@message_including_reply_or_only_quotes ||= process_message(trim_reply: false, allow_only_quotes: true)
end
def message_with_appended_reply def message_with_appended_reply
@message_with_appended_reply ||= process_message(append_reply: true) @message_with_appended_reply ||= process_message(append_reply: true)
end end
......
...@@ -108,7 +108,7 @@ module Gitlab ...@@ -108,7 +108,7 @@ module Gitlab
end end
def message_including_template def message_including_template
description = process_message(trim_reply: false, allow_only_quotes: true) description = message_including_reply_or_only_quotes
template_content = service_desk_setting&.issue_template_content template_content = service_desk_setting&.issue_template_content
if template_content.present? if template_content.present?
......
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-project_id-auth_token-issue@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
> This email has been forwarded without new content.
> There are only quotes.
> Quote 1
> Quote 2
...@@ -101,6 +101,17 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do ...@@ -101,6 +101,17 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do
end end
end end
context 'when all lines of email are quotes' do
let(:email_raw) { email_fixture('emails/valid_new_issue_with_only_quotes.eml') }
it 'creates email with correct body' do
receiver.execute
issue = Issue.last
expect(issue.description).to include('This email has been forwarded without new content.')
end
end
context "something is wrong" do context "something is wrong" do
context "when the issue could not be saved" do context "when the issue could not be saved" do
before do before 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