mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
DEV: Remove user options from current user serializer (#19089)
User options were serialized at the root level of CurrentUserSerializer, but UserSerializer has a user_option field. This inconsistency caused issues in the past because user_option fields had to be duplicated on the frontend.
This commit is contained in:
33
app/serializers/current_user_option_serializer.rb
Normal file
33
app/serializers/current_user_option_serializer.rb
Normal file
@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CurrentUserOptionSerializer < ApplicationSerializer
|
||||
attributes :mailing_list_mode,
|
||||
:external_links_in_new_tab,
|
||||
:enable_quoting,
|
||||
:dynamic_favicon,
|
||||
:automatically_unpin_topics,
|
||||
:likes_notifications_disabled,
|
||||
:hide_profile_and_presence,
|
||||
:title_count_mode,
|
||||
:enable_defer,
|
||||
:timezone,
|
||||
:skip_new_user_tips,
|
||||
:default_calendar,
|
||||
:bookmark_auto_delete_preference,
|
||||
:seen_popups,
|
||||
:should_be_redirected_to_top,
|
||||
:redirected_to_top,
|
||||
:treat_as_new_topic_start_date,
|
||||
|
||||
def likes_notifications_disabled
|
||||
object.likes_notifications_disabled?
|
||||
end
|
||||
|
||||
def include_redirected_to_top?
|
||||
object.redirected_to_top.present?
|
||||
end
|
||||
|
||||
def include_seen_popups?
|
||||
SiteSetting.enable_user_tips
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user