DEV: Refactor location string builders. (#6794)
This commit is contained in:
parent
bd6d482d11
commit
a06d310855
|
@ -35,7 +35,7 @@ class UserNotifications < ActionMailer::Base
|
|||
|
||||
def suspicious_login(user, opts = {})
|
||||
ipinfo = DiscourseIpInfo.get(opts[:client_ip])
|
||||
location = [ipinfo[:city], ipinfo[:region], ipinfo[:country]].reject(&:blank?).join(", ")
|
||||
location = ipinfo[:location]
|
||||
browser = BrowserDetection.browser(opts[:user_agent])
|
||||
device = BrowserDetection.device(opts[:user_agent])
|
||||
os = BrowserDetection.os(opts[:user_agent])
|
||||
|
|
|
@ -21,11 +21,7 @@ module UserAuthTokensMixin
|
|||
|
||||
def location
|
||||
ipinfo = DiscourseIpInfo.get(client_ip, locale: I18n.locale)
|
||||
|
||||
location = [ipinfo[:city], ipinfo[:region], ipinfo[:country]].reject { |x| x.blank? }.join(", ")
|
||||
return I18n.t('staff_action_logs.unknown') if location.blank?
|
||||
|
||||
location
|
||||
ipinfo[:location].presence || I18n.t('staff_action_logs.unknown')
|
||||
end
|
||||
|
||||
def browser
|
||||
|
|
Loading…
Reference in New Issue