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.
This commit is contained in:
Ted Johansson 2023-12-05 18:03:30 +08:00 committed by GitHub
parent de983796e1
commit c7667f791e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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