mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 12:53:39 +08:00
d3a1b09361
This commit allows the user to set their preference vis-a-vis the chat icon in the header of the page. There are three options: - All New (default) - This maintains the existing behaviour where all new messages in the channel show a blue dot on the icon - Direct Messages and Mentions - Only show the green dot on the icon when you are directly messaged or mentioned, the blue dot is never shown - Never - Never show any dot on the chat icon, for those who want tractor-beam-laser-focus
24 lines
805 B
Ruby
24 lines
805 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Chat::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
|
|
|
|
def base.chat_header_indicator_preferences
|
|
@chat_header_indicator_preferences ||= { all_new: 0, dm_and_mentions: 1, never: 2 }
|
|
end
|
|
|
|
base.enum :chat_email_frequency, base.chat_email_frequencies, prefix: "send_chat_email"
|
|
base.enum :chat_header_indicator_preference, base.chat_header_indicator_preferences
|
|
end
|
|
end
|