DEV: cleanup chat desktop notification data (#28943)

Makes channel_id and is_direct_message_channel consistent across desktop notifications, which also removes the need to lookup the channel from Chat Notification Manager.
This commit is contained in:
David Battersby
2024-10-03 12:43:17 +04:00
committed by GitHub
parent ad8f46f4f1
commit 9eaf908e63
7 changed files with 11 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ module Jobs
@creator = @chat_message.user
@chat_channel = @chat_message.chat_channel
@is_direct_message_channel = @chat_channel.direct_message_channel?
@already_notified_user_ids = args[:already_notified_user_ids] || []
user_ids_to_notify = args[:to_notify_ids_map] || {}
user_ids_to_notify.each { |mention_type, ids| process_mentions(ids, mention_type.to_sym) }
@@ -37,7 +38,7 @@ module Jobs
chat_message_id: @chat_message.id,
chat_channel_id: @chat_channel.id,
mentioned_by_username: @creator.username,
is_direct_message_channel: @chat_channel.direct_message_channel?,
is_direct_message_channel: @is_direct_message_channel,
}
data[:chat_thread_id] = @chat_message.thread_id if @chat_message.in_thread?
@@ -76,6 +77,8 @@ module Jobs
tag: ::Chat::Notifier.push_notification_tag(:mention, @chat_channel.id),
excerpt: @chat_message.push_notification_excerpt,
post_url: post_url,
channel_id: @chat_channel.id,
is_direct_message_channel: @is_direct_message_channel,
}
translation_prefix =

View File

@@ -81,6 +81,7 @@ module Jobs
tag: ::Chat::Notifier.push_notification_tag(:message, @chat_channel.id),
excerpt: @chat_message.push_notification_excerpt,
channel_id: @chat_channel.id,
is_direct_message_channel: @is_direct_message_channel,
}
if @chat_message.in_thread? && !membership.muted?