mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 08:52:46 +08:00
0c8f531909
This change encourages users to title their threads to make it easier for other users to join in on conversations that matter to them. The creator of the chat thread will receive a toast notification prompting them to add a thread title when on mobile and the thread has at least 5 sent replies.
55 lines
1.8 KiB
Ruby
55 lines
1.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Chat
|
|
module UserOptionExtension
|
|
# TODO: remove last_emailed_for_chat and chat_isolated in 2023
|
|
def self.prepended(base)
|
|
if base.ignored_columns
|
|
base.ignored_columns = base.ignored_columns + %i[last_emailed_for_chat chat_isolated]
|
|
else
|
|
base.ignored_columns = %i[last_emailed_for_chat chat_isolated]
|
|
end
|
|
|
|
def base.chat_email_frequencies
|
|
@chat_email_frequencies ||= { never: 0, when_away: 1 }
|
|
end
|
|
|
|
# Avoid attempting to override when autoloading
|
|
if !base.method_defined?(:send_chat_email_never?)
|
|
base.enum :chat_email_frequency, base.chat_email_frequencies, prefix: "send_chat_email"
|
|
end
|
|
|
|
def base.chat_header_indicator_preferences
|
|
@chat_header_indicator_preferences ||= {
|
|
all_new: 0,
|
|
dm_and_mentions: 1,
|
|
never: 2,
|
|
only_mentions: 3,
|
|
}
|
|
end
|
|
|
|
# Avoid attempting to override when autoloading
|
|
if !base.method_defined?(:chat_header_indicator_never?)
|
|
base.enum :chat_header_indicator_preference,
|
|
base.chat_header_indicator_preferences,
|
|
prefix: "chat_header_indicator"
|
|
end
|
|
|
|
def base.chat_separate_sidebar_mode
|
|
@chat_separate_sidebar_mode ||= { default: 0, never: 1, always: 2, fullscreen: 3 }
|
|
end
|
|
|
|
# Avoid attempting to override when autoloading
|
|
if !base.method_defined?(:chat_separate_sidebar_mode_default?)
|
|
base.enum :chat_separate_sidebar_mode,
|
|
base.chat_separate_sidebar_mode,
|
|
prefix: "chat_separate_sidebar_mode"
|
|
end
|
|
|
|
if !base.method_defined?(:show_thread_title_prompts?)
|
|
base.attribute :show_thread_title_prompts, :boolean, default: true
|
|
end
|
|
end
|
|
end
|
|
end
|