improve receiver specs to account for posts approval
This commit is contained in:
parent
9bba68ed74
commit
e4980392da
|
@ -2235,9 +2235,6 @@ en:
|
|||
|
||||
%{message}
|
||||
|
||||
---
|
||||
%{respond_instructions}
|
||||
|
||||
digest:
|
||||
why: "A brief summary of %{site_link} since your last visit on %{last_seen_at}"
|
||||
subject_template: "[%{site_name}] Digest"
|
||||
|
|
|
@ -375,7 +375,8 @@ module Email
|
|||
options[:raw] << "</details>" << "\n"
|
||||
end
|
||||
|
||||
manager = NewPostManager.new(options[:user], options)
|
||||
user = options.delete(:user)
|
||||
manager = NewPostManager.new(user, options)
|
||||
result = manager.perform
|
||||
|
||||
raise InvalidPost, result.errors.full_messages.join("\n") if result.errors.any?
|
||||
|
@ -383,7 +384,7 @@ module Email
|
|||
if result.post
|
||||
@incoming_email.update_columns(topic_id: result.post.topic_id, post_id: result.post.id)
|
||||
if result.post.topic && result.post.topic.private_message?
|
||||
add_other_addresses(result.post.topic, options[:user])
|
||||
add_other_addresses(result.post.topic, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -327,6 +327,21 @@ describe Email::Receiver do
|
|||
expect { process(:new_user) }.to change(Topic, :count)
|
||||
end
|
||||
|
||||
it "works when approving is enabled" do
|
||||
SiteSetting.approve_unless_trust_level = 4
|
||||
|
||||
Fabricate(:user, email: "tl3@bar.com", trust_level: TrustLevel[3])
|
||||
Fabricate(:user, email: "tl4@bar.com", trust_level: TrustLevel[4])
|
||||
|
||||
category.set_permissions(Group[:trust_level_4] => :full)
|
||||
category.save
|
||||
|
||||
Group.refresh_automatic_group!(:trust_level_4)
|
||||
|
||||
expect { process(:tl3_user) }.to_not change(Topic, :count)
|
||||
expect { process(:tl4_user) }.to change(Topic, :count)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
Return-Path: <tl3@bar.com>
|
||||
From: Foo Bar <tl3@bar.com>
|
||||
To: category@foo.com
|
||||
Subject: This is a topic from a TL3 user
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <43@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Hey, this is a topic from a TL3 user :)
|
|
@ -0,0 +1,11 @@
|
|||
Return-Path: <tl4@bar.com>
|
||||
From: Foo Bar <tl4@bar.com>
|
||||
To: category@foo.com
|
||||
Subject: This is a topic from a TL4 user
|
||||
Date: Fri, 15 Jan 2016 00:12:43 +0100
|
||||
Message-ID: <44@foo.bar.mail>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
|
||||
Hey, this is a topic from a TL4 user :)
|
Loading…
Reference in New Issue