Commit 28f33384 authored by Jan Provaznik's avatar Jan Provaznik

Do not strip forwarded message

When creating an issue from service desk email, we should keep
quoted/forwarded part of the message.
parent bc246dd0
---
title: Do not strip forwarded message body when creating an issue from Service Desk
email.
merge_request: 18196
author:
type: fixed
......@@ -62,7 +62,7 @@ module Gitlab
project,
User.support_bot,
title: issue_title,
description: message,
description: message_including_reply,
confidential: true,
service_desk_reply_to: from_address
).execute
......
Delivered-To: incoming+email-test-project_id-issue-@appmail.adventuretime.ooo
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+email-test-project_id-issue-@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: support@adventuretime.ooo
Delivered-To: support@adventuretime.ooo
Message-ID: <CADkmRc+rNGAGGbV2iE5p918UVy4UyJqVcXRO2=otppgzduJSg@mail.gmail.com>
Subject: The message subject! @all
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
Service desk stuff!
---------- Forwarded message ---------
From: Jake the Dog <jake@adventuretime.ooo>
To: <jake@adventuretime.ooo>
forwarded content
......@@ -12,6 +12,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
let(:email_raw) { email_fixture('emails/service_desk.eml', dir: 'ee') }
let(:namespace) { create(:namespace, name: "email") }
let(:expected_description) { "Service desk stuff!\n\n```\na = b\n```\n\n![image](uploads/image.png)" }
context 'service desk is enabled for the project' do
let(:project) { create(:project, :public, namespace: namespace, path: 'test', service_desk_enabled: true) }
......@@ -35,7 +36,7 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
expect(new_issue.confidential?).to be true
expect(new_issue.all_references.all).to be_empty
expect(new_issue.title).to eq("Service Desk (from jake@adventuretime.ooo): The message subject! @all")
expect(new_issue.description).to eq("Service desk stuff!\n\n```\na = b\n```\n\n![image](uploads/image.png)")
expect(new_issue.description).to eq(expected_description.strip)
end
it 'sends thank you email' do
......@@ -125,6 +126,27 @@ describe Gitlab::Email::Handler::EE::ServiceDeskHandler do
it_behaves_like 'a new issue request'
end
context 'when the email is forwarded' do
let(:email_raw) { email_fixture('emails/service_desk_forwarded_new_issue.eml', dir: 'ee') }
it_behaves_like 'a new issue request' do
let(:expected_description) do
<<~EOF
Service desk stuff!
---------- Forwarded message ---------
From: Jake the Dog <jake@adventuretime.ooo>
To: <jake@adventuretime.ooo>
forwarded content
![image](uploads/image.png)
EOF
end
end
end
end
context 'service desk is disabled for the project' 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