2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-31 23:18:50 +08:00
|
|
|
class AuthProviderSerializer < ApplicationSerializer
|
2021-03-25 21:23:48 +08:00
|
|
|
attributes :name,
|
|
|
|
:custom_url,
|
|
|
|
:pretty_name_override,
|
|
|
|
:title_override,
|
2019-10-08 19:10:43 +08:00
|
|
|
:frame_width,
|
|
|
|
:frame_height,
|
|
|
|
:can_connect,
|
|
|
|
:can_revoke,
|
2019-03-27 21:25:04 +08:00
|
|
|
:icon
|
2018-07-31 23:18:50 +08:00
|
|
|
|
|
|
|
def title_override
|
2019-05-07 09:00:09 +08:00
|
|
|
return SiteSetting.get(object.title_setting) if object.title_setting
|
2018-07-31 23:18:50 +08:00
|
|
|
object.title
|
|
|
|
end
|
|
|
|
|
|
|
|
def pretty_name_override
|
2019-05-07 09:00:09 +08:00
|
|
|
return SiteSetting.get(object.pretty_name_setting) if object.pretty_name_setting
|
2018-07-31 23:18:50 +08:00
|
|
|
object.pretty_name
|
|
|
|
end
|
2024-10-23 01:17:36 +08:00
|
|
|
|
|
|
|
def custom_url
|
|
|
|
# ensures that the "/custom" route doesn't trigger the magic custom_url helper in ActionDispatch
|
|
|
|
object.custom_url
|
|
|
|
end
|
2018-07-31 23:18:50 +08:00
|
|
|
end
|