mirror of
https://github.com/discourse/discourse.git
synced 2025-06-13 01:46:29 +08:00
DEV: makes test more deterministic (#20078)
`last_message_sent_at` could be equal and as a result the order would be random causing random spec failures in plugins/chat/spec/mailers/user_notifications_spec.rb:182
This commit is contained in:
@ -69,7 +69,10 @@ module Chat::UserNotificationsExtension
|
|||||||
|
|
||||||
# Prioritize messages from regular channels over direct messages
|
# Prioritize messages from regular channels over direct messages
|
||||||
if channels.any?
|
if channels.any?
|
||||||
channel_notification_text(channels.sort_by(&:last_message_sent_at), dm_users)
|
channel_notification_text(
|
||||||
|
channels.sort_by { |channel| [channel.last_message_sent_at, channel.created_at] },
|
||||||
|
dm_users,
|
||||||
|
)
|
||||||
else
|
else
|
||||||
direct_message_notification_text(dm_users)
|
direct_message_notification_text(dm_users)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user