DEV: Remove experimental site setting for chat threads (#22720)

We are removing the experimental site setting. Admins can now decide on a per channel basis to enable/disable threading. It's disabled by default.
This commit is contained in:
Jan Cernik 2023-07-26 07:46:23 -03:00 committed by GitHub
parent d06431ba9b
commit a2eb2b0490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 287 additions and 653 deletions

View File

@ -6,7 +6,6 @@ module Jobs
sidekiq_options queue: "critical" sidekiq_options queue: "critical"
def execute(args = {}) def execute(args = {})
return if !SiteSetting.enable_experimental_chat_threaded_discussions
channel = ::Chat::Channel.find_by(id: args[:channel_id]) channel = ::Chat::Channel.find_by(id: args[:channel_id])
return if channel.blank? return if channel.blank?
channel.mark_all_threads_as_read channel.mark_all_threads_as_read

View File

@ -4,8 +4,6 @@ module Jobs
module Chat module Chat
class UpdateThreadReplyCount < Jobs::Base class UpdateThreadReplyCount < Jobs::Base
def execute(args = {}) def execute(args = {})
return if !SiteSetting.enable_experimental_chat_threaded_discussions
thread = ::Chat::Thread.find_by(id: args[:thread_id]) thread = ::Chat::Thread.find_by(id: args[:thread_id])
return if thread.blank? return if thread.blank?
return if thread.replies_count_cache_recently_updated? return if thread.replies_count_cache_recently_updated?

View File

@ -188,9 +188,7 @@ module Chat
end end
def mark_all_threads_as_read(user: nil) def mark_all_threads_as_read(user: nil)
if !(self.threading_enabled || SiteSetting.enable_experimental_chat_threaded_discussions) return if !self.threading_enabled
return
end
DB.exec(<<~SQL, channel_id: self.id) DB.exec(<<~SQL, channel_id: self.id)
UPDATE user_chat_thread_memberships UPDATE user_chat_thread_memberships

View File

@ -108,7 +108,6 @@ module Chat
end end
def self.ensure_consistency! def self.ensure_consistency!
return if !SiteSetting.enable_experimental_chat_threaded_discussions
update_counts update_counts
end end

View File

@ -25,10 +25,6 @@ module Chat
has_one :last_message, serializer: Chat::LastMessageSerializer, embed: :objects has_one :last_message, serializer: Chat::LastMessageSerializer, embed: :objects
def threading_enabled
SiteSetting.enable_experimental_chat_threaded_discussions && object.threading_enabled
end
def initialize(object, opts) def initialize(object, opts)
super(object, opts) super(object, opts)

View File

@ -177,7 +177,7 @@ module Chat
end end
def include_threading_data? def include_threading_data?
SiteSetting.enable_experimental_chat_threaded_discussions && channel.threading_enabled channel.threading_enabled
end end
def include_thread_id? def include_thread_id?

View File

@ -8,10 +8,6 @@ module Chat
object[:tracking] object[:tracking]
end end
def include_unread_thread_overview?
SiteSetting.enable_experimental_chat_threaded_discussions
end
def unread_thread_overview def unread_thread_overview
object[:unread_thread_overview] object[:unread_thread_overview]
end end

View File

@ -36,7 +36,7 @@ module Chat
end end
def include_thread_data? def include_thread_data?
channel.threading_enabled && SiteSetting.enable_experimental_chat_threaded_discussions channel.threading_enabled
end end
def channel def channel

View File

@ -112,8 +112,7 @@ module Chat
end end
def determine_threads_enabled(channel:, **) def determine_threads_enabled(channel:, **)
context.threads_enabled = context.threads_enabled = channel.threading_enabled
SiteSetting.enable_experimental_chat_threaded_discussions && channel.threading_enabled
end end
def determine_include_thread_messages(contract:, threads_enabled:, **) def determine_include_thread_messages(contract:, threads_enabled:, **)

View File

@ -24,7 +24,6 @@ module Chat
# @param [Integer] offset # @param [Integer] offset
# @return [Service::Base::Context] # @return [Service::Base::Context]
policy :threaded_discussions_enabled
contract contract
step :set_limit step :set_limit
step :set_offset step :set_offset
@ -55,10 +54,6 @@ module Chat
context.offset = [contract.offset || 0, 0].max context.offset = [contract.offset || 0, 0].max
end end
def threaded_discussions_enabled
::SiteSetting.enable_experimental_chat_threaded_discussions
end
def fetch_channel(contract:, **) def fetch_channel(contract:, **)
::Chat::Channel.strict_loading.includes(:chatable).find_by(id: contract.channel_id) ::Chat::Channel.strict_loading.includes(:chatable).find_by(id: contract.channel_id)
end end

View File

@ -2,10 +2,7 @@
module Chat module Chat
# Finds a thread within a channel. The thread_id and channel_id must # Finds a thread within a channel. The thread_id and channel_id must
# match. For now we do not want to allow fetching threads if the # match, and the channel must specifically have threading enabled.
# enable_experimental_chat_threaded_discussions hidden site setting
# is not turned on, and the channel must specifically have threading
# enabled.
# #
# @example # @example
# Chat::LookupThread.call(thread_id: 88, channel_id: 2, guardian: guardian) # Chat::LookupThread.call(thread_id: 88, channel_id: 2, guardian: guardian)
@ -19,7 +16,6 @@ module Chat
# @param [Guardian] guardian # @param [Guardian] guardian
# @return [Service::Base::Context] # @return [Service::Base::Context]
policy :threaded_discussions_enabled
contract contract
model :thread, :fetch_thread model :thread, :fetch_thread
policy :invalid_access policy :invalid_access
@ -37,10 +33,6 @@ module Chat
private private
def threaded_discussions_enabled
SiteSetting.enable_experimental_chat_threaded_discussions
end
def fetch_thread(contract:, **) def fetch_thread(contract:, **)
Chat::Thread.includes( Chat::Thread.includes(
:channel, :channel,

View File

@ -32,7 +32,7 @@ module Chat
end end
def self.allow_publish_to_thread?(channel) def self.allow_publish_to_thread?(channel)
SiteSetting.enable_experimental_chat_threaded_discussions && channel.threading_enabled channel.threading_enabled
end end
def self.publish_new!(chat_channel, chat_message, staged_id, staged_thread_id: nil) def self.publish_new!(chat_channel, chat_message, staged_id, staged_thread_id: nil)
@ -161,8 +161,7 @@ module Chat
def self.publish_delete!(chat_channel, chat_message) def self.publish_delete!(chat_channel, chat_message)
message_bus_targets = calculate_publish_targets(chat_channel, chat_message) message_bus_targets = calculate_publish_targets(chat_channel, chat_message)
latest_not_deleted_message_id = latest_not_deleted_message_id =
if chat_message.thread_reply? && chat_channel.threading_enabled && if chat_message.thread_reply? && chat_channel.threading_enabled
SiteSetting.enable_experimental_chat_threaded_discussions
chat_message.thread.latest_not_deleted_message_id(anchor_message_id: chat_message.id) chat_message.thread.latest_not_deleted_message_id(anchor_message_id: chat_message.id)
else else
chat_channel.latest_not_deleted_message_id(anchor_message_id: chat_message.id) chat_channel.latest_not_deleted_message_id(anchor_message_id: chat_message.id)

View File

@ -34,7 +34,6 @@ module Chat
# @return [Service::Base::Context] # @return [Service::Base::Context]
contract contract
policy :threaded_discussions_settings_ok
step :cast_thread_and_channel_ids_to_integer step :cast_thread_and_channel_ids_to_integer
model :report model :report
@ -49,11 +48,6 @@ module Chat
private private
def threaded_discussions_settings_ok(contract:, **)
return true if !contract.include_threads
SiteSetting.enable_experimental_chat_threaded_discussions
end
def cast_thread_and_channel_ids_to_integer(contract:, **) def cast_thread_and_channel_ids_to_integer(contract:, **)
contract.thread_ids = contract.thread_ids.map(&:to_i) contract.thread_ids = contract.thread_ids.map(&:to_i)
contract.channel_ids = contract.channel_ids.map(&:to_i) contract.channel_ids = contract.channel_ids.map(&:to_i)

View File

@ -2,10 +2,7 @@
module Chat module Chat
# Updates a thread. The thread_id and channel_id must # Updates a thread. The thread_id and channel_id must
# match. For now we do not want to allow updating threads if the # match, and the channel must specifically have threading enabled.
# enable_experimental_chat_threaded_discussions hidden site setting
# is not turned on, and the channel must specifically have threading
# enabled.
# #
# Only the thread title can be updated. # Only the thread title can be updated.
# #
@ -22,7 +19,6 @@ module Chat
# @option params_to_edit [String,nil] title # @option params_to_edit [String,nil] title
# @return [Service::Base::Context] # @return [Service::Base::Context]
policy :threaded_discussions_enabled
contract contract
model :thread, :fetch_thread model :thread, :fetch_thread
policy :can_view_channel policy :can_view_channel
@ -43,10 +39,6 @@ module Chat
private private
def threaded_discussions_enabled
SiteSetting.enable_experimental_chat_threaded_discussions
end
def fetch_thread(contract:, **) def fetch_thread(contract:, **)
Chat::Thread.find_by(id: contract.thread_id, channel_id: contract.channel_id) Chat::Thread.find_by(id: contract.thread_id, channel_id: contract.channel_id)
end end

View File

@ -127,7 +127,6 @@
</div> </div>
{{/if}} {{/if}}
{{#if this.togglingThreadingAvailable}}
<div class="chat-form__section -threading"> <div class="chat-form__section -threading">
<div class="chat-form__field"> <div class="chat-form__field">
<label class="chat-form__label"> <label class="chat-form__label">
@ -151,7 +150,6 @@
/> />
</div> </div>
</div> </div>
{{/if}}
{{/if}} {{/if}}
{{#unless @channel.isDirectMessageChannel}} {{#unless @channel.isDirectMessageChannel}}

View File

@ -59,14 +59,6 @@ export default class ChatChannelSettingsView extends Component {
return this.args.channel.isCategoryChannel; return this.args.channel.isCategoryChannel;
} }
get togglingThreadingAvailable() {
return (
this.siteSettings.enable_experimental_chat_threaded_discussions &&
this.args.channel.isCategoryChannel &&
this.currentUser?.admin
);
}
get autoJoinAvailable() { get autoJoinAvailable() {
return ( return (
this.siteSettings.max_chat_auto_joined_users > 0 && this.siteSettings.max_chat_auto_joined_users > 0 &&

View File

@ -104,7 +104,6 @@
</div> </div>
{{/if}} {{/if}}
{{#if this.threadingAvailable}}
<div class="chat-modal-create-channel__control -threading-toggle"> <div class="chat-modal-create-channel__control -threading-toggle">
<label class="chat-modal-create-channel__label"> <label class="chat-modal-create-channel__label">
<Input <Input
@ -122,7 +121,6 @@
</div> </div>
</label> </label>
</div> </div>
{{/if}}
</:body> </:body>
<:footer> <:footer>
<button <button

View File

@ -50,13 +50,6 @@ export default class ChatModalCreateChannel extends Component {
return isPresent(this.category); return isPresent(this.category);
} }
get threadingAvailable() {
return (
this.siteSettings.enable_experimental_chat_threaded_discussions &&
this.categorySelected
);
}
get createDisabled() { get createDisabled() {
return !this.categorySelected || isBlank(this.name); return !this.categorySelected || isBlank(this.name);
} }

View File

@ -7,7 +7,6 @@ export default class ChatChannelComposer extends Service {
@service chat; @service chat;
@service currentUser; @service currentUser;
@service router; @service router;
@service siteSettings;
@service("chat-thread-composer") threadComposer; @service("chat-thread-composer") threadComposer;
@tracked message; @tracked message;
@ -53,10 +52,7 @@ export default class ChatChannelComposer extends Service {
async replyTo(message) { async replyTo(message) {
this.chat.activeMessage = null; this.chat.activeMessage = null;
if ( if (message.channel.threadingEnabled) {
this.siteSettings.enable_experimental_chat_threaded_discussions &&
message.channel.threadingEnabled
) {
if (!message.thread?.id) { if (!message.thread?.id) {
message.thread = message.channel.createStagedThread(message); message.thread = message.channel.createStagedThread(message);
} }

View File

@ -27,7 +27,6 @@ de:
max_mentions_per_chat_message: "Maximale Anzahl von @name-Benachrichtigungen, die ein Benutzer in einer Chat-Nachricht verwenden kann." max_mentions_per_chat_message: "Maximale Anzahl von @name-Benachrichtigungen, die ein Benutzer in einer Chat-Nachricht verwenden kann."
chat_max_direct_message_users: "Benutzer können nicht mehr als diese Anzahl anderer Benutzer hinzufügen, wenn sie eine neue Direktnachricht erstellen. Auf 0 setzen, um nur Nachrichten an sich selbst zuzulassen. Teammitglieder sind von dieser Einstellung ausgenommen." chat_max_direct_message_users: "Benutzer können nicht mehr als diese Anzahl anderer Benutzer hinzufügen, wenn sie eine neue Direktnachricht erstellen. Auf 0 setzen, um nur Nachrichten an sich selbst zuzulassen. Teammitglieder sind von dieser Einstellung ausgenommen."
chat_allow_archiving_channels: "Dem Team erlauben, Nachrichten zu einem Thema zu archivieren, wenn sie einen Kanal schließen." chat_allow_archiving_channels: "Dem Team erlauben, Nachrichten zu einem Thema zu archivieren, wenn sie einen Kanal schließen."
enable_experimental_chat_threaded_discussions: "EXPERIMENTELL: Team-Mitgliedern erlauben, Threading in Chat-Kanälen zu aktivieren, damit parallele Diskussionen in einem Kanal stattfinden können, wenn Benutzer einander antworten."
errors: errors:
chat_default_channel: "Der Standard-Chat-Kanal muss ein öffentlicher Kanal sein." chat_default_channel: "Der Standard-Chat-Kanal muss ein öffentlicher Kanal sein."
direct_message_enabled_groups_invalid: "Du musst mindestens eine Gruppe für diese Einstellung angeben. Wenn du nicht möchtest, dass andere Personen als Teammitglieder Direktnachrichten senden, wähle die Gruppe für Teammitglieder aus." direct_message_enabled_groups_invalid: "Du musst mindestens eine Gruppe für diese Einstellung angeben. Wenn du nicht möchtest, dass andere Personen als Teammitglieder Direktnachrichten senden, wähle die Gruppe für Teammitglieder aus."

View File

@ -21,7 +21,6 @@ en:
max_mentions_per_chat_message: "Maximum number of @name notifications a user can use in a chat message." max_mentions_per_chat_message: "Maximum number of @name notifications a user can use in a chat message."
chat_max_direct_message_users: "Users cannot add more than this number of other users when creating a new direct message. Set to 0 to only allow messages to oneself. Staff are exempt from this setting." chat_max_direct_message_users: "Users cannot add more than this number of other users when creating a new direct message. Set to 0 to only allow messages to oneself. Staff are exempt from this setting."
chat_allow_archiving_channels: "Allow staff to archive messages to a topic when closing a channel." chat_allow_archiving_channels: "Allow staff to archive messages to a topic when closing a channel."
enable_experimental_chat_threaded_discussions: "EXPERIMENTAL: Allow staff to enable threading on chat channels, which allows for parallel discussions to occur in a channel when users reply to one another."
errors: errors:
chat_default_channel: "The default chat channel must be a public channel." chat_default_channel: "The default chat channel must be a public channel."
direct_message_enabled_groups_invalid: "You must specify at least one group for this setting. If you do not want anyone except staff to send direct messages, choose the staff group." direct_message_enabled_groups_invalid: "You must specify at least one group for this setting. If you do not want anyone except staff to send direct messages, choose the staff group."

View File

@ -27,7 +27,6 @@ he:
max_mentions_per_chat_message: "מספר התראות מרבי של @שם בהן יכול להשתמש משתמש בהודעת צ׳אט." max_mentions_per_chat_message: "מספר התראות מרבי של @שם בהן יכול להשתמש משתמש בהודעת צ׳אט."
chat_max_direct_message_users: "משתמשים לא יכולים להוסיף יותר מכמות זו של משתמשים אחרים בעת יצירת הודעה ישירה חדשה. יש להגדיר ל־0 כדי לאפשר הודעות עצמיות. הסגל מוחרג מההגדרה הזאת." chat_max_direct_message_users: "משתמשים לא יכולים להוסיף יותר מכמות זו של משתמשים אחרים בעת יצירת הודעה ישירה חדשה. יש להגדיר ל־0 כדי לאפשר הודעות עצמיות. הסגל מוחרג מההגדרה הזאת."
chat_allow_archiving_channels: "לאפשר לסגל להעביר הודעות לארכיון בנושא בעת סגירת ערוץ." chat_allow_archiving_channels: "לאפשר לסגל להעביר הודעות לארכיון בנושא בעת סגירת ערוץ."
enable_experimental_chat_threaded_discussions: "ניסיוני: לאפשר לצוות לאפשר שרשור על ערוצי צ׳אט, מה שמאפשר להתדיין במקביל בערוץ כאשר משתמשים מגיבים זה לזה."
errors: errors:
chat_default_channel: "ערוץ הצ׳אט כברירת המחדל חייב להיות ערוץ ציבורי." chat_default_channel: "ערוץ הצ׳אט כברירת המחדל חייב להיות ערוץ ציבורי."
direct_message_enabled_groups_invalid: "יש לציין לפחות קבוצה אחת בהגדרה הזאת. כדי למנוע מכולם לשלוח הודעות ישירות למעט הסגל, יש לבחור בקבוצת הסגל." direct_message_enabled_groups_invalid: "יש לציין לפחות קבוצה אחת בהגדרה הזאת. כדי למנוע מכולם לשלוח הודעות ישירות למעט הסגל, יש לבחור בקבוצת הסגל."

View File

@ -27,7 +27,6 @@ it:
max_mentions_per_chat_message: "Numero massimo di notifiche @name che un utente può utilizzare in un messaggio di chat." max_mentions_per_chat_message: "Numero massimo di notifiche @name che un utente può utilizzare in un messaggio di chat."
chat_max_direct_message_users: "Gli utenti non possono aggiungere più utenti di quelli indicati da questa opzione durante la creazione di un nuovo messaggio diretto. Impostare l'opzione a 0 per consentire solo i messaggi a se stessi. Questa impostazione non si applica allo staff." chat_max_direct_message_users: "Gli utenti non possono aggiungere più utenti di quelli indicati da questa opzione durante la creazione di un nuovo messaggio diretto. Impostare l'opzione a 0 per consentire solo i messaggi a se stessi. Questa impostazione non si applica allo staff."
chat_allow_archiving_channels: "Consenti allo staff di archiviare i messaggi in un argomento alla chiusura di un canale." chat_allow_archiving_channels: "Consenti allo staff di archiviare i messaggi in un argomento alla chiusura di un canale."
enable_experimental_chat_threaded_discussions: "SPERIMENTALE: Consenti al personale di attivare il threading sui canali di chat, che permette di avere discussioni parallele in un canale quando gli utenti rispondono l'uno all'altro."
errors: errors:
chat_default_channel: "Il canale di chat predefinito deve essere un canale pubblico." chat_default_channel: "Il canale di chat predefinito deve essere un canale pubblico."
direct_message_enabled_groups_invalid: "Devi specificare almeno un gruppo per questa impostazione. Se non vuoi che nessuno al di fuori dello staff possa inviare messaggi diretti, scegli il gruppo dello staff." direct_message_enabled_groups_invalid: "Devi specificare almeno un gruppo per questa impostazione. Se non vuoi che nessuno al di fuori dello staff possa inviare messaggi diretti, scegli il gruppo dello staff."

View File

@ -26,7 +26,6 @@ pl_PL:
max_mentions_per_chat_message: "Maksymalna liczba powiadomień @name, których użytkownik może użyć w wiadomości na czacie." max_mentions_per_chat_message: "Maksymalna liczba powiadomień @name, których użytkownik może użyć w wiadomości na czacie."
chat_max_direct_message_users: "Użytkownicy nie mogą dodać więcej niż ta liczba innych użytkowników podczas tworzenia nowej wiadomości bezpośredniej. Ustaw na 0, aby zezwolić na wysyłanie wiadomości tylko do siebie. Personel jest zwolniony z tego ustawienia." chat_max_direct_message_users: "Użytkownicy nie mogą dodać więcej niż ta liczba innych użytkowników podczas tworzenia nowej wiadomości bezpośredniej. Ustaw na 0, aby zezwolić na wysyłanie wiadomości tylko do siebie. Personel jest zwolniony z tego ustawienia."
chat_allow_archiving_channels: "Zezwól personelowi na archiwizowanie wiadomości w temacie podczas zamykania kanału." chat_allow_archiving_channels: "Zezwól personelowi na archiwizowanie wiadomości w temacie podczas zamykania kanału."
enable_experimental_chat_threaded_discussions: "EKSPERYMENTALNE: Zezwól personelowi na włączanie wątków na kanałach czatu, co pozwala na prowadzenie równoległych dyskusji na kanale, gdy użytkownicy odpowiadają sobie nawzajem."
errors: errors:
chat_default_channel: "Domyślny kanał czatu musi być kanałem publicznym." chat_default_channel: "Domyślny kanał czatu musi być kanałem publicznym."
direct_message_enabled_groups_invalid: "Musisz określić co najmniej jedną grupę dla tego ustawienia. Jeśli nie chcesz, aby ktokolwiek poza personelem wysyłał bezpośrednie wiadomości, wybierz grupę pracowników." direct_message_enabled_groups_invalid: "Musisz określić co najmniej jedną grupę dla tego ustawienia. Jeśli nie chcesz, aby ktokolwiek poza personelem wysyłał bezpośrednie wiadomości, wybierz grupę pracowników."

View File

@ -27,7 +27,6 @@ sv:
max_mentions_per_chat_message: "Maximalt antal @namnomnämnanden en användare kan göra i ett chattmeddelande." max_mentions_per_chat_message: "Maximalt antal @namnomnämnanden en användare kan göra i ett chattmeddelande."
chat_max_direct_message_users: "Användare kan inte lägga till fler än detta antal andra användare när de skapar ett nytt direktmeddelande. Ställ in till 0 för att endast tillåta meddelanden till sig själv. Personalen är undantagen från denna inställning." chat_max_direct_message_users: "Användare kan inte lägga till fler än detta antal andra användare när de skapar ett nytt direktmeddelande. Ställ in till 0 för att endast tillåta meddelanden till sig själv. Personalen är undantagen från denna inställning."
chat_allow_archiving_channels: "Tillåt att personalen arkiverar meddelanden till ett ämne när en kanal stängs." chat_allow_archiving_channels: "Tillåt att personalen arkiverar meddelanden till ett ämne när en kanal stängs."
enable_experimental_chat_threaded_discussions: "EXPERIMENTELLT: Tillåt att personalen aktiverar trådning på chattkanaler, vilket gör att parallella diskussioner kan uppstå i en kanal när användare svarar varandra."
errors: errors:
chat_default_channel: "Standardchattkanalen måste vara en offentlig kanal." chat_default_channel: "Standardchattkanalen måste vara en offentlig kanal."
direct_message_enabled_groups_invalid: "Du måste ange minst en grupp för den här inställningen. Om du inte vill att någon förutom personal ska skicka direktmeddelanden, välj personalgrupp." direct_message_enabled_groups_invalid: "Du måste ange minst en grupp för den här inställningen. Om du inte vill att någon förutom personal ska skicka direktmeddelanden, välj personalgrupp."

View File

@ -116,6 +116,3 @@ chat:
max_chat_draft_length: max_chat_draft_length:
default: 50_000 default: 50_000
hidden: true hidden: true
enable_experimental_chat_threaded_discussions:
default: false
client: true

View File

@ -245,8 +245,7 @@ module Chat
channel_ids: channel_ids, channel_ids: channel_ids,
guardian: guardian, guardian: guardian,
include_missing_memberships: true, include_missing_memberships: true,
include_threads: include_threads: include_threads,
SiteSetting.enable_experimental_chat_threaded_discussions && include_threads,
).report ).report
end end

View File

@ -25,8 +25,7 @@
# into a new channel, they end up as just a flat series of messages that are # into a new channel, they end up as just a flat series of messages that are
# not in a chain. If the original message of a thread and N other messages # not in a chain. If the original message of a thread and N other messages
# in that thread, then any messages left behind just get placed into a new # in that thread, then any messages left behind just get placed into a new
# thread. Message moving will be disabled in the thread UI while # thread. Message moving will be disabled in the thread UI, its too complicated
# enable_experimental_chat_threaded_discussions is present, its too complicated
# to have end users reason about for now, and we may want a standalone # to have end users reason about for now, and we may want a standalone
# "Move Thread" UI later on. # "Move Thread" UI later on.
module Chat module Chat

View File

@ -13,10 +13,6 @@ module DiscourseDev
end end
def data def data
if !SiteSetting.enable_experimental_chat_threaded_discussions
raise "You need to enable_experimental_chat_threaded_discussions to run this task"
end
channel = ::Chat::Channel.find(@channel_id) channel = ::Chat::Channel.find(@channel_id)
return if !channel return if !channel

View File

@ -238,7 +238,6 @@ after_initialize do
add_to_serializer(:current_user, :chat_channels) do add_to_serializer(:current_user, :chat_channels) do
structured = Chat::ChannelFetcher.structured(self.scope) structured = Chat::ChannelFetcher.structured(self.scope)
if SiteSetting.enable_experimental_chat_threaded_discussions
structured[:unread_thread_overview] = ::Chat::TrackingStateReportQuery.call( structured[:unread_thread_overview] = ::Chat::TrackingStateReportQuery.call(
guardian: self.scope, guardian: self.scope,
channel_ids: structured[:public_channels].map(&:id), channel_ids: structured[:public_channels].map(&:id),
@ -246,7 +245,6 @@ after_initialize do
include_read: false, include_read: false,
include_last_reply_details: true, include_last_reply_details: true,
).thread_unread_overview_by_channel ).thread_unread_overview_by_channel
end
Chat::ChannelIndexSerializer.new(structured, scope: self.scope, root: false).as_json Chat::ChannelIndexSerializer.new(structured, scope: self.scope, root: false).as_json
end end

View File

@ -6,10 +6,7 @@ RSpec.describe "Chat::Thread replies_count cache accuracy" do
fab!(:user) { Fabricate(:user) } fab!(:user) { Fabricate(:user) }
fab!(:thread) { Fabricate(:chat_thread) } fab!(:thread) { Fabricate(:chat_thread) }
before do before { SiteSetting.chat_enabled = true }
SiteSetting.chat_enabled = true
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
it "keeps an accurate replies_count cache" do it "keeps an accurate replies_count cache" do
freeze_time freeze_time

View File

@ -429,10 +429,7 @@ describe Jobs::Chat::NotifyMentioned do
end end
context "when the mention is within a thread" do context "when the mention is within a thread" do
before do before { public_channel.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
public_channel.update!(threading_enabled: true)
end
fab!(:thread) { Fabricate(:chat_thread, channel: public_channel) } fab!(:thread) { Fabricate(:chat_thread, channel: public_channel) }

View File

@ -2,17 +2,6 @@
RSpec.describe Jobs::Chat::MarkAllChannelThreadsRead do RSpec.describe Jobs::Chat::MarkAllChannelThreadsRead do
fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) } fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) }
context "when enable_experimental_chat_threaded_discussions is false" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "does nothing" do
Chat::Channel.any_instance.expects(:mark_all_threads_as_read).never
described_class.new.execute(channel_id: channel.id)
end
end
context "when enable_experimental_chat_threaded_discussions is true" do
fab!(:thread_1) { Fabricate(:chat_thread, channel: channel) } fab!(:thread_1) { Fabricate(:chat_thread, channel: channel) }
fab!(:thread_2) { Fabricate(:chat_thread, channel: channel) } fab!(:thread_2) { Fabricate(:chat_thread, channel: channel) }
fab!(:user_1) { Fabricate(:user) } fab!(:user_1) { Fabricate(:user) }
@ -24,7 +13,6 @@ RSpec.describe Jobs::Chat::MarkAllChannelThreadsRead do
fab!(:thread_2_message_2) { Fabricate(:chat_message, thread: thread_2) } fab!(:thread_2_message_2) { Fabricate(:chat_message, thread: thread_2) }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.add(user_1) channel.add(user_1)
channel.add(user_2) channel.add(user_2)
thread_1.add(user_1) thread_1.add(user_1)
@ -42,5 +30,4 @@ RSpec.describe Jobs::Chat::MarkAllChannelThreadsRead do
expect(unread_count(user_1)).to eq(0) expect(unread_count(user_1)).to eq(0)
expect(unread_count(user_2)).to eq(0) expect(unread_count(user_2)).to eq(0)
end end
end
end end

View File

@ -5,16 +5,7 @@ RSpec.describe Jobs::Chat::UpdateThreadReplyCount do
fab!(:message_1) { Fabricate(:chat_message, thread: thread) } fab!(:message_1) { Fabricate(:chat_message, thread: thread) }
fab!(:message_2) { Fabricate(:chat_message, thread: thread) } fab!(:message_2) { Fabricate(:chat_message, thread: thread) }
before do before { Chat::Thread.clear_caches!(thread.id) }
Chat::Thread.clear_caches!(thread.id)
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
it "does nothing if enable_experimental_chat_threaded_discussions is false" do
SiteSetting.enable_experimental_chat_threaded_discussions = false
Chat::Thread.any_instance.expects(:set_replies_count_cache).never
described_class.new.execute(thread_id: thread.id)
end
it "does not error if the thread is deleted" do it "does not error if the thread is deleted" do
id = thread.id id = thread.id

View File

@ -1,10 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe Chat::Thread do RSpec.describe Chat::Thread do
before do before { SiteSetting.chat_enabled = true }
SiteSetting.chat_enabled = true
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
describe ".ensure_consistency!" do describe ".ensure_consistency!" do
fab!(:channel) { Fabricate(:category_channel) } fab!(:channel) { Fabricate(:category_channel) }
@ -65,12 +62,6 @@ RSpec.describe Chat::Thread do
Chat::Thread.expects(:clear_caches!).never Chat::Thread.expects(:clear_caches!).never
described_class.ensure_consistency! described_class.ensure_consistency!
end end
it "does nothing if threads are disabled" do
SiteSetting.enable_experimental_chat_threaded_discussions = false
Chat::Thread.expects(:update_counts).never
described_class.ensure_consistency!
end
end end
end end

View File

@ -29,7 +29,6 @@ describe Chat::ThreadUnreadsQuery do
before do before do
SiteSetting.chat_enabled = true SiteSetting.chat_enabled = true
SiteSetting.enable_experimental_chat_threaded_discussions = true
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone] SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
channel_1.add(current_user) channel_1.add(current_user)
channel_2.add(current_user) channel_2.add(current_user)

View File

@ -9,7 +9,6 @@ RSpec.describe Chat::Api::ChannelThreadsController do
before do before do
SiteSetting.chat_enabled = true SiteSetting.chat_enabled = true
SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone] SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:everyone]
SiteSetting.enable_experimental_chat_threaded_discussions = true
Group.refresh_automatic_groups! Group.refresh_automatic_groups!
sign_in(current_user) sign_in(current_user)
end end
@ -62,15 +61,6 @@ RSpec.describe Chat::Api::ChannelThreadsController do
end end
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "returns 404" do
get "/chat/api/channels/#{thread.channel_id}/threads/#{thread.id}"
expect(response.status).to eq(404)
end
end
context "when user cannot access the channel" do context "when user cannot access the channel" do
before do before do
thread.channel.update!(chatable: Fabricate(:private_category, group: Fabricate(:group))) thread.channel.update!(chatable: Fabricate(:private_category, group: Fabricate(:group)))
@ -175,15 +165,6 @@ RSpec.describe Chat::Api::ChannelThreadsController do
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "returns 404" do
get "/chat/api/channels/#{public_channel.id}/threads"
expect(response.status).to eq(404)
end
end
end end
describe "update" do describe "update" do
@ -247,14 +228,5 @@ RSpec.describe Chat::Api::ChannelThreadsController do
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "returns 404" do
put "/chat/api/channels/#{thread.channel_id}/threads/#{thread.id}", params: params
expect(response.status).to eq(404)
end
end
end end
end end

View File

@ -906,8 +906,6 @@ RSpec.describe Chat::Api::ChannelsController do
end end
describe "when updating threading_enabled" do describe "when updating threading_enabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
it "sets the new value" do it "sets the new value" do
expect { expect {
put "/chat/api/channels/#{channel.id}", params: { channel: { threading_enabled: true } } put "/chat/api/channels/#{channel.id}", params: { channel: { threading_enabled: true } }

View File

@ -233,20 +233,8 @@ describe Chat::MessageSerializer do
describe "threading data" do describe "threading data" do
before { message_1.update!(thread: Fabricate(:chat_thread, channel: chat_channel)) } before { message_1.update!(thread: Fabricate(:chat_thread, channel: chat_channel)) }
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "does not include thread data" do
serialized = described_class.new(message_1, scope: guardian, root: nil).as_json
expect(serialized).not_to have_key(:thread_id)
end
end
context "when the channel has threading_enabled false" do context "when the channel has threading_enabled false" do
before do before { chat_channel.update!(threading_enabled: false) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_channel.update!(threading_enabled: false)
end
it "does not include thread data" do it "does not include thread data" do
serialized = described_class.new(message_1, scope: guardian, root: nil).as_json serialized = described_class.new(message_1, scope: guardian, root: nil).as_json
@ -254,11 +242,8 @@ describe Chat::MessageSerializer do
end end
end end
context "when the channel has threading_enabled true and enable_experimental_chat_threaded_discussions is true" do context "when the channel has threading_enabled true" do
before do before { chat_channel.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_channel.update!(threading_enabled: true)
end
it "does include thread data" do it "does include thread data" do
serialized = described_class.new(message_1, scope: guardian, root: nil).as_json serialized = described_class.new(message_1, scope: guardian, root: nil).as_json

View File

@ -112,11 +112,8 @@ RSpec.describe Chat::ChannelViewBuilder do
it { is_expected.to fail_a_contract } it { is_expected.to fail_a_contract }
end end
context "when channel has threading_enabled and enable_experimental_chat_threaded_discussions is true" do context "when channel has threading_enabled true" do
before do before { channel.update!(threading_enabled: true) }
channel.update!(threading_enabled: true)
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
it "threads_enabled is true" do it "threads_enabled is true" do
expect(result.threads_enabled).to eq(true) expect(result.threads_enabled).to eq(true)
@ -320,10 +317,7 @@ RSpec.describe Chat::ChannelViewBuilder do
end end
context "when not including thread messages" do context "when not including thread messages" do
before do before { channel.update!(threading_enabled: true) }
channel.update!(threading_enabled: true)
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
it "does not include the target message" do it "does not include the target message" do
expect(result.view.chat_messages).to eq( expect(result.view.chat_messages).to eq(

View File

@ -15,16 +15,6 @@ RSpec.describe ::Chat::LookupChannelThreads do
let(:offset) { 0 } let(:offset) { 0 }
let(:params) { { guardian: guardian, channel_id: channel_id, limit: limit, offset: offset } } let(:params) { { guardian: guardian, channel_id: channel_id, limit: limit, offset: offset } }
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
describe "policy - threaded_discussions_enabled" do
context "when disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it { is_expected.to fail_a_policy(:threaded_discussions_enabled) }
end
end
describe "step - set_limit" do describe "step - set_limit" do
fab!(:channel_1) { Fabricate(:chat_channel) } fab!(:channel_1) { Fabricate(:chat_channel) }
let(:channel_id) { channel_1.id } let(:channel_id) { channel_1.id }

View File

@ -18,15 +18,6 @@ RSpec.describe Chat::LookupThread do
let(:guardian) { Guardian.new(current_user) } let(:guardian) { Guardian.new(current_user) }
let(:params) { { guardian: guardian, thread_id: thread.id, channel_id: thread.channel_id } } let(:params) { { guardian: guardian, thread_id: thread.id, channel_id: thread.channel_id } }
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it { is_expected.to fail_a_policy(:threaded_discussions_enabled) }
end
context "when enable_experimental_chat_threaded_discussions is enabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
context "when all steps pass" do context "when all steps pass" do
it "sets the service result as successful" do it "sets the service result as successful" do
expect(result).to be_a_success expect(result).to be_a_success
@ -67,5 +58,4 @@ RSpec.describe Chat::LookupThread do
it { is_expected.to fail_a_policy(:threading_enabled_for_channel) } it { is_expected.to fail_a_policy(:threading_enabled_for_channel) }
end end
end end
end
end end

View File

@ -32,7 +32,6 @@ describe Chat::Publisher do
context "when the message is in a thread and the channel has threading_enabled" do context "when the message is in a thread and the channel has threading_enabled" do
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
thread = Fabricate(:chat_thread, channel: channel) thread = Fabricate(:chat_thread, channel: channel)
message_1.update!(thread: thread) message_1.update!(thread: thread)
message_2.update!(thread: thread) message_2.update!(thread: thread)
@ -130,48 +129,8 @@ describe Chat::Publisher do
end end
describe ".calculate_publish_targets" do describe ".calculate_publish_targets" do
context "when enable_experimental_chat_threaded_discussions is false" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
context "when the message is the original message of a thread" do
fab!(:thread) { Fabricate(:chat_thread, original_message: message_1, channel: channel) }
it "generates the correct targets" do
targets = described_class.calculate_publish_targets(channel, message_1)
expect(targets).to contain_exactly("/chat/#{channel.id}")
end
end
context "when the message is a thread reply" do
fab!(:thread) do
Fabricate(
:chat_thread,
original_message: Fabricate(:chat_message, chat_channel: channel),
channel: channel,
)
end
before { message_1.update!(thread: thread) }
it "generates the correct targets" do
targets = described_class.calculate_publish_targets(channel, message_1)
expect(targets).to contain_exactly("/chat/#{channel.id}")
end
end
context "when the message is not part of a thread" do
it "generates the correct targets" do
targets = described_class.calculate_publish_targets(channel, message_1)
expect(targets).to contain_exactly("/chat/#{channel.id}")
end
end
end
context "when threading_enabled is false for the channel" do context "when threading_enabled is false for the channel" do
before do before { channel.update!(threading_enabled: false) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: false)
end
context "when the message is the original message of a thread" do context "when the message is the original message of a thread" do
fab!(:thread) { Fabricate(:chat_thread, original_message: message_1, channel: channel) } fab!(:thread) { Fabricate(:chat_thread, original_message: message_1, channel: channel) }
@ -207,11 +166,8 @@ describe Chat::Publisher do
end end
end end
context "when enable_experimental_chat_threaded_discussions is true and threading_enabled is true for the channel" do context "when threading_enabled is true for the channel" do
before do before { channel.update!(threading_enabled: true) }
channel.update!(threading_enabled: true)
SiteSetting.enable_experimental_chat_threaded_discussions = true
end
context "when the message is the original message of a thread" do context "when the message is the original message of a thread" do
fab!(:thread) { Fabricate(:chat_thread, original_message: message_1, channel: channel) } fab!(:thread) { Fabricate(:chat_thread, original_message: message_1, channel: channel) }
@ -312,21 +268,6 @@ describe Chat::Publisher do
before { message_1.update!(thread: thread) } before { message_1.update!(thread: thread) }
context "if enable_experimental_chat_threaded_discussions is false" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "publishes to the new_messages_message_bus_channel" do
messages =
MessageBus.track_publish(
described_class.new_messages_message_bus_channel(channel.id),
) { described_class.publish_new!(channel, message_1, staged_id) }
expect(messages).not_to be_empty
end
end
context "if enable_experimental_chat_threaded_discussions is true" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
context "if threading_enabled is false for the channel" do context "if threading_enabled is false for the channel" do
before { channel.update!(threading_enabled: false) } before { channel.update!(threading_enabled: false) }
@ -337,7 +278,6 @@ describe Chat::Publisher do
) { described_class.publish_new!(channel, message_1, staged_id) } ) { described_class.publish_new!(channel, message_1, staged_id) }
expect(messages).not_to be_empty expect(messages).not_to be_empty
end end
end
context "if threading_enabled is true for the channel" do context "if threading_enabled is true for the channel" do
before { channel.update!(threading_enabled: true) } before { channel.update!(threading_enabled: true) }

View File

@ -14,7 +14,7 @@ RSpec.describe ::Chat::TrackingState do
let(:guardian) { Guardian.new(current_user) } let(:guardian) { Guardian.new(current_user) }
let(:id_params) { { channel_ids: [channel_1.id], thread_ids: [thread_1.id] } } let(:id_params) { { channel_ids: [channel_1.id], thread_ids: [thread_1.id] } }
let(:include_threads) { nil } let(:include_threads) { true }
let(:include_missing_memberships) { nil } let(:include_missing_memberships) { nil }
let(:params) do let(:params) do
@ -24,24 +24,6 @@ RSpec.describe ::Chat::TrackingState do
) )
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
context "when include_threads is true" do
let(:include_threads) { true }
it { is_expected.to fail_a_policy(:threaded_discussions_settings_ok) }
end
context "when include_threads is false" do
let(:include_threads) { false }
it { is_expected.not_to fail_a_policy(:threaded_discussions_settings_ok) }
end
end
context "when enable_experimental_chat_threaded_discussions is enabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
let(:include_threads) { true }
fab!(:channel_1_membership) do fab!(:channel_1_membership) do
Fabricate(:user_chat_channel_membership, chat_channel: channel_1, user: current_user) Fabricate(:user_chat_channel_membership, chat_channel: channel_1, user: current_user)
end end
@ -99,9 +81,7 @@ RSpec.describe ::Chat::TrackingState do
end end
context "when thread_ids and channel_ids are provided" do context "when thread_ids and channel_ids are provided" do
let(:id_params) do let(:id_params) { { channel_ids: [channel_1.id, channel_2.id], thread_ids: [thread_2.id] } }
{ channel_ids: [channel_1.id, channel_2.id], thread_ids: [thread_2.id] }
end
it "gets the tracking state of the channels" do it "gets the tracking state of the channels" do
generate_tracking_state generate_tracking_state
@ -172,7 +152,6 @@ RSpec.describe ::Chat::TrackingState do
end end
end end
end end
end
def generate_tracking_state def generate_tracking_state
Fabricate(:chat_message, chat_channel: channel_1) Fabricate(:chat_message, chat_channel: channel_1)

View File

@ -21,15 +21,6 @@ RSpec.describe Chat::UpdateThread do
{ guardian: guardian, thread_id: thread.id, channel_id: thread.channel_id, title: title } { guardian: guardian, thread_id: thread.id, channel_id: thread.channel_id, title: title }
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it { is_expected.to fail_a_policy(:threaded_discussions_enabled) }
end
context "when enable_experimental_chat_threaded_discussions is enabled" do
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
context "when all steps pass" do context "when all steps pass" do
it "sets the service result as successful" do it "sets the service result as successful" do
expect(result).to be_a_success expect(result).to be_a_success
@ -101,5 +92,4 @@ RSpec.describe Chat::UpdateThread do
it { is_expected.to fail_a_policy(:threading_enabled_for_channel) } it { is_expected.to fail_a_policy(:threading_enabled_for_channel) }
end end
end end
end
end end

View File

@ -178,7 +178,6 @@ RSpec.describe "Channel - Info - Settings page", type: :system do
end end
it "can enable threading" do it "can enable threading" do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_page.visit_channel_settings(channel_1) chat_page.visit_channel_settings(channel_1)
expect { expect {

View File

@ -15,25 +15,9 @@ describe "Channel thread message echoing", type: :system do
sign_in(current_user) sign_in(current_user)
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
fab!(:channel) { Fabricate(:chat_channel) }
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "echoes the thread messages into the main channel stream" do
thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
chat_page.visit_channel(channel)
thread.chat_messages.each do |thread_message|
expect(channel_page).to have_css(channel_page.message_by_id_selector(thread_message.id))
end
end
end
context "when threading_enabled is false for the channel" do context "when threading_enabled is false for the channel" do
fab!(:channel) { Fabricate(:chat_channel) } fab!(:channel) { Fabricate(:chat_channel) }
before do before { channel.update!(threading_enabled: false) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: false)
end
it "echoes the thread messages into the main channel stream" do it "echoes the thread messages into the main channel stream" do
thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user]) thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
@ -44,16 +28,13 @@ describe "Channel thread message echoing", type: :system do
end end
end end
context "when enable_experimental_chat_threaded_discussions is true and threading is enabled for the channel" do context "when threading is enabled for the channel" do
fab!(:channel) { Fabricate(:chat_channel) } fab!(:channel) { Fabricate(:chat_channel) }
fab!(:thread) do fab!(:thread) do
chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user]) chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
end end
before do before { channel.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: true)
end
it "does not echo the thread messages except for the original message into the channel stream" do it "does not echo the thread messages except for the original message into the channel stream" do
chat_page.visit_channel(channel) chat_page.visit_channel(channel)

View File

@ -38,10 +38,7 @@ RSpec.describe "Chat | composer | channel", type: :system, js: true do
end end
context "when threading is enabled" do context "when threading is enabled" do
before do before { channel_1.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel_1.update!(threading_enabled: true)
end
it "replies in the thread" do it "replies in the thread" do
chat_page.visit_channel(channel_1) chat_page.visit_channel(channel_1)

View File

@ -54,10 +54,7 @@ RSpec.describe "Chat | composer | shortcuts | channel", type: :system do
) )
end end
before do before { channel_1.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel_1.update!(threading_enabled: true)
end
it "directs the shortcut to the focused composer" do it "directs the shortcut to the focused composer" do
chat.visit_channel(channel_1) chat.visit_channel(channel_1)

View File

@ -11,7 +11,6 @@ RSpec.describe "Chat | composer | shortcuts | thread", type: :system do
let(:side_panel_page) { PageObjects::Pages::ChatSidePanel.new } let(:side_panel_page) { PageObjects::Pages::ChatSidePanel.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.add(current_user) channel_1.add(current_user)
sign_in(current_user) sign_in(current_user)

View File

@ -13,7 +13,6 @@ RSpec.describe "Chat | composer | thread", type: :system, js: true do
let(:thread_page) { PageObjects::Pages::ChatThread.new } let(:thread_page) { PageObjects::Pages::ChatThread.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.add(current_user) channel_1.add(current_user)
sign_in(current_user) sign_in(current_user)

View File

@ -39,10 +39,7 @@ RSpec.describe "Chat message - channel", type: :system do
end end
context "when the message is part of a thread" do context "when the message is part of a thread" do
before do before { channel_1.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel_1.update!(threading_enabled: true)
end
fab!(:thread_1) do fab!(:thread_1) do
chat_thread_chain_bootstrap( chat_thread_chain_bootstrap(

View File

@ -18,7 +18,6 @@ RSpec.describe "Chat message - thread", type: :system do
channel_1.update!(threading_enabled: true) channel_1.update!(threading_enabled: true)
channel_1.add(current_user) channel_1.add(current_user)
channel_1.add(other_user) channel_1.add(other_user)
SiteSetting.enable_experimental_chat_threaded_discussions = true
sign_in(current_user) sign_in(current_user)
end end

View File

@ -33,8 +33,6 @@ RSpec.describe "Create channel", type: :system do
end end
it "shows threading toggle" do it "shows threading toggle" do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_page.visit_browse chat_page.visit_browse
chat_page.new_channel_button.click chat_page.new_channel_button.click
channel_modal.select_category(category_1) channel_modal.select_category(category_1)

View File

@ -118,7 +118,6 @@ RSpec.describe "Deleted message", type: :system do
before do before do
channel_1.update!(threading_enabled: true) channel_1.update!(threading_enabled: true)
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_user_bootstrap(user: other_user, channel: channel_1) chat_system_user_bootstrap(user: other_user, channel: channel_1)
Chat::Thread.update_counts Chat::Thread.update_counts
end end

View File

@ -15,23 +15,9 @@ describe "Thread indicator for chat messages", type: :system do
sign_in(current_user) sign_in(current_user)
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
fab!(:channel) { Fabricate(:chat_channel) }
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "shows no thread indicators in the channel" do
thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
chat_page.visit_channel(channel)
expect(channel_page).to have_no_thread_indicator(thread.original_message)
end
end
context "when threading_enabled is false for the channel" do context "when threading_enabled is false for the channel" do
fab!(:channel) { Fabricate(:chat_channel) } fab!(:channel) { Fabricate(:chat_channel) }
before do before { channel.update!(threading_enabled: false) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: false)
end
it "shows no thread inidcators in the channel" do it "shows no thread inidcators in the channel" do
thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user]) thread = chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
@ -40,7 +26,7 @@ describe "Thread indicator for chat messages", type: :system do
end end
end end
context "when enable_experimental_chat_threaded_discussions is true and threading is enabled for the channel" do context "when threading is enabled for the channel" do
fab!(:channel) { Fabricate(:chat_channel) } fab!(:channel) { Fabricate(:chat_channel) }
fab!(:thread_1) do fab!(:thread_1) do
chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user]) chat_thread_chain_bootstrap(channel: channel, users: [current_user, other_user])
@ -53,10 +39,7 @@ describe "Thread indicator for chat messages", type: :system do
) )
end end
before do before { channel.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: true)
end
it "throws thread indicators on all original messages" do it "throws thread indicators on all original messages" do
chat_page.visit_channel(channel) chat_page.visit_channel(channel)

View File

@ -135,7 +135,6 @@ RSpec.describe "Navigation", type: :system do
fab!(:thread) { Fabricate(:chat_thread, channel: category_channel) } fab!(:thread) { Fabricate(:chat_thread, channel: category_channel) }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
category_channel.update!(threading_enabled: true) category_channel.update!(threading_enabled: true)
Fabricate(:chat_message, thread: thread, chat_channel: thread.channel) Fabricate(:chat_message, thread: thread, chat_channel: thread.channel)
thread.add(current_user) thread.add(current_user)

View File

@ -18,7 +18,6 @@ RSpec.describe "Reply to message - channel - drawer", type: :system do
end end
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.update!(threading_enabled: true) channel_1.update!(threading_enabled: true)
channel_1.add(current_user) channel_1.add(current_user)

View File

@ -18,7 +18,6 @@ RSpec.describe "Reply to message - channel - full page", type: :system do
end end
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.add(current_user) channel_1.add(current_user)
sign_in(current_user) sign_in(current_user)

View File

@ -18,7 +18,6 @@ RSpec.describe "Reply to message - channel - mobile", type: :system, mobile: tru
end end
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.update!(threading_enabled: true) channel_1.update!(threading_enabled: true)
channel_1.add(current_user) channel_1.add(current_user)

View File

@ -11,7 +11,6 @@ RSpec.describe "Reply to message - smoke", type: :system do
fab!(:original_message) { Fabricate(:chat_message, chat_channel: channel_1) } fab!(:original_message) { Fabricate(:chat_message, chat_channel: channel_1) }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.add(user_1) channel_1.add(user_1)
channel_1.add(user_2) channel_1.add(user_2)

View File

@ -10,7 +10,6 @@ RSpec.describe "Chat | Select message | thread", type: :system do
let(:thread_page) { PageObjects::Pages::ChatThread.new } let(:thread_page) { PageObjects::Pages::ChatThread.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap chat_system_bootstrap
channel_1.add(current_user) channel_1.add(current_user)
sign_in(current_user) sign_in(current_user)
@ -26,10 +25,7 @@ RSpec.describe "Chat | Select message | thread", type: :system do
Fabricate(:chat_message, chat_channel: channel_1, in_reply_to: original_message) Fabricate(:chat_message, chat_channel: channel_1, in_reply_to: original_message)
end end
before do before { channel_1.update!(threading_enabled: true) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel_1.update!(threading_enabled: true)
end
it "can select multiple messages" do it "can select multiple messages" do
chat_page.visit_thread(thread_message_1.thread) chat_page.visit_thread(thread_message_1.thread)

View File

@ -15,25 +15,9 @@ describe "Single thread in side panel", type: :system do
sign_in(current_user) sign_in(current_user)
end end
context "when enable_experimental_chat_threaded_discussions is disabled" do
fab!(:channel) { Fabricate(:chat_channel) }
before { SiteSetting.enable_experimental_chat_threaded_discussions = false }
it "does not open the side panel for a single thread" do
thread =
chat_thread_chain_bootstrap(channel: channel, users: [current_user, Fabricate(:user)])
chat_page.visit_channel(channel)
channel_page.hover_message(thread.original_message)
expect(page).not_to have_css(".chat-message-thread-btn")
end
end
context "when threading_enabled is false for the channel" do context "when threading_enabled is false for the channel" do
fab!(:channel) { Fabricate(:chat_channel) } fab!(:channel) { Fabricate(:chat_channel) }
before do before { channel.update!(threading_enabled: false) }
SiteSetting.enable_experimental_chat_threaded_discussions = true
channel.update!(threading_enabled: false)
end
it "does not open the side panel for a single thread" do it "does not open the side panel for a single thread" do
thread = thread =
@ -44,13 +28,11 @@ describe "Single thread in side panel", type: :system do
end end
end end
context "when enable_experimental_chat_threaded_discussions is true and threading is enabled for the channel" do context "when threading is enabled for the channel" do
fab!(:user_2) { Fabricate(:user) } fab!(:user_2) { Fabricate(:user) }
fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) } fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) }
fab!(:thread) { chat_thread_chain_bootstrap(channel: channel, users: [current_user, user_2]) } fab!(:thread) { chat_thread_chain_bootstrap(channel: channel, users: [current_user, user_2]) }
before { SiteSetting.enable_experimental_chat_threaded_discussions = true }
context "when in full page" do context "when in full page" do
context "when switching channel" do context "when switching channel" do
fab!(:channel_2) { Fabricate(:chat_channel, threading_enabled: true) } fab!(:channel_2) { Fabricate(:chat_channel, threading_enabled: true) }

View File

@ -13,7 +13,6 @@ describe "Thread list in side panel | drawer", type: :system do
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new } let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap(current_user, [channel]) chat_system_bootstrap(current_user, [channel])
sign_in(current_user) sign_in(current_user)
end end

View File

@ -13,7 +13,6 @@ describe "Thread list in side panel | full page", type: :system do
let(:thread_list_page) { PageObjects::Components::Chat::ThreadList.new } let(:thread_list_page) { PageObjects::Components::Chat::ThreadList.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap(current_user, [channel]) chat_system_bootstrap(current_user, [channel])
sign_in(current_user) sign_in(current_user)
end end

View File

@ -15,7 +15,6 @@ describe "Thread tracking state | drawer", type: :system do
let(:drawer_page) { PageObjects::Pages::ChatDrawer.new } let(:drawer_page) { PageObjects::Pages::ChatDrawer.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap(current_user, [channel]) chat_system_bootstrap(current_user, [channel])
chat_system_user_bootstrap(user: other_user, channel: channel) chat_system_user_bootstrap(user: other_user, channel: channel)
sign_in(current_user) sign_in(current_user)

View File

@ -13,7 +13,6 @@ describe "Thread tracking state | full page", type: :system do
let(:sidebar_page) { PageObjects::Pages::Sidebar.new } let(:sidebar_page) { PageObjects::Pages::Sidebar.new }
before do before do
SiteSetting.enable_experimental_chat_threaded_discussions = true
chat_system_bootstrap(current_user, [channel]) chat_system_bootstrap(current_user, [channel])
sign_in(current_user) sign_in(current_user)
thread.add(current_user) thread.add(current_user)