mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 20:36:39 +08:00
DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. We no longer need to use Rails "require_dependency" anywhere and instead can just use standard Ruby patterns to require files. This is a far reaching change and we expect some followups here.
This commit is contained in:
parent
68d35b14f4
commit
427d54b2b0
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
|
|
||||||
class AboutController < ApplicationController
|
class AboutController < ApplicationController
|
||||||
|
|
||||||
requires_login only: [:live_post_counts]
|
requires_login only: [:live_post_counts]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "backup_restore/backup_restore"
|
require "backup_restore"
|
||||||
require "backup_restore/backup_store"
|
require "backup_restore/backup_store"
|
||||||
|
|
||||||
class Admin::BackupsController < Admin::AdminController
|
class Admin::BackupsController < Admin::AdminController
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email/renderer'
|
|
||||||
|
|
||||||
class Admin::EmailController < Admin::AdminController
|
class Admin::EmailController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'embedding'
|
|
||||||
|
|
||||||
class Admin::EmbeddingController < Admin::AdminController
|
class Admin::EmbeddingController < Admin::AdminController
|
||||||
|
|
||||||
before_action :fetch_embedding
|
before_action :fetch_embedding
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'upload_creator'
|
|
||||||
|
|
||||||
class Admin::EmojisController < Admin::AdminController
|
class Admin::EmojisController < Admin::AdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'report'
|
|
||||||
|
|
||||||
class Admin::ReportsController < Admin::AdminController
|
class Admin::ReportsController < Admin::AdminController
|
||||||
def index
|
def index
|
||||||
reports_methods = ['page_view_total_reqs'] +
|
reports_methods = ['page_view_total_reqs'] +
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'ip_addr'
|
|
||||||
|
|
||||||
class Admin::ScreenedIpAddressesController < Admin::AdminController
|
class Admin::ScreenedIpAddressesController < Admin::AdminController
|
||||||
|
|
||||||
before_action :fetch_screened_ip_address, only: [:update, :destroy]
|
before_action :fetch_screened_ip_address, only: [:update, :destroy]
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'seed_data/categories'
|
|
||||||
require_dependency 'seed_data/topics'
|
|
||||||
|
|
||||||
class Admin::SiteTextsController < Admin::AdminController
|
class Admin::SiteTextsController < Admin::AdminController
|
||||||
|
|
||||||
def self.preferred_keys
|
def self.preferred_keys
|
||||||
|
|
|
@ -26,8 +26,6 @@ class Admin::StaffActionLogsController < Admin::AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def diff
|
def diff
|
||||||
require_dependency "discourse_diff"
|
|
||||||
|
|
||||||
@history = UserHistory.find(params[:id])
|
@history = UserHistory.find(params[:id])
|
||||||
prev = @history.previous_value
|
prev = @history.previous_value
|
||||||
cur = @history.new_value
|
cur = @history.new_value
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'upload_creator'
|
|
||||||
require_dependency 'theme_store/tgz_exporter'
|
|
||||||
require 'base64'
|
require 'base64'
|
||||||
|
|
||||||
class Admin::ThemesController < Admin::AdminController
|
class Admin::ThemesController < Admin::AdminController
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'user_destroyer'
|
|
||||||
require_dependency 'admin_user_index_query'
|
|
||||||
require_dependency 'admin_confirmation'
|
|
||||||
|
|
||||||
class Admin::UsersController < Admin::AdminController
|
class Admin::UsersController < Admin::AdminController
|
||||||
|
|
||||||
before_action :fetch_user, only: [:suspend,
|
before_action :fetch_user, only: [:suspend,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse_updates'
|
|
||||||
|
|
||||||
class Admin::VersionsController < Admin::AdminController
|
class Admin::VersionsController < Admin::AdminController
|
||||||
def show
|
def show
|
||||||
render json: DiscourseUpdates.check_version
|
render json: DiscourseUpdates.check_version
|
||||||
|
|
|
@ -1,20 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'current_user'
|
require 'current_user'
|
||||||
require_dependency 'canonical_url'
|
|
||||||
require_dependency 'discourse'
|
|
||||||
require_dependency 'custom_renderer'
|
|
||||||
require_dependency 'archetype'
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
require_dependency 'crawler_detection'
|
|
||||||
require_dependency 'json_error'
|
|
||||||
require_dependency 'letter_avatar'
|
|
||||||
require_dependency 'distributed_cache'
|
|
||||||
require_dependency 'global_path'
|
|
||||||
require_dependency 'secure_session'
|
|
||||||
require_dependency 'topic_query'
|
|
||||||
require_dependency 'hijack'
|
|
||||||
require_dependency 'read_only_header'
|
|
||||||
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
include CurrentUser
|
include CurrentUser
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'category_serializer'
|
|
||||||
|
|
||||||
class CategoriesController < ApplicationController
|
class CategoriesController < ApplicationController
|
||||||
|
|
||||||
requires_login except: [:index, :categories_and_latest, :categories_and_top, :show, :redirect, :find_by_slug]
|
requires_login except: [:index, :categories_and_latest, :categories_and_top, :show, :redirect, :find_by_slug]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'html_to_markdown'
|
|
||||||
|
|
||||||
class ComposerController < ApplicationController
|
class ComposerController < ApplicationController
|
||||||
|
|
||||||
requires_login
|
requires_login
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'composer_messages_finder'
|
|
||||||
|
|
||||||
class ComposerMessagesController < ApplicationController
|
class ComposerMessagesController < ApplicationController
|
||||||
|
|
||||||
requires_login
|
requires_login
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_query_params'
|
|
||||||
|
|
||||||
class EmbedController < ApplicationController
|
class EmbedController < ApplicationController
|
||||||
include TopicQueryParams
|
include TopicQueryParams
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'inline_oneboxer'
|
|
||||||
|
|
||||||
class InlineOneboxController < ApplicationController
|
class InlineOneboxController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
|
|
||||||
class InvitesController < ApplicationController
|
class InvitesController < ApplicationController
|
||||||
|
|
||||||
requires_login only: [
|
requires_login only: [
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_list_responder'
|
|
||||||
require_dependency 'topic_query_params'
|
|
||||||
|
|
||||||
class ListController < ApplicationController
|
class ListController < ApplicationController
|
||||||
include TopicListResponder
|
include TopicListResponder
|
||||||
include TopicQueryParams
|
include TopicQueryParams
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'notification_serializer'
|
|
||||||
|
|
||||||
class NotificationsController < ApplicationController
|
class NotificationsController < ApplicationController
|
||||||
|
|
||||||
requires_login
|
requires_login
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'oneboxer'
|
|
||||||
|
|
||||||
class OneboxController < ApplicationController
|
class OneboxController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse'
|
|
||||||
|
|
||||||
class PostActionUsersController < ApplicationController
|
class PostActionUsersController < ApplicationController
|
||||||
def index
|
def index
|
||||||
params.require(:post_action_type_id)
|
params.require(:post_action_type_id)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse'
|
|
||||||
|
|
||||||
class PostActionsController < ApplicationController
|
class PostActionsController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'new_post_manager'
|
|
||||||
require_dependency 'post_creator'
|
|
||||||
require_dependency 'post_action_destroyer'
|
|
||||||
require_dependency 'post_destroyer'
|
|
||||||
require_dependency 'post_merger'
|
|
||||||
require_dependency 'distributed_memoizer'
|
|
||||||
require_dependency 'new_post_result_serializer'
|
|
||||||
require_dependency 'post_locker'
|
|
||||||
|
|
||||||
class PostsController < ApplicationController
|
class PostsController < ApplicationController
|
||||||
|
|
||||||
requires_login except: [
|
requires_login except: [
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require_dependency 'reviewable_explanation_serializer'
|
|
||||||
|
|
||||||
class ReviewablesController < ApplicationController
|
class ReviewablesController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'search'
|
|
||||||
|
|
||||||
class SearchController < ApplicationController
|
class SearchController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :check_xhr, only: :show
|
skip_before_action :check_xhr, only: :show
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
require_dependency 'single_sign_on'
|
|
||||||
require_dependency 'single_sign_on_provider'
|
|
||||||
require_dependency 'url_helper'
|
|
||||||
require_dependency 'webauthn/webauthn'
|
|
||||||
|
|
||||||
class SessionController < ApplicationController
|
class SessionController < ApplicationController
|
||||||
class LocalLoginNotAllowed < StandardError; end
|
class LocalLoginNotAllowed < StandardError; end
|
||||||
rescue_from LocalLoginNotAllowed do
|
rescue_from LocalLoginNotAllowed do
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'similar_topic_serializer'
|
|
||||||
require_dependency 'search/grouped_search_results'
|
|
||||||
|
|
||||||
class SimilarTopicsController < ApplicationController
|
class SimilarTopicsController < ApplicationController
|
||||||
|
|
||||||
class SimilarTopic
|
class SimilarTopic
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'site_serializer'
|
|
||||||
|
|
||||||
class SiteController < ApplicationController
|
class SiteController < ApplicationController
|
||||||
layout false
|
layout false
|
||||||
skip_before_action :preload_json, :check_xhr
|
skip_before_action :preload_json, :check_xhr
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'distributed_memoizer'
|
|
||||||
require_dependency 'file_helper'
|
|
||||||
|
|
||||||
class StaticController < ApplicationController
|
class StaticController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :check_xhr, :redirect_to_login_if_required
|
skip_before_action :check_xhr, :redirect_to_login_if_required
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'wizard'
|
|
||||||
require_dependency 'wizard/builder'
|
|
||||||
require_dependency 'wizard/step_updater'
|
|
||||||
|
|
||||||
class StepsController < ApplicationController
|
class StepsController < ApplicationController
|
||||||
requires_login
|
requires_login
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_list_responder'
|
|
||||||
require_dependency 'topic_query_params'
|
|
||||||
require_dependency 'topics_bulk_action'
|
|
||||||
require_dependency 'topic_query'
|
|
||||||
|
|
||||||
class TagsController < ::ApplicationController
|
class TagsController < ::ApplicationController
|
||||||
include TopicListResponder
|
include TopicListResponder
|
||||||
include TopicQueryParams
|
include TopicQueryParams
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'topic_view'
|
|
||||||
require_dependency 'promotion'
|
|
||||||
require_dependency 'url_helper'
|
|
||||||
require_dependency 'topics_bulk_action'
|
|
||||||
require_dependency 'discourse_event'
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
require_dependency 'topic_publisher'
|
|
||||||
require_dependency 'post_action_destroyer'
|
|
||||||
|
|
||||||
class TopicsController < ApplicationController
|
class TopicsController < ApplicationController
|
||||||
requires_login only: [
|
requires_login only: [
|
||||||
:timings,
|
:timings,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "mini_mime"
|
require "mini_mime"
|
||||||
require_dependency 'upload_creator'
|
|
||||||
require_dependency "file_store/local_store"
|
|
||||||
|
|
||||||
class UploadsController < ApplicationController
|
class UploadsController < ApplicationController
|
||||||
requires_login except: [:show, :show_short]
|
requires_login except: [:show, :show_short]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'letter_avatar'
|
|
||||||
|
|
||||||
class UserAvatarsController < ApplicationController
|
class UserAvatarsController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show, :show_letter, :show_proxy_letter]
|
skip_before_action :preload_json, :redirect_to_login_if_required, :check_xhr, :verify_authenticity_token, only: [:show, :show_letter, :show_proxy_letter]
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
# -*- encoding : utf-8 -*-
|
# -*- encoding : utf-8 -*-
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email'
|
|
||||||
require_dependency 'enum'
|
|
||||||
require_dependency 'user_name_suggester'
|
|
||||||
|
|
||||||
class Users::OmniauthCallbacksController < ApplicationController
|
class Users::OmniauthCallbacksController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :redirect_to_login_if_required
|
skip_before_action :redirect_to_login_if_required
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'discourse_hub'
|
|
||||||
require_dependency 'user_name_suggester'
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
require_dependency 'wizard'
|
|
||||||
require_dependency 'wizard/builder'
|
|
||||||
require_dependency 'admin_confirmation'
|
|
||||||
require_dependency 'webauthn/webauthn'
|
|
||||||
|
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
|
|
||||||
skip_before_action :authorize_mini_profiler, only: [:avatar]
|
skip_before_action :authorize_mini_profiler, only: [:avatar]
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'rate_limiter'
|
|
||||||
require_dependency 'email_validator'
|
|
||||||
require_dependency 'email_updater'
|
|
||||||
|
|
||||||
class UsersEmailController < ApplicationController
|
class UsersEmailController < ApplicationController
|
||||||
|
|
||||||
requires_login only: [:index, :update]
|
requires_login only: [:index, :update]
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'wizard'
|
|
||||||
require_dependency 'wizard/builder'
|
|
||||||
|
|
||||||
class WizardController < ApplicationController
|
class WizardController < ApplicationController
|
||||||
requires_login except: [:qunit]
|
requires_login except: [:qunit]
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'current_user'
|
require 'current_user'
|
||||||
require 'canonical_url'
|
require 'canonical_url'
|
||||||
require_dependency 'guardian'
|
|
||||||
require_dependency 'unread'
|
|
||||||
require_dependency 'age_words'
|
|
||||||
require_dependency 'configurable_urls'
|
|
||||||
require_dependency 'mobile_detection'
|
|
||||||
require_dependency 'category_badge'
|
|
||||||
require_dependency 'global_path'
|
|
||||||
require_dependency 'emoji'
|
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
include CurrentUser
|
include CurrentUser
|
||||||
|
|
|
@ -187,7 +187,7 @@ module Jobs
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
opts = args.extract_options!.with_indifferent_access
|
opts = args.extract_options!.with_indifferent_access
|
||||||
|
|
||||||
if Jobs.run_later?
|
if ::Jobs.run_later?
|
||||||
Sidekiq.redis do |r|
|
Sidekiq.redis do |r|
|
||||||
r.set('last_job_perform_at', Time.now.to_i)
|
r.set('last_job_perform_at', Time.now.to_i)
|
||||||
end
|
end
|
||||||
|
@ -275,7 +275,7 @@ module Jobs
|
||||||
extend MiniScheduler::Schedule
|
extend MiniScheduler::Schedule
|
||||||
|
|
||||||
def perform(*args)
|
def perform(*args)
|
||||||
if (Jobs::Heartbeat === self) || !Discourse.readonly_mode?
|
if (::Jobs::Heartbeat === self) || !Discourse.readonly_mode?
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -290,7 +290,8 @@ module Jobs
|
||||||
end
|
end
|
||||||
|
|
||||||
# If we are able to queue a job, do it
|
# If we are able to queue a job, do it
|
||||||
if Jobs.run_later?
|
|
||||||
|
if ::Jobs.run_later?
|
||||||
hash = {
|
hash = {
|
||||||
'class' => klass,
|
'class' => klass,
|
||||||
'args' => [opts]
|
'args' => [opts]
|
||||||
|
@ -361,7 +362,3 @@ module Jobs
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir["#{Rails.root}/app/jobs/onceoff/*.rb"].each { |file| require_dependency file }
|
|
||||||
Dir["#{Rails.root}/app/jobs/regular/*.rb"].each { |file| require_dependency file }
|
|
||||||
Dir["#{Rails.root}/app/jobs/scheduled/*.rb"].each { |file| require_dependency file }
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CleanUpPostTimings < Jobs::Onceoff
|
class CleanUpPostTimings < ::Jobs::Onceoff
|
||||||
|
|
||||||
# Remove post timings that are remnants of previous post moves
|
# Remove post timings that are remnants of previous post moves
|
||||||
# or other shenanigans and don't reference a valid user or post anymore.
|
# or other shenanigans and don't reference a valid user or post anymore.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CleanUpSidekiqStatistic < Jobs::Onceoff
|
class CleanUpSidekiqStatistic < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
$redis.without_namespace.del('sidekiq:sidekiq:statistic')
|
$redis.without_namespace.del('sidekiq:sidekiq:statistic')
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CleanUpUserExportTopics < Jobs::Onceoff
|
class CleanUpUserExportTopics < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
translated_keys = I18n.available_locales.map do |l|
|
translated_keys = I18n.available_locales.map do |l|
|
||||||
I18n.with_locale(:"#{l}") { I18n.t("system_messages.csv_export_succeeded.subject_template") }
|
I18n.with_locale(:"#{l}") { I18n.t("system_messages.csv_export_succeeded.subject_template") }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ClearWidthAndHeight < Jobs::Onceoff
|
class ClearWidthAndHeight < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
# we have to clear all old uploads cause
|
# we have to clear all old uploads cause
|
||||||
# we could have old versions of height / width
|
# we could have old versions of height / width
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CorrectMissingDualstackUrls < Jobs::Onceoff
|
class CorrectMissingDualstackUrls < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
# s3 now uses dualstack urls, keep them around correctly
|
# s3 now uses dualstack urls, keep them around correctly
|
||||||
# in both uploads and optimized_image tables
|
# in both uploads and optimized_image tables
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CreateTagsSearchIndex < Jobs::Onceoff
|
class CreateTagsSearchIndex < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
DB.query('select id, name from tags').each do |t|
|
DB.query('select id, name from tags').each do |t|
|
||||||
SearchIndexer.update_tags_index(t.id, t.name)
|
SearchIndexer.update_tags_index(t.id, t.name)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixFeaturedLinkForTopics < Jobs::Onceoff
|
class FixFeaturedLinkForTopics < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
Topic.where("featured_link IS NOT NULL").find_each do |topic|
|
Topic.where("featured_link IS NOT NULL").find_each do |topic|
|
||||||
featured_link = topic.featured_link
|
featured_link = topic.featured_link
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixInvalidGravatarUploads < Jobs::Onceoff
|
class FixInvalidGravatarUploads < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
Upload.where(original_filename: "gravatar.png").find_each do |upload|
|
Upload.where(original_filename: "gravatar.png").find_each do |upload|
|
||||||
# note, this still feels pretty expensive for a once off
|
# note, this still feels pretty expensive for a once off
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency "upload_fixer"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixInvalidUploadExtensions < Jobs::Onceoff
|
class FixInvalidUploadExtensions < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
UploadFixer.fix_all_extensions
|
UploadFixer.fix_all_extensions
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixOutOfSyncUserUploadedAvatar < Jobs::Onceoff
|
class FixOutOfSyncUserUploadedAvatar < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
DB.exec(<<~SQL)
|
DB.exec(<<~SQL)
|
||||||
WITH X AS (
|
WITH X AS (
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixPostsRead < Jobs::Onceoff
|
class FixPostsRead < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
# Skipping to the last post in a topic used to count all posts in the topic
|
# Skipping to the last post in a topic used to count all posts in the topic
|
||||||
# as read in user stats. Cap the posts read count to 50 * topics_entered.
|
# as read in user stats. Cap the posts read count to 50 * topics_entered.
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'user_destroyer'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixPrimaryEmailsForStagedUsers < Jobs::Onceoff
|
class FixPrimaryEmailsForStagedUsers < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
users = User.where(active: false, staged: true).joins(:email_tokens)
|
users = User.where(active: false, staged: true).joins(:email_tokens)
|
||||||
acting_user = Discourse.system_user
|
acting_user = Discourse.system_user
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'jobs/scheduled/grant_anniversary_badges'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class FixRetroAnniversary < Jobs::Onceoff
|
class FixRetroAnniversary < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class FixS3Etags < Jobs::Onceoff
|
class FixS3Etags < ::Jobs::Onceoff
|
||||||
|
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
[Upload, OptimizedImage].each do |model|
|
[Upload, OptimizedImage].each do |model|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class GrantEmoji < Jobs::Onceoff
|
class GrantEmoji < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
to_award = {}
|
to_award = {}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class GrantFirstReplyByEmail < Jobs::Onceoff
|
class GrantFirstReplyByEmail < ::Jobs::Onceoff
|
||||||
|
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class GrantOnebox < Jobs::Onceoff
|
class GrantOnebox < ::Jobs::Onceoff
|
||||||
sidekiq_options queue: 'low'
|
sidekiq_options queue: 'low'
|
||||||
|
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class InitCategoryTagStats < Jobs::Onceoff
|
class InitCategoryTagStats < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
DB.exec "DELETE FROM category_tag_stats"
|
DB.exec "DELETE FROM category_tag_stats"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class MigrateCensoredWords < Jobs::Onceoff
|
class MigrateCensoredWords < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
row = DB.query_single("SELECT value FROM site_settings WHERE name = 'censored_words'")
|
row = DB.query_single("SELECT value FROM site_settings WHERE name = 'censored_words'")
|
||||||
if row.count > 0
|
if row.count > 0
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'upload_creator'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class MigrateCustomEmojis < Jobs::Onceoff
|
class MigrateCustomEmojis < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
return if Rails.env.test?
|
return if Rails.env.test?
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class MigrateFeaturedLinks < Jobs::Onceoff
|
class MigrateFeaturedLinks < ::Jobs::Onceoff
|
||||||
|
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
TopicCustomField.where(name: "featured_link").find_each do |tcf|
|
TopicCustomField.where(name: "featured_link").find_each do |tcf|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class MigrateTaggingPlugin < Jobs::Onceoff
|
class MigrateTaggingPlugin < ::Jobs::Onceoff
|
||||||
|
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
all_tags = TopicCustomField.where(name: "tags").select('DISTINCT value').all.map(&:value)
|
all_tags = TopicCustomField.where(name: "tags").select('DISTINCT value').all.map(&:value)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class MigrateUploadExtensions < Jobs::Onceoff
|
class MigrateUploadExtensions < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
Upload.find_each do |upload|
|
Upload.find_each do |upload|
|
||||||
upload.extension = File.extname(upload.original_filename)[1..10]
|
upload.extension = File.extname(upload.original_filename)[1..10]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class MigrateUrlSiteSettings < Jobs::Onceoff
|
class MigrateUrlSiteSettings < ::Jobs::Onceoff
|
||||||
SETTINGS = [
|
SETTINGS = [
|
||||||
['logo_url', 'logo'],
|
['logo_url', 'logo'],
|
||||||
['logo_small_url', 'logo_small'],
|
['logo_small_url', 'logo_small'],
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Jobs::Onceoff < Jobs::Base
|
require_relative '../base.rb'
|
||||||
|
|
||||||
|
class Jobs::Onceoff < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def self.name_for(klass)
|
def self.name_for(klass)
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency "upload_recovery"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class PostUploadsRecovery < Jobs::Onceoff
|
class PostUploadsRecovery < ::Jobs::Onceoff
|
||||||
MIN_PERIOD = 30
|
MIN_PERIOD = 30
|
||||||
MAX_PERIOD = 120
|
MAX_PERIOD = 120
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class RemoveOldAutoCloseJobs < Jobs::Onceoff
|
class RemoveOldAutoCloseJobs < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
Jobs.cancel_scheduled_job(:close_topic)
|
Jobs.cancel_scheduled_job(:close_topic)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'jobs/scheduled/grant_anniversary_badges'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class RetroGrantAnniversary < Jobs::Onceoff
|
class RetroGrantAnniversary < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
return unless SiteSetting.enable_badges
|
return unless SiteSetting.enable_badges
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class RetroRecentTimeRead < Jobs::Onceoff
|
class RetroRecentTimeRead < ::Jobs::Onceoff
|
||||||
def execute_onceoff(args)
|
def execute_onceoff(args)
|
||||||
# update past records by evenly distributing total time reading among each post read
|
# update past records by evenly distributing total time reading among each post read
|
||||||
sql = <<~SQL
|
sql = <<~SQL
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email/sender'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class AdminConfirmationEmail < Jobs::Base
|
class AdminConfirmationEmail < ::Jobs::Base
|
||||||
sidekiq_options queue: 'critical'
|
sidekiq_options queue: 'critical'
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class AnonymizeUser < Jobs::Base
|
class AnonymizeUser < ::Jobs::Base
|
||||||
|
|
||||||
sidekiq_options queue: 'low'
|
sidekiq_options queue: 'low'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class AutomaticGroupMembership < Jobs::Base
|
class AutomaticGroupMembership < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
group_id = args[:group_id]
|
group_id = args[:group_id]
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency "backup_restore/local_backup_store"
|
|
||||||
require_dependency "backup_restore/backup_store"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class BackupChunksMerger < Jobs::Base
|
class BackupChunksMerger < ::Jobs::Base
|
||||||
sidekiq_options queue: 'critical', retry: false
|
sidekiq_options queue: 'critical', retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class BulkGrantTrustLevel < Jobs::Base
|
class BulkGrantTrustLevel < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
trust_level = args[:trust_level]
|
trust_level = args[:trust_level]
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'system_message'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
class BulkInvite < ::Jobs::Base
|
||||||
class BulkInvite < Jobs::Base
|
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class BumpTopic < Jobs::Base
|
class BumpTopic < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
topic_timer = TopicTimer.find_by(id: args[:topic_timer_id] || args[:topic_status_update_id])
|
topic_timer = TopicTimer.find_by(id: args[:topic_timer_id] || args[:topic_status_update_id])
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class ConfirmSnsSubscription < Jobs::Base
|
class ConfirmSnsSubscription < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'excon'
|
require 'excon'
|
||||||
require_dependency 'retrieve_title'
|
|
||||||
require_dependency 'topic_link'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CrawlTopicLink < Jobs::Base
|
class CrawlTopicLink < ::Jobs::Base
|
||||||
|
|
||||||
sidekiq_options queue: 'low'
|
sidekiq_options queue: 'low'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class CreateAvatarThumbnails < Jobs::Base
|
class CreateAvatarThumbnails < ::Jobs::Base
|
||||||
sidekiq_options queue: 'low'
|
sidekiq_options queue: 'low'
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "backup_restore/backup_restore"
|
require "backup_restore"
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CreateBackup < Jobs::Base
|
class CreateBackup < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Jobs::CreateUserReviewable < Jobs::Base
|
class Jobs::CreateUserReviewable < ::Jobs::Base
|
||||||
attr_reader :reviewable
|
attr_reader :reviewable
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# base.rb uses this style of require, so maintain usage of it here
|
# base.rb uses this style of require, so maintain usage of it here
|
||||||
require_dependency "#{Rails.root}/app/jobs/regular/user_email.rb"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class CriticalUserEmail < UserEmail
|
class CriticalUserEmail < UserEmail
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class DeleteInaccessibleNotifications < Jobs::Base
|
class DeleteInaccessibleNotifications < ::Jobs::Base
|
||||||
def execute(args)
|
def execute(args)
|
||||||
raise Discourse::InvalidParameters.new(:topic_id) if args[:topic_id].blank?
|
raise Discourse::InvalidParameters.new(:topic_id) if args[:topic_id].blank?
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class DeleteTopic < Jobs::Base
|
class DeleteTopic < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
topic_timer = TopicTimer.find_by(id: args[:topic_timer_id] || args[:topic_status_update_id])
|
topic_timer = TopicTimer.find_by(id: args[:topic_timer_id] || args[:topic_status_update_id])
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class DownloadAvatarFromUrl < Jobs::Base
|
class DownloadAvatarFromUrl < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email/sender'
|
|
||||||
require_dependency "email_backup_token"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class DownloadBackupEmail < Jobs::Base
|
class DownloadBackupEmail < ::Jobs::Base
|
||||||
|
|
||||||
sidekiq_options queue: 'critical'
|
sidekiq_options queue: 'critical'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class DownloadProfileBackgroundFromUrl < Jobs::Base
|
class DownloadProfileBackgroundFromUrl < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require 'excon'
|
require 'excon'
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class EmitWebHookEvent < Jobs::Base
|
class EmitWebHookEvent < ::Jobs::Base
|
||||||
PING_EVENT = 'ping'.freeze
|
PING_EVENT = 'ping'.freeze
|
||||||
MAX_RETRY_COUNT = 4.freeze
|
MAX_RETRY_COUNT = 4.freeze
|
||||||
RETRY_BACKOFF = 5
|
RETRY_BACKOFF = 5
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class EnableBootstrapMode < Jobs::Base
|
class EnableBootstrapMode < ::Jobs::Base
|
||||||
sidekiq_options queue: 'critical'
|
sidekiq_options queue: 'critical'
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
|
|
|
@ -2,13 +2,10 @@
|
||||||
|
|
||||||
require 'csv'
|
require 'csv'
|
||||||
require 'zip'
|
require 'zip'
|
||||||
require_dependency 'system_message'
|
|
||||||
require_dependency 'upload_creator'
|
|
||||||
require_dependency 'upload_markdown'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class ExportCsvFile < Jobs::Base
|
class ExportCsvFile < ::Jobs::Base
|
||||||
sidekiq_options retry: false
|
sidekiq_options retry: false
|
||||||
|
|
||||||
HEADER_ATTRS_FOR ||= HashWithIndifferentAccess.new(
|
HEADER_ATTRS_FOR ||= HashWithIndifferentAccess.new(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class FeatureTopicUsers < Jobs::Base
|
class FeatureTopicUsers < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
topic_id = args[:topic_id]
|
topic_id = args[:topic_id]
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email/sender'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
# Asynchronously send an email
|
# Asynchronously send an email
|
||||||
class InviteEmail < Jobs::Base
|
class InviteEmail < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
raise Discourse::InvalidParameters.new(:invite_id) unless args[:invite_id].present?
|
raise Discourse::InvalidParameters.new(:invite_id) unless args[:invite_id].present?
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'email/sender'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
# Asynchronously send an email
|
# Asynchronously send an email
|
||||||
class InvitePasswordInstructionsEmail < Jobs::Base
|
class InvitePasswordInstructionsEmail < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
raise Discourse::InvalidParameters.new(:username) unless args[:username].present?
|
raise Discourse::InvalidParameters.new(:username) unless args[:username].present?
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency "post_alerter"
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class NotifyCategoryChange < Jobs::Base
|
class NotifyCategoryChange < ::Jobs::Base
|
||||||
def execute(args)
|
def execute(args)
|
||||||
post = Post.find_by(id: args[:post_id])
|
post = Post.find_by(id: args[:post_id])
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_dependency 'post'
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class NotifyMailingListSubscribers < Jobs::Base
|
class NotifyMailingListSubscribers < ::Jobs::Base
|
||||||
include Skippable
|
include Skippable
|
||||||
|
|
||||||
RETRY_TIMES = [5.minute, 15.minute, 30.minute, 45.minute, 90.minute, 180.minute, 300.minute]
|
RETRY_TIMES = [5.minute, 15.minute, 30.minute, 45.minute, 90.minute, 180.minute, 300.minute]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
|
|
||||||
class NotifyMovedPosts < Jobs::Base
|
class NotifyMovedPosts < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
raise Discourse::InvalidParameters.new(:post_ids) if args[:post_ids].blank?
|
raise Discourse::InvalidParameters.new(:post_ids) if args[:post_ids].blank?
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class NotifyPostRevision < Jobs::Base
|
class NotifyPostRevision < ::Jobs::Base
|
||||||
def execute(args)
|
def execute(args)
|
||||||
raise Discourse::InvalidParameters.new(:user_ids) unless args[:user_ids]
|
raise Discourse::InvalidParameters.new(:user_ids) unless args[:user_ids]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Jobs::NotifyReviewable < Jobs::Base
|
class Jobs::NotifyReviewable < ::Jobs::Base
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
reviewable = Reviewable.find_by(id: args[:reviewable_id])
|
reviewable = Reviewable.find_by(id: args[:reviewable_id])
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user