Skip to content

A platform for community discussion. Free, open, simple.

DEV: adds basic sorting to avoid flakey test (#19711)

Joffrey JAFFEUXab7f3ee59987
diff --git a/plugins/chat/lib/extensions/user_notifications_extension.rb b/plugins/chat/lib/extensions/user_notifications_extension.rb
index d271053ddf2..8b3723cdb8b 100644
--- a/plugins/chat/lib/extensions/user_notifications_extension.rb
+++ b/plugins/chat/lib/extensions/user_notifications_extension.rb
@@ -69,7 +69,7 @@ module Chat::UserNotificationsExtension
# Prioritize messages from regular channels over direct messages
if channels.any?
- channel_notification_text(channels, dm_users)
+ channel_notification_text(channels.sort_by(&:last_message_sent_at), dm_users)
else
direct_message_notification_text(dm_users)
end