Commit 06f1abe5 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'fix-audit-event-ip-address-display' into 'master'

Fix display of IP addresses in audit logs

See merge request gitlab-org/gitlab!35356
parents 12368c7a a03429aa
......@@ -18,7 +18,7 @@ class AuditEventPresenter < Gitlab::View::Presenter::Simple
end
def ip_address
audit_event.ip_address || details[:ip_address]
audit_event.ip_address&.to_s || details[:ip_address]
end
def details
......
---
title: Fix display of IP addresses in audit logs
merge_request: 35356
author:
type: fixed
......@@ -107,6 +107,10 @@ RSpec.describe AuditEventPresenter do
expect(presenter.ip_address).to eq('10.2.1.1')
end
it 'survives a round trip from JSON' do
expect(Gitlab::Json.parse(presenter.ip_address.to_json)).to eq(presenter.ip_address)
end
it 'falls back to the details hash' do
audit_event.update(ip_address: nil)
......
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