DEV: Update more Jobs#enqueue calls to use strings (#15823)

Symbols are converted to strings anyway, so there is no change in behaviour. The latest version of sidekiq introduced a warning for this.
This commit is contained in:
David Taylor 2022-02-04 19:58:34 +00:00 committed by GitHub
parent be8c0baa18
commit 863262a5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -157,7 +157,7 @@ class Admin::EmailController < Admin::AdminController
retry_count = 0 retry_count = 0
begin begin
Jobs.enqueue(:process_email, mail: email_raw, retry_on_rate_limit: true, source: :handle_mail) Jobs.enqueue(:process_email, mail: email_raw, retry_on_rate_limit: true, source: "handle_mail")
rescue JSON::GeneratorError, Encoding::UndefinedConversionError => e rescue JSON::GeneratorError, Encoding::UndefinedConversionError => e
if retry_count == 0 if retry_count == 0
email_raw = email_raw.force_encoding('iso-8859-1').encode("UTF-8") email_raw = email_raw.force_encoding('iso-8859-1').encode("UTF-8")

View File

@ -59,11 +59,11 @@ class NotificationEmailer
notification_type = Notification.types[notification.notification_type] notification_type = Notification.types[notification.notification_type]
hash = { hash = {
type: type, type: type.to_s,
user_id: notification.user_id, user_id: notification.user_id,
notification_id: notification.id, notification_id: notification.id,
notification_data_hash: notification.data_hash, notification_data_hash: notification.data_hash,
notification_type: notification_type, notification_type: notification_type.to_s,
} }
hash[:post_id] = post_id if post_id > 0 && notification_type != :post_approved hash[:post_id] = post_id if post_id > 0 && notification_type != :post_approved

View File

@ -223,7 +223,7 @@ after_initialize do
Jobs.enqueue(:bot_input, Jobs.enqueue(:bot_input,
user_id: user.id, user_id: user.id,
post_id: post.id, post_id: post.id,
input: :reply input: "reply"
) )
end end
end end
@ -233,7 +233,7 @@ after_initialize do
Jobs.enqueue(:bot_input, Jobs.enqueue(:bot_input,
user_id: post.user.id, user_id: post.user.id,
post_id: post.id, post_id: post.id,
input: :edit input: "edit"
) )
end end
end end
@ -244,7 +244,7 @@ after_initialize do
user_id: user.id, user_id: user.id,
post_id: post.id, post_id: post.id,
topic_id: post.topic_id, topic_id: post.topic_id,
input: :delete input: "delete"
) )
end end
end end
@ -254,7 +254,7 @@ after_initialize do
Jobs.enqueue(:bot_input, Jobs.enqueue(:bot_input,
user_id: user.id, user_id: user.id,
post_id: post.id, post_id: post.id,
input: :recover input: "recover"
) )
end end
end end
@ -264,11 +264,11 @@ after_initialize do
input = input =
case self.post_action_type_id case self.post_action_type_id
when *PostActionType.flag_types.values when *PostActionType.flag_types.values
self.post_action_type_id == PostActionType.types[:inappropriate] ? :flag : :reply self.post_action_type_id == PostActionType.types[:inappropriate] ? "flag" : "reply"
when PostActionType.types[:like] when PostActionType.types[:like]
:like "like"
when PostActionType.types[:bookmark] when PostActionType.types[:bookmark]
:bookmark "bookmark"
end end
if input if input
@ -283,7 +283,7 @@ after_initialize do
self.add_model_callback(Bookmark, :after_commit, on: :create) do self.add_model_callback(Bookmark, :after_commit, on: :create) do
if self.post && self.user.enqueue_narrative_bot_job? if self.post && self.user.enqueue_narrative_bot_job?
Jobs.enqueue(:bot_input, user_id: self.user_id, post_id: self.post_id, input: :bookmark) Jobs.enqueue(:bot_input, user_id: self.user_id, post_id: self.post_id, input: "bookmark")
end end
end end
@ -294,7 +294,7 @@ after_initialize do
Jobs.enqueue(:bot_input, Jobs.enqueue(:bot_input,
user_id: user_id, user_id: user_id,
topic_id: topic_id, topic_id: topic_id,
input: :topic_notification_level_changed input: "topic_notification_level_changed"
) )
end end
end end