FIX: Force enable user PM emails option when user posts to a group by email.
This commit is contained in:
parent
d9bea66365
commit
da9eee5262
|
@ -609,6 +609,11 @@ module Email
|
|||
end
|
||||
|
||||
def create_group_post(group, user, body, elided, hidden_reason_id)
|
||||
# ensure user PM emails are enabled (since user is posting via email)
|
||||
if !user.staged && !user.user_option.email_private_messages
|
||||
user.user_option.update!(email_private_messages: true)
|
||||
end
|
||||
|
||||
message_ids = Email::Receiver.extract_reply_message_ids(@mail, max_message_id_count: 5)
|
||||
post_ids = []
|
||||
|
||||
|
|
|
@ -609,6 +609,14 @@ describe Email::Receiver do
|
|||
expect(Post.last.raw).to match(/discourse\.rb/)
|
||||
end
|
||||
|
||||
it "enables user's email_private_messages option when user emails group" do
|
||||
user = Fabricate(:user, email: "existing@bar.com")
|
||||
user.user_option.update_columns(email_private_messages: false)
|
||||
expect { process(:group_existing_user) }.to change(Topic, :count)
|
||||
user.reload
|
||||
expect(user.user_option.email_private_messages).to eq(true)
|
||||
end
|
||||
|
||||
context "with forwarded emails enabled" do
|
||||
before { SiteSetting.enable_forwarded_emails = true }
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Return-Path: <existing@bar.com>
|
||||
From: Foo Bar <existing@bar.com>
|
||||
To: team@bar.com
|
||||
Subject: This is a topic to a group from an existing user
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <32@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Hey there, this is an email to a group mailbox from an existing user.
|
Loading…
Reference in New Issue