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:
Martin Brennan 2019-12-03 17:31:16 +10:00 committed by Sam
parent f65c453555
commit f3109a1f25
1 changed files with 6 additions and 1 deletions

View File

@ -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