FIX: email summary subject order should be consistent (#19469)

This commit is contained in:
Roman Rizzi 2022-12-14 15:08:02 -03:00 committed by GitHub
parent 4e42759caa
commit fa8d6860b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,9 @@ module Chat::UserNotificationsExtension
all_channels = grouped_messages.keys
grouped_channels = all_channels.partition { |c| !c.direct_message_channel? }
channels = grouped_channels.first
dm_users = grouped_channels.last.flat_map { |c| grouped_messages[c].map(&:user) }.uniq
dm_messages = grouped_channels.last.flat_map { |c| grouped_messages[c] }
dm_users = dm_messages.sort_by(&:created_at).uniq { |m| m.user_id }.map(&:user)
# Prioritize messages from regular channels over direct messages
if channels.any?