mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Don't raise an error when trying to log nothing
This commit is contained in:
parent
748c13f4a7
commit
b2e2a99898
2 changed files with 16 additions and 0 deletions
|
@ -144,6 +144,8 @@ class StaffActionLogger
|
||||||
end
|
end
|
||||||
|
|
||||||
def log_show_emails(users)
|
def log_show_emails(users)
|
||||||
|
return if users.blank?
|
||||||
|
|
||||||
values = []
|
values = []
|
||||||
|
|
||||||
users.each do |user|
|
users.each do |user|
|
||||||
|
|
|
@ -33,6 +33,20 @@ describe StaffActionLogger do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "log_show_emails" do
|
||||||
|
it "logs the user history" do
|
||||||
|
-> { logger.log_show_emails([admin]) }.should change(UserHistory, :count).by(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't raise an exception with nothing to log" do
|
||||||
|
-> { logger.log_show_emails([]) }.should_not raise_error
|
||||||
|
end
|
||||||
|
|
||||||
|
it "doesn't raise an exception with nil input" do
|
||||||
|
-> { logger.log_show_emails(nil) }.should_not raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'log_post_deletion' do
|
describe 'log_post_deletion' do
|
||||||
let(:deleted_post) { Fabricate(:post) }
|
let(:deleted_post) { Fabricate(:post) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue