From c7667f791e7199fe15926af0017e9d753616b8a0 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Tue, 5 Dec 2023 18:03:30 +0800 Subject: [PATCH] DEV: Fix chat notifier deprecation warnings from job arguments (#24708) We're seeing some deprecation warnings in production. This is because we're passing a raw Ruby timestamp, which gets stringified implicitly when written to Redis. As per #15842, this conversion needs to be done explicitly. --- plugins/chat/lib/chat/notifier.rb | 4 ++-- .../spec/jobs/regular/chat/notify_mentioned_spec.rb | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/chat/lib/chat/notifier.rb b/plugins/chat/lib/chat/notifier.rb index 2728dc0c13e..45cfbcc1535 100644 --- a/plugins/chat/lib/chat/notifier.rb +++ b/plugins/chat/lib/chat/notifier.rb @@ -358,7 +358,7 @@ module Chat chat_message_id: @chat_message.id, to_notify_ids_map: to_notify.as_json, already_notified_user_ids: already_notified_user_ids, - timestamp: @timestamp, + timestamp: @timestamp.to_s, }, ) end @@ -366,7 +366,7 @@ module Chat def notify_watching_users(except: []) Jobs.enqueue( Jobs::Chat::NotifyWatching, - { chat_message_id: @chat_message.id, except_user_ids: except, timestamp: @timestamp }, + { chat_message_id: @chat_message.id, except_user_ids: except, timestamp: @timestamp.to_s }, ) end end diff --git a/plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb b/plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb index 1810a843168..2d02fe176d4 100644 --- a/plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb +++ b/plugins/chat/spec/jobs/regular/chat/notify_mentioned_spec.rb @@ -58,7 +58,7 @@ describe Jobs::Chat::NotifyMentioned do .track_publish("/chat/notification-alert/#{user.id}") do job.execute( chat_message_id: message.id, - timestamp: message.created_at, + timestamp: message.created_at.to_s, to_notify_ids_map: to_notify_ids_map, already_notified_user_ids: already_notified_user_ids, ) @@ -69,7 +69,7 @@ describe Jobs::Chat::NotifyMentioned do def track_core_notification(user: user_2, message:, to_notify_ids_map:) job.execute( chat_message_id: message.id, - timestamp: message.created_at, + timestamp: message.created_at.to_s, to_notify_ids_map: to_notify_ids_map, ) @@ -186,7 +186,7 @@ describe Jobs::Chat::NotifyMentioned do job.execute( chat_message_id: message.id, - timestamp: message.created_at, + timestamp: message.created_at.to_s, to_notify_ids_map: to_notify_ids_map, ) end @@ -215,7 +215,7 @@ describe Jobs::Chat::NotifyMentioned do job.execute( chat_message_id: message.id, - timestamp: message.created_at, + timestamp: message.created_at.to_s, to_notify_ids_map: to_notify_ids_map, ) end @@ -259,7 +259,7 @@ describe Jobs::Chat::NotifyMentioned do job.execute( chat_message_id: message.id, - timestamp: message.created_at, + timestamp: message.created_at.to_s, to_notify_ids_map: to_notify_ids_map, ) end