FIX: chat mailer log noise (#28616)

Fixes the log noise caused by a deprecation notice
This commit is contained in:
Renato Atilio 2024-08-29 11:39:08 -03:00 committed by GitHub
parent 0c9c7482b5
commit 54d6e52607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 3 deletions

View File

@ -398,11 +398,13 @@ module Jobs
# Simulate the args being dumped/parsed through JSON # Simulate the args being dumped/parsed through JSON
parsed_opts = JSON.parse(JSON.dump(opts)) parsed_opts = JSON.parse(JSON.dump(opts))
Discourse.deprecate(<<~TEXT.squish, since: "2.9", drop_from: "3.0") if opts != parsed_opts if opts != parsed_opts
Discourse.deprecate(<<~TEXT.squish, since: "2.9", drop_from: "3.0", output_in_test: true)
#{klass.name} was enqueued with argument values which do not cleanly serialize to/from JSON. #{klass.name} was enqueued with argument values which do not cleanly serialize to/from JSON.
This means that the job will be run with slightly different values than the ones supplied to `enqueue`. This means that the job will be run with slightly different values than the ones supplied to `enqueue`.
Argument values should be strings, booleans, numbers, or nil (or arrays/hashes of those value types). Argument values should be strings, booleans, numbers, or nil (or arrays/hashes of those value types).
TEXT TEXT
end
opts = parsed_opts opts = parsed_opts
if ::Jobs.run_later? if ::Jobs.run_later?

View File

@ -15,7 +15,7 @@ module Chat
if DiscoursePluginRegistry.apply_modifier(:chat_mailer_send_summary_to_user, true, user) if DiscoursePluginRegistry.apply_modifier(:chat_mailer_send_summary_to_user, true, user)
Jobs.enqueue( Jobs.enqueue(
:user_email, :user_email,
type: :chat_summary, type: "chat_summary",
user_id: user.id, user_id: user.id,
force_respect_seen_recently: true, force_respect_seen_recently: true,
) )

View File

@ -23,7 +23,9 @@ describe Chat::Mailer do
end end
def expect_enqueued def expect_enqueued
expect_enqueued_with(job:, args:) { described_class.send_unread_mentions_summary } expect {
expect_enqueued_with(job:, args:) { described_class.send_unread_mentions_summary }
}.to_not output.to_stderr_from_any_process
expect(Jobs::UserEmail.jobs.size).to eq(1) expect(Jobs::UserEmail.jobs.size).to eq(1)
end end