the note in a FWed email should be a whisper only in PM and when the author is member of the group
This commit is contained in:
parent
62763f025c
commit
eb453d0f82
|
@ -420,11 +420,14 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
if post && post.topic && @before_embedded.present?
|
if post && post.topic && @before_embedded.present?
|
||||||
|
post_type = Post.types[:regular]
|
||||||
|
post_type = Post.types[:whisper] if post.topic.private_message? && group.usernames[user.username]
|
||||||
|
|
||||||
create_reply(user: user,
|
create_reply(user: user,
|
||||||
raw: @before_embedded,
|
raw: @before_embedded,
|
||||||
post: post,
|
post: post,
|
||||||
topic: post.topic,
|
topic: post.topic,
|
||||||
post_type: Post.types[:whisper])
|
post_type: post_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -394,9 +394,14 @@ describe Email::Receiver do
|
||||||
|
|
||||||
expect(forwarded_post.raw).to match(/XoXo/)
|
expect(forwarded_post.raw).to match(/XoXo/)
|
||||||
expect(last_post.raw).to match(/can you have a look at this email below/)
|
expect(last_post.raw).to match(/can you have a look at this email below/)
|
||||||
|
|
||||||
|
expect(last_post.post_type).to eq(Post.types[:regular])
|
||||||
end
|
end
|
||||||
|
|
||||||
it "handles weirdly forwarded emails" do
|
it "handles weirdly forwarded emails" do
|
||||||
|
group.add(Fabricate(:user, email: "ba@bar.com"))
|
||||||
|
group.save
|
||||||
|
|
||||||
SiteSetting.enable_forwarded_emails = true
|
SiteSetting.enable_forwarded_emails = true
|
||||||
expect { process(:forwarded_email_2) }.to change(Topic, :count)
|
expect { process(:forwarded_email_2) }.to change(Topic, :count)
|
||||||
|
|
||||||
|
@ -407,6 +412,8 @@ describe Email::Receiver do
|
||||||
|
|
||||||
expect(forwarded_post.raw).to match(/XoXo/)
|
expect(forwarded_post.raw).to match(/XoXo/)
|
||||||
expect(last_post.raw).to match(/can you have a look at this email below/)
|
expect(last_post.raw).to match(/can you have a look at this email below/)
|
||||||
|
|
||||||
|
expect(last_post.post_type).to eq(Post.types[:whisper])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue