FIX: don't invite users with emails configured as 'incoming' (reply, group our category)

This commit is contained in:
Régis Hanol
2016-01-20 23:08:27 +01:00
parent f145310cd5
commit 4a17cdc1e4
2 changed files with 22 additions and 8 deletions

View File

@ -229,11 +229,11 @@ describe Email::Receiver do
expect(user.name).to eq("Случайная Имя")
end
it "invites everyone in the chain but users whose email matches the 'reply_by_email_address'" do
it "invites everyone in the chain but emails configured as 'incoming' (via reply, group or category)" do
expect { process(:cc) }.to change(Topic, :count)
emails = Topic.last.allowed_users.pluck(:email)
expect(emails.size).to eq(4)
expect(emails).to include("someone@else.com", "discourse@bar.com", "team@bar.com", "wat@bar.com")
expect(emails.size).to eq(3)
expect(emails).to include("someone@else.com", "discourse@bar.com", "wat@bar.com")
end
it "associates email replies using both 'In-Reply-To' and 'References' headers" do
@ -244,11 +244,11 @@ describe Email::Receiver do
expect { process(:email_reply_2) }.to change { topic.posts.count }
expect { process(:email_reply_3) }.to change { topic.posts.count }
# Why 6 when we only processed 3 emails?
# Why 5 when we only processed 3 emails?
# - 3 of them are indeed "regular" posts generated from the emails
# - The 3 others are "small action" posts automatically added because
# we invited 3 users (team@bar.com, two@foo.com and three@foo.com)
expect(topic.posts.count).to eq(6)
# - The 2 others are "small action" posts automatically added because
# we invited 2 users (two@foo.com and three@foo.com)
expect(topic.posts.count).to eq(5)
# trash all but the 1st post
topic.ordered_posts[1..-1].each(&:trash!)