discourse/app/serializers/current_user_option_serializer.rb
Martin Brennan 77211b43ee
FEATURE: Enable rich editor for all users (#33699)
We believe the rich editor is a great experience for the
vast majority of sites and users, so we are enabling it
for all sites and all users by default.

This commit does the following:

* Hides the rich_editor site setting and sets it to true by default.
  It can still be overridden by sites that want to disable it
  completely.
* Sets `rich_editor` to true for all sites to enable the rich editor
  everywhere.
* Adds a new `default_composition_mode` site setting and corresponding
user option that defaults to Rich for all users. The other option is
Markdown.
* Changes the rich editor toggle in the composer to use the new
  database-backed user option (`composition_mode`) instead of a local
  storage key/value store. This makes the preference persistent
  across devices.

Existing key/value store settings for the markdown toggle are
kept, the preference will be saved to the user option automatically.
2025-07-28 10:08:50 +10:00

39 lines
1.1 KiB
Ruby
Vendored

# frozen_string_literal: true
class CurrentUserOptionSerializer < ApplicationSerializer
attributes :mailing_list_mode,
:external_links_in_new_tab,
:enable_quoting,
:enable_smart_lists,
:dynamic_favicon,
:automatically_unpin_topics,
:likes_notifications_disabled,
:hide_profile_and_presence,
:hide_profile,
:hide_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,
:sidebar_link_to_filtered_list,
:sidebar_show_count_of_new_items,
:composition_mode
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