fixes #705
This commit is contained in:
@@ -154,7 +154,7 @@ class Dmail < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def send_dmail
|
def send_dmail
|
||||||
if to.receive_email_notifications? && to.email.include?("@")
|
if to.receive_email_notifications? && to.email.include?("@") && owner_id == CurrentUser.id
|
||||||
UserMailer.dmail_notice(self).deliver
|
UserMailer.dmail_notice(self).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,6 +63,13 @@ class DmailTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "create only one message for a split response" do
|
||||||
|
user = FactoryGirl.create(:user, :receive_email_notifications => true)
|
||||||
|
assert_difference("ActionMailer::Base.deliveries.size", 1) do
|
||||||
|
Dmail.create_split(:to_id => user.id, :title => "foo", :body => "foo")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
should "be marked as read after the user reads it" do
|
should "be marked as read after the user reads it" do
|
||||||
dmail = FactoryGirl.create(:dmail, :owner => @user)
|
dmail = FactoryGirl.create(:dmail, :owner => @user)
|
||||||
assert(!dmail.is_read?)
|
assert(!dmail.is_read?)
|
||||||
|
|||||||
Reference in New Issue
Block a user