DEV: Allow with_service in jobs

This patch introduces a new `ServiceJob` class allowing the use of
`with_service` in jobs.

This way, it’s easier to use the chat service objects in jobs and
provides the same level of functionality than the one we have in
controllers.
This commit is contained in:
Loïc Guitaut
2023-02-21 16:02:10 +01:00
committed by Loïc Guitaut
parent 925a7bd48b
commit b8762172e4
6 changed files with 84 additions and 50 deletions

View File

@ -200,7 +200,7 @@ after_initialize do
load File.expand_path("../lib/slack_compatibility.rb", __FILE__)
load File.expand_path("../lib/post_notification_handler.rb", __FILE__)
load File.expand_path("../lib/secure_uploads_compatibility.rb", __FILE__)
load File.expand_path("../lib/endpoint.rb", __FILE__)
load File.expand_path("../lib/service_runner.rb", __FILE__)
load File.expand_path("../lib/steps_inspector.rb", __FILE__)
load File.expand_path("../app/jobs/regular/auto_manage_channel_memberships.rb", __FILE__)
load File.expand_path("../app/jobs/regular/auto_join_channel_batch.rb", __FILE__)
@ -217,6 +217,7 @@ after_initialize do
load File.expand_path("../app/jobs/scheduled/email_chat_notifications.rb", __FILE__)
load File.expand_path("../app/jobs/scheduled/auto_join_users.rb", __FILE__)
load File.expand_path("../app/jobs/scheduled/chat_periodical_updates.rb", __FILE__)
load File.expand_path("../app/jobs/service_job.rb", __FILE__)
load File.expand_path("../app/services/chat_publisher.rb", __FILE__)
load File.expand_path("../app/services/trash_channel.rb", __FILE__)
load File.expand_path("../app/services/update_channel.rb", __FILE__)