Add timezone to current_user_serializer (#8448)
* the code to get current user already got their user_option record as well, so adding the timezone column to the attributes returned should not create any additional overhead. this timezone will be very useful for getting momentjs dates relative to the user's timezone
This commit is contained in:
parent
f65c453555
commit
f3109a1f25
|
@ -44,7 +44,8 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:groups,
|
||||
:second_factor_enabled,
|
||||
:ignored_users,
|
||||
:title_count_mode
|
||||
:title_count_mode,
|
||||
:timezone
|
||||
|
||||
def groups
|
||||
object.visible_groups.pluck(:id, :name).map { |id, name| { id: id, name: name.downcase } }
|
||||
|
@ -106,6 +107,10 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
object.user_option.redirected_to_top
|
||||
end
|
||||
|
||||
def timezone
|
||||
object.user_option.timezone
|
||||
end
|
||||
|
||||
def can_send_private_email_messages
|
||||
scope.can_send_private_messages_to_email?
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue