mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
FIX: while changing site text, old and new values can be nil
This commit is contained in:
parent
e6c1f1db52
commit
cf1bd35fc6
2 changed files with 1 additions and 5 deletions
|
@ -134,10 +134,8 @@ class StaffActionLogger
|
|||
}))
|
||||
end
|
||||
|
||||
def log_site_text_change(subject, new_text, old_text, opts={})
|
||||
def log_site_text_change(subject, new_text=nil, old_text=nil, opts={})
|
||||
raise Discourse::InvalidParameters.new(:subject) unless subject.present?
|
||||
raise Discourse::InvalidParameters.new(:new_text) unless new_text.present?
|
||||
raise Discourse::InvalidParameters.new(:old_text) unless old_text.present?
|
||||
UserHistory.create( params(opts).merge({
|
||||
action: UserHistory.actions[:change_site_text],
|
||||
subject: subject,
|
||||
|
|
|
@ -176,8 +176,6 @@ describe StaffActionLogger do
|
|||
describe "log_site_text_change" do
|
||||
it "raises an error when params are invalid" do
|
||||
expect { logger.log_site_text_change(nil, 'new text', 'old text') }.to raise_error(Discourse::InvalidParameters)
|
||||
expect { logger.log_site_text_change('created', nil, 'old text') }.to raise_error(Discourse::InvalidParameters)
|
||||
expect { logger.log_site_text_change('created', 'new text', nil) }.to raise_error(Discourse::InvalidParameters)
|
||||
end
|
||||
|
||||
it "creates a new UserHistory record" do
|
||||
|
|
Loading…
Reference in a new issue