Commit 98ab4ff5 authored by Jason Robinson's avatar Jason Robinson
Browse files

Merge branch 'hotfix-0.4.0.1-post-report'

parents d7249b24 c7536e52
......@@ -2,7 +2,8 @@
## Bug fixes
Fix performance regression on stream loading with MySQL/MariaDB database backends [#5014](https://github.com/diaspora/diaspora/issues/5014).
* Fix performance regression on stream loading with MySQL/MariaDB database backends [#5014](https://github.com/diaspora/diaspora/issues/5014)
* Fix issue with post reporting [#5017](https://github.com/diaspora/diaspora/issues/5017)
# 0.4.0.0
......
......@@ -8,10 +8,13 @@ class ReportMailer < ActionMailer::Base
:id => id
}
Role.admins.each do |role|
user = User.find_by_id(role.person_id)
unless user.user_preferences.exists?(:email_type => :someone_reported)
resource[:email] = user.email
format(resource).deliver
person = Person.find(role.person_id)
if person.local?
user = User.find_by_id(person.owner_id)
unless user.user_preferences.exists?(:email_type => :someone_reported)
resource[:email] = user.email
format(resource).deliver
end
end
end
end
......
......@@ -7,12 +7,13 @@ require 'spec_helper'
describe Report do
describe '#make_notification' do
before do
@user = bob
Role.add_admin(@user)
@remote = FactoryGirl.create(:person, :diaspora_handle => "remote@remote.net")
@user = FactoryGirl.create(:user_with_aspect, :username => "local")
Role.add_admin(@user.person)
end
it "should deliver successfully" do
expect {
expect {
ReportMailer.new_report('post', 666)
}.to_not raise_error
end
......@@ -22,5 +23,10 @@ describe Report do
ReportMailer.new_report('post', 666)
}.to change(ActionMailer::Base.deliveries, :size).by(1)
end
it "should include correct recipient" do
ReportMailer.new_report('post', 666)
expect(ActionMailer::Base.deliveries[0].to[0]).to include(@user.email)
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment