summaryrefslogtreecommitdiff
path: root/app/services/audit_event_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/audit_event_service.rb')
-rw-r--r--app/services/audit_event_service.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/services/audit_event_service.rb b/app/services/audit_event_service.rb
index 3c21844ec62..d1558c60c3d 100644
--- a/app/services/audit_event_service.rb
+++ b/app/services/audit_event_service.rb
@@ -16,7 +16,7 @@ class AuditEventService
@author = build_author(author)
@entity = entity
@details = details
- @ip_address = (@details[:ip_address].presence || @author.current_sign_in_ip)
+ @ip_address = resolve_ip_address(@details, @author)
end
# Builds the @details attribute for authentication
@@ -64,6 +64,12 @@ class AuditEventService
end
end
+ def resolve_ip_address(details, author)
+ details[:ip_address].presence ||
+ Gitlab::RequestContext.instance.client_ip ||
+ author.current_sign_in_ip
+ end
+
def base_payload
{
author_id: @author.id,