0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/app/serializers/user_option_serializer.rb
chapoi ceed7027de
UX: Consolidate chat notifications into live notification preferences (#41538)
Previously, chat notification settings lived on a separate Chat
preferences tab and push delivery was gated by a standalone
`only_chat_push_notifications` toggle, splitting notification controls
across two places.

This change moves the chat notification settings onto the main
notifications preferences page and replaces the boolean with a
`push_notification_level` dropdown (`none`/`all`/`chat_only`), so push
notifications are managed in one place. This follows an established
pattern, as the solved and assign plugins do this too.

This should make this control more coherent and less confusing.

<img width="574" height="838" alt="CleanShot 2026-07-13 at 15 04 03"
src="https://github.com/user-attachments/assets/0217cb63-77a3-437a-83ae-8003082af6b7"
/>

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2026-07-14 08:32:48 +02:00

71 lines
2.3 KiB
Ruby
Vendored

# frozen_string_literal: true
class UserOptionSerializer < ApplicationSerializer
attributes :user_id,
:mailing_list_mode,
:mailing_list_mode_frequency,
:email_digests,
:email_level,
:email_messages_level,
:external_links_in_new_tab,
:color_scheme_id,
:dark_scheme_id,
:dynamic_favicon,
:enable_quoting,
:enable_smart_lists,
:enable_defer,
:enable_markdown_monospace_font,
:digest_after_minutes,
:automatically_unpin_topics,
:auto_track_topics_after_msecs,
:notification_level_when_replying,
:new_topic_duration_minutes,
:email_previous_replies,
:email_in_reply_to,
:like_notification_frequency,
:notify_on_linked_posts,
:push_notification_level,
:enable_upcoming_change_available_notifications,
:include_tl0_in_digests,
:theme_ids,
:theme_key_seq,
:allow_private_messages,
:enable_allowed_pm_users,
:homepage_id,
:hide_profile_and_presence,
:hide_profile,
:hide_presence,
:text_size,
:text_size_seq,
:title_count_mode,
:bookmark_auto_delete_preference,
:timezone,
:skip_new_user_tips,
:default_calendar,
:oldest_search_log_date,
:seen_popups,
:sidebar_link_to_filtered_list,
:sidebar_show_count_of_new_items,
:watched_precedence_over_muted,
:topics_unread_when_closed,
:composition_mode,
:interface_color_mode,
:show_original_content
def auto_track_topics_after_msecs
object.auto_track_topics_after_msecs || SiteSetting.default_other_auto_track_topics_after_msecs
end
def notification_level_when_replying
object.notification_level_when_replying ||
SiteSetting.default_other_notification_level_when_replying
end
def new_topic_duration_minutes
object.new_topic_duration_minutes || SiteSetting.default_other_new_topic_duration_minutes
end
def theme_ids
object.theme_ids.presence || [SiteSetting.default_theme_id]
end
end