2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
module ActiveSessionsHelper
|
|
|
|
# Maps a device type as defined in `ActiveSession` to an svg icon name and
|
|
|
|
# outputs the icon html.
|
|
|
|
#
|
|
|
|
# see `DeviceDetector::Device::DEVICE_NAMES` about the available device types
|
|
|
|
def active_session_device_type_icon(active_session)
|
|
|
|
icon_name =
|
|
|
|
case active_session.device_type
|
|
|
|
when 'smartphone', 'feature phone', 'phablet'
|
|
|
|
'mobile'
|
|
|
|
when 'tablet'
|
|
|
|
'tablet'
|
|
|
|
when 'tv', 'smart display', 'camera', 'portable media player', 'console'
|
|
|
|
'media'
|
|
|
|
when 'car browser'
|
|
|
|
'car'
|
|
|
|
else
|
|
|
|
'monitor-o'
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
sprite_icon(icon_name, css_class: 'gl-mt-2')
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
2020-10-04 03:57:07 +05:30
|
|
|
|
|
|
|
def revoke_session_path(active_session)
|
|
|
|
if active_session.session_private_id
|
|
|
|
profile_active_session_path(active_session.session_private_id)
|
|
|
|
else
|
|
|
|
# TODO: remove in 13.7
|
|
|
|
profile_active_session_path(active_session.public_id)
|
|
|
|
end
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|