FIX: Don't error when the empty current value in dif (#8406)

If current value is nil we should use `&.` combined with `dig` to protect diff from erroring

It is happening when for example theme is delete (new value is empty)
This commit is contained in:
Krzysztof Kotlarek
2019-11-26 09:17:14 +11:00
committed by GitHub
parent d0ad5ecc6d
commit 6e403f20ee
2 changed files with 16 additions and 9 deletions

View File

@ -90,5 +90,12 @@ describe Admin::StaffActionLogsController do
expect(parsed["side_by_side"]).not_to include("omit-dupe")
end
it 'is not erroring when current value is empty' do
theme = Fabricate(:theme)
StaffActionLogger.new(admin).log_theme_destroy(theme)
get "/admin/logs/staff_action_logs/#{UserHistory.last.id}/diff.json"
expect(response.status).to eq(200)
end
end
end