A platform for community discussion. Free, open, simple.
DEV: Clean up scope resolution operators in plugins (#34979)
Jarek Radosze372355fd088
diff --git a/plugins/automation/app/controllers/discourse_automation/admin_automations_controller.rb b/plugins/automation/app/controllers/discourse_automation/admin_automations_controller.rbindex ac317253edf..c32e60bcd17 100644--- a/plugins/automation/app/controllers/discourse_automation/admin_automations_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/admin_automations_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AdminAutomationsController < ::Admin::AdminController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexautomations =diff --git a/plugins/automation/app/controllers/discourse_automation/admin_controller.rb b/plugins/automation/app/controllers/discourse_automation/admin_controller.rbindex aa064b88e59..7e1bd56c283 100644--- a/plugins/automation/app/controllers/discourse_automation/admin_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/admin_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AdminController < ::Admin::AdminController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexenddiff --git a/plugins/automation/app/controllers/discourse_automation/admin_scriptables_controller.rb b/plugins/automation/app/controllers/discourse_automation/admin_scriptables_controller.rbindex 5ee3b81ff21..8cac8fe832e 100644--- a/plugins/automation/app/controllers/discourse_automation/admin_scriptables_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/admin_scriptables_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AdminScriptablesController < ::Admin::AdminController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexscriptables =diff --git a/plugins/automation/app/controllers/discourse_automation/admin_triggerables_controller.rb b/plugins/automation/app/controllers/discourse_automation/admin_triggerables_controller.rbindex 3c6be2891e9..4c7c66173bb 100644--- a/plugins/automation/app/controllers/discourse_automation/admin_triggerables_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/admin_triggerables_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AdminTriggerablesController < ::Admin::AdminController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexif params[:automation_id].present?diff --git a/plugins/automation/app/controllers/discourse_automation/append_last_checked_by_controller.rb b/plugins/automation/app/controllers/discourse_automation/append_last_checked_by_controller.rbindex b2c9c727f58..ab35bf7abba 100644--- a/plugins/automation/app/controllers/discourse_automation/append_last_checked_by_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/append_last_checked_by_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AppendLastCheckedByController < ApplicationController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_logindef post_checkeddiff --git a/plugins/automation/app/controllers/discourse_automation/automations_controller.rb b/plugins/automation/app/controllers/discourse_automation/automations_controller.rbindex eb0147838e9..b2d85e96846 100644--- a/plugins/automation/app/controllers/discourse_automation/automations_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/automations_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass AutomationsController < ApplicationController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_admindef triggerdiff --git a/plugins/automation/app/controllers/discourse_automation/user_global_notices_controller.rb b/plugins/automation/app/controllers/discourse_automation/user_global_notices_controller.rbindex edadec9e4a0..3cdc75e4c8a 100644--- a/plugins/automation/app/controllers/discourse_automation/user_global_notices_controller.rb+++ b/plugins/automation/app/controllers/discourse_automation/user_global_notices_controller.rb@@ -2,7 +2,7 @@module DiscourseAutomationclass UserGlobalNoticesController < ApplicationController- requires_plugin DiscourseAutomation::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_logindef destroydiff --git a/plugins/automation/app/jobs/regular/discourse_automation/call_zapier_webhook.rb b/plugins/automation/app/jobs/regular/discourse_automation/call_zapier_webhook.rbindex 0e9bc04520d..27d5629960a 100644--- a/plugins/automation/app/jobs/regular/discourse_automation/call_zapier_webhook.rb+++ b/plugins/automation/app/jobs/regular/discourse_automation/call_zapier_webhook.rb@@ -1,24 +1,26 @@# frozen_string_literal: truemodule Jobs- class DiscourseAutomation::CallZapierWebhook < ::Jobs::Base- def execute(args)- RateLimiter.new(nil, "discourse_automation_call_zapier", 5, 30).performed!+ module DiscourseAutomation+ class CallZapierWebhook < ::Jobs::Base+ def execute(args)+ RateLimiter.new(nil, "discourse_automation_call_zapier", 5, 30).performed!- result =- Excon.post(- args["webhook_url"],- body: args["context"].to_json,- headers: {- "Content-Type" => "application/json",- "Accept" => "application/json",- },- )+ result =+ Excon.post(+ args["webhook_url"],+ body: args["context"].to_json,+ headers: {+ "Content-Type" => "application/json",+ "Accept" => "application/json",+ },+ )- if result.status != 200- Rails.logger.warn(- "Failed to call Zapier webhook at #{args["webhook_url"]} Status: #{result.status}: #{result.status_line}",- )+ if result.status != 200+ Rails.logger.warn(+ "Failed to call Zapier webhook at #{args["webhook_url"]} Status: #{result.status}: #{result.status_line}",+ )+ endendendenddiff --git a/plugins/automation/app/jobs/regular/discourse_automation/trigger.rb b/plugins/automation/app/jobs/regular/discourse_automation/trigger.rbindex 5542963054a..bf19e90312b 100644--- a/plugins/automation/app/jobs/regular/discourse_automation/trigger.rb+++ b/plugins/automation/app/jobs/regular/discourse_automation/trigger.rb@@ -1,32 +1,34 @@# frozen_string_literal: truemodule Jobs- class DiscourseAutomation::Trigger < ::Jobs::Base- RETRY_TIMES = [5.minute, 15.minute, 120.minute]+ module DiscourseAutomation+ class Trigger < ::Jobs::Base+ RETRY_TIMES = [5.minute, 15.minute, 120.minute]- sidekiq_options retry: RETRY_TIMES.size+ sidekiq_options retry: RETRY_TIMES.size- sidekiq_retry_in do |count, exception|- # returning nil/0 will trigger the default sidekiq- # retry formula- #- # See https://github.com/mperham/sidekiq/blob/3330df0ee37cfd3e0cd3ef01e3e66b584b99d488/lib/sidekiq/job_retry.rb#L216-L234- case exception.wrapped- when SocketError- return RETRY_TIMES[count]+ sidekiq_retry_in do |count, exception|+ # returning nil/0 will trigger the default sidekiq+ # retry formula+ #+ # See https://github.com/mperham/sidekiq/blob/3330df0ee37cfd3e0cd3ef01e3e66b584b99d488/lib/sidekiq/job_retry.rb#L216-L234+ case exception.wrapped+ when SocketError+ return RETRY_TIMES[count]+ endend- end- def execute(args)- automation =- ::DiscourseAutomation::Automation.find_by(id: args[:automation_id], enabled: true)+ def execute(args)+ automation =+ ::DiscourseAutomation::Automation.find_by(id: args[:automation_id], enabled: true)- return if !automation+ return if !automation- context = ::DiscourseAutomation::Automation.deserialize_context(args[:context])+ context = ::DiscourseAutomation::Automation.deserialize_context(args[:context])- automation.running_in_background!- automation.trigger!(context)+ automation.running_in_background!+ automation.trigger!(context)+ endendendenddiff --git a/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_topic_tracker.rb b/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_topic_tracker.rbindex 48237371f07..df3e2050d49 100644--- a/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_topic_tracker.rb+++ b/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_topic_tracker.rb@@ -1,41 +1,43 @@# frozen_string_literal: truemodule Jobs- class DiscourseAutomation::StalledTopicTracker < ::Jobs::Scheduled- every 1.hour+ module DiscourseAutomation+ class StalledTopicTracker < ::Jobs::Scheduled+ every 1.hour- def execute(_args = nil)- name = ::DiscourseAutomation::Triggers::STALLED_TOPIC+ def execute(_args = nil)+ name = ::DiscourseAutomation::Triggers::STALLED_TOPIC- ::DiscourseAutomation::Automation- .where(trigger: name, enabled: true)- .find_each do |automation|- fields = automation.serialized_fields- stalled_after = fields.dig("stalled_after", "value")- stalled_duration = ISO8601::Duration.new(stalled_after).to_seconds- stalled_date = stalled_duration.seconds.ago- categories = fields.dig("categories", "value")- tags = fields.dig("tags", "value")+ ::DiscourseAutomation::Automation+ .where(trigger: name, enabled: true)+ .find_each do |automation|+ fields = automation.serialized_fields+ stalled_after = fields.dig("stalled_after", "value")+ stalled_duration = ISO8601::Duration.new(stalled_after).to_seconds+ stalled_date = stalled_duration.seconds.ago+ categories = fields.dig("categories", "value")+ tags = fields.dig("tags", "value")- ::DiscourseAutomation::StalledTopicFinder- .call(stalled_date, categories: categories, tags: tags)- .each do |result|- topic = Topic.find_by(id: result.id)- next unless topic+ ::DiscourseAutomation::StalledTopicFinder+ .call(stalled_date, categories: categories, tags: tags)+ .each do |result|+ topic = Topic.find_by(id: result.id)+ next unless topic- run_trigger(automation, topic)- end- end- end+ run_trigger(automation, topic)+ end+ end+ end- def run_trigger(automation, topic)- automation.trigger!(- "kind" => ::DiscourseAutomation::Triggers::STALLED_TOPIC,- "topic" => topic,- "placeholders" => {- "topic_url" => topic.url,- },- )+ def run_trigger(automation, topic)+ automation.trigger!(+ "kind" => ::DiscourseAutomation::Triggers::STALLED_TOPIC,+ "topic" => topic,+ "placeholders" => {+ "topic_url" => topic.url,+ },+ )+ endendendenddiff --git a/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_wiki_tracker.rb b/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_wiki_tracker.rbindex dffdaefcb4d..46b9abd51c5 100644--- a/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_wiki_tracker.rb+++ b/plugins/automation/app/jobs/scheduled/discourse_automation/stalled_wiki_tracker.rb@@ -1,56 +1,59 @@# frozen_string_literal: truemodule Jobs- class DiscourseAutomation::StalledWikiTracker < ::Jobs::Scheduled- every 10.minutes-- def execute(_args = nil)- name = ::DiscourseAutomation::Triggers::STALLED_WIKI+ module DiscourseAutomation+ class StalledWikiTracker < ::Jobs::Scheduled+ every 10.minutes++ def execute(_args = nil)+ name = ::DiscourseAutomation::Triggers::STALLED_WIKI++ ::DiscourseAutomation::Automation+ .where(trigger: name, enabled: true)+ .find_each do |automation|+ stalled_after = automation.trigger_field("stalled_after")+ stalled_duration = ISO8601::Duration.new(stalled_after["value"]).to_seconds+ finder =+ Post.where("wiki = TRUE AND last_version_at <= ?", stalled_duration.seconds.ago)- ::DiscourseAutomation::Automation- .where(trigger: name, enabled: true)- .find_each do |automation|- stalled_after = automation.trigger_field("stalled_after")- stalled_duration = ISO8601::Duration.new(stalled_after["value"]).to_seconds- finder = Post.where("wiki = TRUE AND last_version_at <= ?", stalled_duration.seconds.ago)+ restricted_category = automation.trigger_field("restricted_category")+ if restricted_category["value"]+ finder =+ finder.joins(:topic).where("topics.category_id = ?", restricted_category["value"])+ end- restricted_category = automation.trigger_field("restricted_category")- if restricted_category["value"]- finder =- finder.joins(:topic).where("topics.category_id = ?", restricted_category["value"])- end+ finder.each do |post|+ last_trigger_date = post.custom_fields["stalled_wiki_triggered_at"]+ if last_trigger_date+ retriggered_after = automation.trigger_field("retriggered_after")+ retrigger_duration = ISO8601::Duration.new(retriggered_after["value"]).to_seconds- finder.each do |post|- last_trigger_date = post.custom_fields["stalled_wiki_triggered_at"]- if last_trigger_date- retriggered_after = automation.trigger_field("retriggered_after")- retrigger_duration = ISO8601::Duration.new(retriggered_after["value"]).to_seconds+ next if Time.parse(last_trigger_date) + retrigger_duration >= Time.zone.now+ end- next if Time.parse(last_trigger_date) + retrigger_duration >= Time.zone.now+ post.upsert_custom_fields(stalled_wiki_triggered_at: Time.zone.now)+ run_trigger(automation, post)end-- post.upsert_custom_fields(stalled_wiki_triggered_at: Time.zone.now)- run_trigger(automation, post)end- end- end-- def run_trigger(automation, post)- user_ids =- (- post.post_revisions.order("post_revisions.created_at DESC").limit(5).pluck(:user_id) +- [post.user_id]- ).compact.uniq-- automation.trigger!(- "kind" => ::DiscourseAutomation::Triggers::STALLED_WIKI,- "post" => post,- "topic" => post.topic,- "usernames" => User.where(id: user_ids).pluck(:username),- "placeholders" => {- "wiki_url" => Discourse.base_url + post.url,- },- )+ end++ def run_trigger(automation, post)+ user_ids =+ (+ post.post_revisions.order("post_revisions.created_at DESC").limit(5).pluck(:user_id) ++ [post.user_id]+ ).compact.uniq++ automation.trigger!(+ "kind" => ::DiscourseAutomation::Triggers::STALLED_WIKI,+ "post" => post,+ "topic" => post.topic,+ "usernames" => User.where(id: user_ids).pluck(:username),+ "placeholders" => {+ "wiki_url" => Discourse.base_url + post.url,+ },+ )+ endendendenddiff --git a/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb b/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rbindex c86a71e9d43..ae38059737c 100644--- a/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb+++ b/plugins/automation/app/jobs/scheduled/discourse_automation/tracker.rb@@ -1,65 +1,69 @@# frozen_string_literal: truemodule Jobs- class DiscourseAutomation::Tracker < ::Jobs::Scheduled- every 1.minute+ module DiscourseAutomation+ class Tracker < ::Jobs::Scheduled+ every 1.minute- BATCH_LIMIT = 300+ BATCH_LIMIT = 300- def execute(_args = nil)- return unless SiteSetting.discourse_automation_enabled+ def execute(_args = nil)+ return unless SiteSetting.discourse_automation_enabled- ::DiscourseAutomation::PendingAutomation- .includes(:automation)- .limit(BATCH_LIMIT)- .where("execute_at < ?", Time.now)- .find_each do |pending_automation|- run_pending_automation(pending_automation)- rescue => e- Rails.logger.error("Error running automation #{pending_automation.automation.name}: #{e}")- end+ ::DiscourseAutomation::PendingAutomation+ .includes(:automation)+ .limit(BATCH_LIMIT)+ .where("execute_at < ?", Time.now)+ .find_each do |pending_automation|+ run_pending_automation(pending_automation)+ rescue => e+ Rails.logger.error(+ "Error running automation #{pending_automation.automation.name}: #{e}",+ )+ end- ::DiscourseAutomation::PendingPm- .includes(:automation)- .limit(BATCH_LIMIT)- .where("execute_at < ?", Time.now)- .find_each do |pending_pm|- send_pending_pm(pending_pm)- rescue => e- Rails.logger.error("Error sending PM for #{pending_pm.automation.name}: #{e}")- end- end+ ::DiscourseAutomation::PendingPm+ .includes(:automation)+ .limit(BATCH_LIMIT)+ .where("execute_at < ?", Time.now)+ .find_each do |pending_pm|+ send_pending_pm(pending_pm)+ rescue => e+ Rails.logger.error("Error sending PM for #{pending_pm.automation.name}: #{e}")+ end+ end- def send_pending_pm(pending_pm)- DistributedMutex.synchronize(- "automation_send_pending_pm_#{pending_pm.id}",- validity: 30.minutes,- ) do- next if !::DiscourseAutomation::PendingPm.exists?(pending_pm.id)+ def send_pending_pm(pending_pm)+ DistributedMutex.synchronize(+ "automation_send_pending_pm_#{pending_pm.id}",+ validity: 30.minutes,+ ) do+ next if !::DiscourseAutomation::PendingPm.exists?(pending_pm.id)- ::DiscourseAutomation::Scriptable::Utils.send_pm(- pending_pm.attributes.slice("target_usernames", "title", "raw"),- sender: pending_pm.sender,- prefers_encrypt: pending_pm.prefers_encrypt,- )+ ::DiscourseAutomation::Scriptable::Utils.send_pm(+ pending_pm.attributes.slice("target_usernames", "title", "raw"),+ sender: pending_pm.sender,+ prefers_encrypt: pending_pm.prefers_encrypt,+ )- pending_pm.destroy!+ pending_pm.destroy!+ endend- end- def run_pending_automation(pending_automation)- DistributedMutex.synchronize(- "process_pending_automation_#{pending_automation.id}",- validity: 30.minutes,- ) do- next if !::DiscourseAutomation::PendingAutomation.exists?(pending_automation.id)+ def run_pending_automation(pending_automation)+ DistributedMutex.synchronize(+ "process_pending_automation_#{pending_automation.id}",+ validity: 30.minutes,+ ) do+ next if !::DiscourseAutomation::PendingAutomation.exists?(pending_automation.id)- pending_automation.automation.trigger!(- "kind" => pending_automation.automation.trigger,- "execute_at" => pending_automation.execute_at,- )+ pending_automation.automation.trigger!(+ "kind" => pending_automation.automation.trigger,+ "execute_at" => pending_automation.execute_at,+ )- pending_automation.destroy!+ pending_automation.destroy!+ endendendenddiff --git a/plugins/automation/lib/discourse_automation/engine.rb b/plugins/automation/lib/discourse_automation/engine.rbindex 640a4fb3634..40b614ab2a6 100644--- a/plugins/automation/lib/discourse_automation/engine.rb+++ b/plugins/automation/lib/discourse_automation/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAutomation+module DiscourseAutomationclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseAutomationdiff --git a/plugins/chat/app/controllers/chat/admin/export_controller.rb b/plugins/chat/app/controllers/chat/admin/export_controller.rbindex 7872e46f61b..ea9bd56d053 100644--- a/plugins/chat/app/controllers/chat/admin/export_controller.rb+++ b/plugins/chat/app/controllers/chat/admin/export_controller.rb@@ -3,7 +3,7 @@module Chatmodule Adminclass ExportController < ::Admin::AdminController- requires_plugin Chat::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef export_messagesentity = "chat_message"diff --git a/plugins/chat/app/controllers/chat/admin/incoming_webhooks_controller.rb b/plugins/chat/app/controllers/chat/admin/incoming_webhooks_controller.rbindex bbfcc41ff67..1eb61a18c25 100644--- a/plugins/chat/app/controllers/chat/admin/incoming_webhooks_controller.rb+++ b/plugins/chat/app/controllers/chat/admin/incoming_webhooks_controller.rb@@ -3,7 +3,7 @@module Chatmodule Adminclass IncomingWebhooksController < ::Admin::AdminController- requires_plugin Chat::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexrender_serialized(diff --git a/plugins/chat/app/controllers/chat/base_controller.rb b/plugins/chat/app/controllers/chat/base_controller.rbindex 865511caba1..8ea85a50e07 100644--- a/plugins/chat/app/controllers/chat/base_controller.rb+++ b/plugins/chat/app/controllers/chat/base_controller.rb@@ -2,7 +2,7 @@module Chatclass BaseController < ::ApplicationController- requires_plugin Chat::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_logged_inbefore_action :ensure_can_chatdiff --git a/plugins/chat/app/controllers/chat/incoming_webhooks_controller.rb b/plugins/chat/app/controllers/chat/incoming_webhooks_controller.rbindex 9c58de23a04..105525ad6af 100644--- a/plugins/chat/app/controllers/chat/incoming_webhooks_controller.rb+++ b/plugins/chat/app/controllers/chat/incoming_webhooks_controller.rb@@ -2,7 +2,7 @@module Chatclass IncomingWebhooksController < ::ApplicationController- requires_plugin Chat::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEWEBHOOK_MESSAGES_PER_MINUTE_LIMIT = 10diff --git a/plugins/chat/lib/chat/engine.rb b/plugins/chat/lib/chat/engine.rbindex 0bf36a36d2c..d541a4daac3 100644--- a/plugins/chat/lib/chat/engine.rb+++ b/plugins/chat/lib/chat/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Chat+module ChatHAS_CHAT_ENABLED = "has_chat_enabled"LAST_CHAT_CHANNEL_ID = "last_chat_channel_id"diff --git a/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ad_settings_controller.rb b/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ad_settings_controller.rbindex ca7920a159d..131021dce7b 100644--- a/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ad_settings_controller.rb+++ b/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ad_settings_controller.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginclass HouseAdSettingsController < ::ApplicationController- requires_plugin AdPlugin::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef updateHouseAdSetting.update(params[:id], params[:value])diff --git a/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ads_controller.rb b/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ads_controller.rbindex e7ab4dd8ee7..87964b42084 100644--- a/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ads_controller.rb+++ b/plugins/discourse-adplugin/app/controllers/ad_plugin/house_ads_controller.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginclass HouseAdsController < ::ApplicationController- requires_plugin AdPlugin::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexrender_json_dump(diff --git a/plugins/discourse-adplugin/app/models/ad_plugin/house_ad.rb b/plugins/discourse-adplugin/app/models/ad_plugin/house_ad.rbindex bfcbb820b5c..a1b5cb48317 100644--- a/plugins/discourse-adplugin/app/models/ad_plugin/house_ad.rb+++ b/plugins/discourse-adplugin/app/models/ad_plugin/house_ad.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginclass HouseAdinclude ActiveModel::Validationsdiff --git a/plugins/discourse-adplugin/app/models/ad_plugin/house_ad_setting.rb b/plugins/discourse-adplugin/app/models/ad_plugin/house_ad_setting.rbindex 9b50921c0e7..5de9ec4bafe 100644--- a/plugins/discourse-adplugin/app/models/ad_plugin/house_ad_setting.rb+++ b/plugins/discourse-adplugin/app/models/ad_plugin/house_ad_setting.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginclass HouseAdSettingDEFAULTS = {topic_list_top: "",diff --git a/plugins/discourse-adplugin/lib/adplugin/engine.rb b/plugins/discourse-adplugin/lib/adplugin/engine.rbindex d3387ffb5f6..3fb50adae0c 100644--- a/plugins/discourse-adplugin/lib/adplugin/engine.rb+++ b/plugins/discourse-adplugin/lib/adplugin/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace AdPlugindiff --git a/plugins/discourse-adplugin/lib/adplugin/guardian_extensions.rb b/plugins/discourse-adplugin/lib/adplugin/guardian_extensions.rbindex 427c46c9f57..53120bb7a1a 100644--- a/plugins/discourse-adplugin/lib/adplugin/guardian_extensions.rb+++ b/plugins/discourse-adplugin/lib/adplugin/guardian_extensions.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::AdPlugin+module AdPluginmodule GuardianExtensionsdef show_dfp_ads?!self.user.in_any_groups?(SiteSetting.dfp_exclude_groups_map)diff --git a/plugins/discourse-adplugin/plugin.rb b/plugins/discourse-adplugin/plugin.rbindex a2bb2334885..d9a11d7c993 100755--- a/plugins/discourse-adplugin/plugin.rb+++ b/plugins/discourse-adplugin/plugin.rb@@ -27,11 +27,11 @@ after_initialize dorequire_relative "app/models/ad_plugin/house_ad"require_relative "lib/adplugin/guardian_extensions"- reloadable_patch { Guardian.prepend ::AdPlugin::GuardianExtensions }+ reloadable_patch { Guardian.prepend AdPlugin::GuardianExtensions }Discourse::Application.routes.append doget "/ads.txt" => "adstxt#index"- mount ::AdPlugin::Engine, at: "/admin/plugins/pluginad", constraints: AdminConstraint.new+ mount AdPlugin::Engine, at: "/admin/plugins/pluginad", constraints: AdminConstraint.newendadd_to_serializer :site, :house_creatives dodiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_artifacts_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_artifacts_controller.rbindex 8ac7ef2e539..bd018cb9265 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_artifacts_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_artifacts_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiArtifactsController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEPER_PAGE_MAX = 100diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_embeddings_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_embeddings_controller.rbindex ceea81affdd..2eb51c82d5c 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_embeddings_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_embeddings_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiEmbeddingsController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexembedding_defs = EmbeddingDefinition.all.order(:display_name)diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rbindex d66e5b8b25a..320018a8154 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_features_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiFeaturesController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexrender json: serialize_modules(DiscourseAi::Configuration::Module.all)diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llm_quotas_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llm_quotas_controller.rbindex b5e89c8cc8a..9c15b0d9164 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llm_quotas_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llm_quotas_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiLlmQuotasController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexquotas = LlmQuota.includes(:group)diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rbindex 51ee5957c15..a5153cd531a 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_llms_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiLlmsController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexllms = LlmModel.all.includes(:llm_quotas).order(:display_name)diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rbindex 56c96d56dcf..99345414a70 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_personas_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiPersonasController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :find_ai_persona, only: %i[edit update destroy create_user export]diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rbindex e14ee0116cf..47d7c55e4a1 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/ai_tools_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass AiToolsController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :find_ai_tool, only: %i[test edit update destroy export]diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/dashboard_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/dashboard_controller.rbindex 9fed8f0869b..25a64a93a0a 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/dashboard_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/dashboard_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass DashboardController < ::Admin::StaffController- requires_plugin DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef sentimentenddiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rbindex d6ee53b4b46..014a3ee4aef 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/admin/rag_document_fragments_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Adminclass RagDocumentFragmentsController < ::Admin::AdminController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexing_status_checkif params[:target_type] == "AiPersona"diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifact_key_values_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifact_key_values_controller.rbindex 83b003f7d0d..7b7c8478f19 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifact_key_values_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifact_key_values_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiBotclass ArtifactKeyValuesController < ::ApplicationController- requires_plugin DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_logged_in, only: %i[set destroy]before_action :find_artifactdiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifacts_controller.rbindex 9ce89cef952..41e26703d9b 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/artifacts_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiBotclass ArtifactsController < ApplicationController- requires_plugin DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :require_site_settings!skip_before_action :preload_json, :check_xhr, only: %i[show]diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rbindex 5ea13795e79..c3a8e137487 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/bot_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiBotclass BotController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_logindef show_debug_info_by_iddiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/conversations_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/conversations_controller.rbindex 83863baf004..cc7af5c2640 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/conversations_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/conversations_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiBotclass ConversationsController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_logindef indexdiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rbindex 3d86b2d47c5..b56305b0edf 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_bot/shared_ai_conversations_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiBotclass SharedAiConversationsController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_login only: %i[create update destroy]before_action :require_site_settings!diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rbindex b626172122c..92117f81488 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/ai_helper/assistant_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule AiHelperclass AssistantController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_loginbefore_action :ensure_can_request_suggestionsbefore_action :rate_limiter_performed!diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/discord/bot_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/discord/bot_controller.rbindex d553aa275e5..bfb749cb3fd 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/discord/bot_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/discord/bot_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Discordclass BotController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEskip_before_action :verify_authenticity_tokendiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rbindex a064930c192..cb5cd242938 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/discover/discoveries_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Discoverclass DiscoveriesController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_logindef replydiff --git a/plugins/discourse-ai/app/controllers/discourse_ai/embeddings/embeddings_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/embeddings/embeddings_controller.rbindex 10273f2ade8..d3f7cfd25cc 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/embeddings/embeddings_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/embeddings/embeddings_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Embeddingsclass EmbeddingsController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMESEMANTIC_SEARCH_TYPE = "semantic_search"diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/sentiment/sentiment_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/sentiment/sentiment_controller.rbindex 5dd289932e8..45aa2824645 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/sentiment/sentiment_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/sentiment/sentiment_controller.rb@@ -4,7 +4,7 @@ module DiscourseAimodule Sentimentclass SentimentController < ::Admin::StaffControllerinclude Constants- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEDEFAULT_POSTS_LIMIT = 50MAX_POSTS_LIMIT = 100@@ -46,7 +46,7 @@ module DiscourseAiu.name,u.uploaded_avatar_id,c.id AS category_id,- (CASE+ (CASEWHEN (cr.classification::jsonb->'positive')::float > :threshold THEN 'positive'WHEN (cr.classification::jsonb->'negative')::float > :threshold THEN 'negative'ELSE 'neutral'diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/summarization/chat_summary_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/summarization/chat_summary_controller.rbindex c66b1f2c7e5..264c2007d3d 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/summarization/chat_summary_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/summarization/chat_summary_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Summarizationclass ChatSummaryController < ::Chat::ApiController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin DiscourseAi::PLUGIN_NAMErequires_plugin ::Chat::PLUGIN_NAMEVALID_SINCE_VALUES = [1, 3, 6, 12, 24, 72, 168]diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/summarization/summary_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/summarization/summary_controller.rbindex de8eb3f3fca..4381d526c4c 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/summarization/summary_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/summarization/summary_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Summarizationclass SummaryController < ::ApplicationController- requires_plugin ::DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef showtopic = Topic.find(params[:topic_id])diff --git a/plugins/discourse-ai/app/controllers/discourse_ai/translation/translation_controller.rb b/plugins/discourse-ai/app/controllers/discourse_ai/translation/translation_controller.rbindex 83032996937..3a1f8a96d5f 100644--- a/plugins/discourse-ai/app/controllers/discourse_ai/translation/translation_controller.rb+++ b/plugins/discourse-ai/app/controllers/discourse_ai/translation/translation_controller.rb@@ -3,7 +3,7 @@module DiscourseAimodule Translationclass TranslationController < ::ApplicationController- requires_plugin DiscourseAi::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_logged_inbefore_action :check_permissionsdiff --git a/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb b/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rbindex 61f824b64b6..05c2d84f747 100644--- a/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb+++ b/plugins/discourse-ai/app/jobs/regular/create_ai_chat_reply.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass CreateAiChatReply < ::Jobs::Basesidekiq_options retry: falsediff --git a/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb b/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rbindex 14653a6150e..8d32796183a 100644--- a/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb+++ b/plugins/discourse-ai/app/jobs/regular/create_ai_reply.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass CreateAiReply < ::Jobs::Basesidekiq_options retry: falsediff --git a/plugins/discourse-ai/app/jobs/regular/digest_rag_upload.rb b/plugins/discourse-ai/app/jobs/regular/digest_rag_upload.rbindex 4ac45971274..f1a1db8c38f 100644--- a/plugins/discourse-ai/app/jobs/regular/digest_rag_upload.rb+++ b/plugins/discourse-ai/app/jobs/regular/digest_rag_upload.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass DigestRagUpload < ::Jobs::BaseCHUNK_SIZE = 1024CHUNK_OVERLAP = 64diff --git a/plugins/discourse-ai/app/jobs/regular/fast_track_topic_gist.rb b/plugins/discourse-ai/app/jobs/regular/fast_track_topic_gist.rbindex 30f586da764..08f86cf191b 100644--- a/plugins/discourse-ai/app/jobs/regular/fast_track_topic_gist.rb+++ b/plugins/discourse-ai/app/jobs/regular/fast_track_topic_gist.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass FastTrackTopicGist < ::Jobs::Basesidekiq_options retry: falsediff --git a/plugins/discourse-ai/app/jobs/regular/generate_rag_embeddings.rb b/plugins/discourse-ai/app/jobs/regular/generate_rag_embeddings.rbindex 775b849f649..f388c8379d8 100644--- a/plugins/discourse-ai/app/jobs/regular/generate_rag_embeddings.rb+++ b/plugins/discourse-ai/app/jobs/regular/generate_rag_embeddings.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass GenerateRagEmbeddings < ::Jobs::Basesidekiq_options queue: "ultra_low"# we could also restrict concurrency but this takes so long if it is not concurrentdiff --git a/plugins/discourse-ai/app/jobs/regular/manage_embedding_def_search_index.rb b/plugins/discourse-ai/app/jobs/regular/manage_embedding_def_search_index.rbindex 5baa526c45c..578761a2964 100644--- a/plugins/discourse-ai/app/jobs/regular/manage_embedding_def_search_index.rb+++ b/plugins/discourse-ai/app/jobs/regular/manage_embedding_def_search_index.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass ManageEmbeddingDefSearchIndex < ::Jobs::Basedef execute(args)embedding_def = EmbeddingDefinition.find_by(id: args[:id])diff --git a/plugins/discourse-ai/app/jobs/regular/post_sentiment_analysis.rb b/plugins/discourse-ai/app/jobs/regular/post_sentiment_analysis.rbindex 59b96a1bc5b..768a1d37c47 100644--- a/plugins/discourse-ai/app/jobs/regular/post_sentiment_analysis.rb+++ b/plugins/discourse-ai/app/jobs/regular/post_sentiment_analysis.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass PostSentimentAnalysis < ::Jobs::Basesidekiq_options queue: "low"diff --git a/plugins/discourse-ai/app/jobs/regular/shared_conversation_adjust_upload_security.rb b/plugins/discourse-ai/app/jobs/regular/shared_conversation_adjust_upload_security.rbindex 350ca0e70de..7510ca6ccd0 100644--- a/plugins/discourse-ai/app/jobs/regular/shared_conversation_adjust_upload_security.rb+++ b/plugins/discourse-ai/app/jobs/regular/shared_conversation_adjust_upload_security.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass SharedConversationAdjustUploadSecurity < ::Jobs::Basedef execute(args)if args[:conversation_id].present?diff --git a/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb b/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rbindex d5a241e43ce..a1ed877cbbc 100644--- a/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb+++ b/plugins/discourse-ai/app/jobs/scheduled/summaries_backfill.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass SummariesBackfill < ::Jobs::Scheduledevery 5.minutescluster_concurrency 1diff --git a/plugins/discourse-ai/app/models/ai_persona.rb b/plugins/discourse-ai/app/models/ai_persona.rbindex 694cde78027..f626d4d628a 100644--- a/plugins/discourse-ai/app/models/ai_persona.rb+++ b/plugins/discourse-ai/app/models/ai_persona.rb@@ -41,7 +41,7 @@ class AiPersona < ActiveRecord::Basebefore_update :regenerate_rag_fragmentsdef self.persona_cache- @persona_cache ||= ::DiscourseAi::MultisiteHash.new("persona_cache")+ @persona_cache ||= DiscourseAi::MultisiteHash.new("persona_cache")endscope :ordered, -> { order("priority DESC, lower(name) ASC") }diff --git a/plugins/discourse-ai/config/routes.rb b/plugins/discourse-ai/config/routes.rbindex c295c940c2d..62cb9c43fa8 100644--- a/plugins/discourse-ai/config/routes.rb+++ b/plugins/discourse-ai/config/routes.rb@@ -71,7 +71,7 @@ DiscourseAi::Engine.routes.draw doendDiscourse::Application.routes.draw do- mount ::DiscourseAi::Engine, at: "discourse-ai"+ mount DiscourseAi::Engine, at: "discourse-ai"get "admin/dashboard/sentiment" => "discourse_ai/admin/dashboard#sentiment",:constraints => StaffConstraint.newdiff --git a/plugins/discourse-ai/lib/ai_bot/entry_point.rb b/plugins/discourse-ai/lib/ai_bot/entry_point.rbindex 2f4058f4e95..5bb16aaf5df 100644--- a/plugins/discourse-ai/lib/ai_bot/entry_point.rb+++ b/plugins/discourse-ai/lib/ai_bot/entry_point.rb@@ -190,7 +190,7 @@ module DiscourseAiscope.user.in_any_groups?(SiteSetting.ai_bot_allowed_groups_map)end,) do- bots_map = ::DiscourseAi::AiBot::EntryPoint.enabled_user_ids_and_models_map+ bots_map = DiscourseAi::AiBot::EntryPoint.enabled_user_ids_and_models_mappersona_users = AiPersona.persona_users(user: scope.user)if persona_users.present?diff --git a/plugins/discourse-ai/lib/ai_helper/assistant.rb b/plugins/discourse-ai/lib/ai_helper/assistant.rbindex 3926f2a792e..5dfe3c488ca 100644--- a/plugins/discourse-ai/lib/ai_helper/assistant.rb+++ b/plugins/discourse-ai/lib/ai_helper/assistant.rb@@ -16,7 +16,7 @@ module DiscourseAiIMAGE_CAPTION = "image_caption"def self.prompt_cache- @prompt_cache ||= ::DiscourseAi::MultisiteHash.new("prompt_cache")+ @prompt_cache ||= DiscourseAi::MultisiteHash.new("prompt_cache")enddef self.clear_prompt_cache!diff --git a/plugins/discourse-ai/lib/ai_moderation/entry_point.rb b/plugins/discourse-ai/lib/ai_moderation/entry_point.rbindex fb42fee4fc1..71a678606ae 100644--- a/plugins/discourse-ai/lib/ai_moderation/entry_point.rb+++ b/plugins/discourse-ai/lib/ai_moderation/entry_point.rb@@ -4,19 +4,19 @@ module DiscourseAimodule AiModerationclass EntryPointdef inject_into(plugin)- plugin.on(:post_created) { |post| ::DiscourseAi::AiModeration::SpamScanner.new_post(post) }+ plugin.on(:post_created) { |post| DiscourseAi::AiModeration::SpamScanner.new_post(post) }plugin.on(:post_edited) do |post, _, revisor|if revisor.reviewable_content_changed?- ::DiscourseAi::AiModeration::SpamScanner.edited_post(post)+ DiscourseAi::AiModeration::SpamScanner.edited_post(post)endendplugin.on(:post_process_cooked) do |_doc, post|- ::DiscourseAi::AiModeration::SpamScanner.after_cooked_post(post)+ DiscourseAi::AiModeration::SpamScanner.after_cooked_post(post)endplugin.on(:site_setting_changed) do |name, _old_value, new_value|if name == :ai_spam_detection_enabled && new_value- ::DiscourseAi::AiModeration::SpamScanner.ensure_flagging_user!+ DiscourseAi::AiModeration::SpamScanner.ensure_flagging_user!endenddiff --git a/plugins/discourse-ai/lib/automation/report_context_generator.rb b/plugins/discourse-ai/lib/automation/report_context_generator.rbindex e54bf235e40..fb6c8ce5cd4 100644--- a/plugins/discourse-ai/lib/automation/report_context_generator.rb+++ b/plugins/discourse-ai/lib/automation/report_context_generator.rb@@ -65,7 +65,7 @@ module DiscourseAi@posts = @posts.where(topic_id: topic_ids_with_tags)end- if defined?(::DiscourseSolved)+ if defined?(DiscourseSolved)@solutions =DiscourseSolved::SolvedTopic.where(topic_id: @posts.select(:topic_id))diff --git a/plugins/discourse-ai/lib/configuration/feature.rb b/plugins/discourse-ai/lib/configuration/feature.rbindex 65f5d1dfe63..0d443e9f73b 100644--- a/plugins/discourse-ai/lib/configuration/feature.rb+++ b/plugins/discourse-ai/lib/configuration/feature.rb@@ -5,7 +5,7 @@ module DiscourseAiclass Featureclass << selfdef feature_cache- @feature_cache ||= ::DiscourseAi::MultisiteHash.new("feature_cache")+ @feature_cache ||= DiscourseAi::MultisiteHash.new("feature_cache")enddef summarization_featuresdiff --git a/plugins/discourse-ai/lib/database/connection.rb b/plugins/discourse-ai/lib/database/connection.rbindex f591e188c4a..93f9811eda4 100644--- a/plugins/discourse-ai/lib/database/connection.rb+++ b/plugins/discourse-ai/lib/database/connection.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Databaseclass Connectiondef self.dbdiff --git a/plugins/discourse-ai/lib/embeddings/entry_point.rb b/plugins/discourse-ai/lib/embeddings/entry_point.rbindex b1cf70857cb..c93b78929fe 100644--- a/plugins/discourse-ai/lib/embeddings/entry_point.rb+++ b/plugins/discourse-ai/lib/embeddings/entry_point.rb@@ -20,7 +20,7 @@ module DiscourseAiend@related_topics ||=- ::DiscourseAi::Embeddings::SemanticTopicQuery.new(@user).list_semantic_related_topics(+ DiscourseAi::Embeddings::SemanticTopicQuery.new(@user).list_semantic_related_topics(topic,)end@@ -47,7 +47,7 @@ module DiscourseAiendplugin.register_html_builder("server:topic-show-after-posts-crawler") do |controller|- ::DiscourseAi::Embeddings::SemanticRelated.related_topics_for_crawler(controller)+ DiscourseAi::Embeddings::SemanticRelated.related_topics_for_crawler(controller)end# embeddings generation.diff --git a/plugins/discourse-ai/lib/embeddings/semantic_related.rb b/plugins/discourse-ai/lib/embeddings/semantic_related.rbindex efc35cd08ed..869e4b5bfe0 100644--- a/plugins/discourse-ai/lib/embeddings/semantic_related.rb+++ b/plugins/discourse-ai/lib/embeddings/semantic_related.rb@@ -30,12 +30,12 @@ module DiscourseAi# Happens when the topic doesn't have any embeddings# I'd rather not use Exceptions to control the flow, so this should be refactored soonif candidate_ids.empty? || !candidate_ids.include?(topic.id)- raise ::DiscourseAi::Embeddings::Schema::MissingEmbeddingError,+ raise DiscourseAi::Embeddings::Schema::MissingEmbeddingError,"No embeddings found for topic #{topic.id}"endendend- rescue ::DiscourseAi::Embeddings::Schema::MissingEmbeddingError+ rescue DiscourseAi::Embeddings::Schema::MissingEmbeddingError# avoid a flood of jobs when visiting topicif Discourse.redis.set(build_semantic_suggested_key(topic.id),diff --git a/plugins/discourse-ai/lib/engine.rb b/plugins/discourse-ai/lib/engine.rbindex 6c43e22e222..a694a91e704 100644--- a/plugins/discourse-ai/lib/engine.rb+++ b/plugins/discourse-ai/lib/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAiclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseAidiff --git a/plugins/discourse-ai/lib/inference/cloudflare_workers_ai.rb b/plugins/discourse-ai/lib/inference/cloudflare_workers_ai.rbindex adb9eb78dd4..5177aa23241 100644--- a/plugins/discourse-ai/lib/inference/cloudflare_workers_ai.rb+++ b/plugins/discourse-ai/lib/inference/cloudflare_workers_ai.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass CloudflareWorkersAidef initialize(endpoint, api_token, referer = Discourse.base_url)diff --git a/plugins/discourse-ai/lib/inference/discourse_reranker.rb b/plugins/discourse-ai/lib/inference/discourse_reranker.rbindex 35b09799514..11efd491895 100644--- a/plugins/discourse-ai/lib/inference/discourse_reranker.rb+++ b/plugins/discourse-ai/lib/inference/discourse_reranker.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass DiscourseRerankerdef self.perform!(endpoint, model, content, candidates, api_key)diff --git a/plugins/discourse-ai/lib/inference/gemini_embeddings.rb b/plugins/discourse-ai/lib/inference/gemini_embeddings.rbindex 24d4b35a785..a275dbdaa11 100644--- a/plugins/discourse-ai/lib/inference/gemini_embeddings.rb+++ b/plugins/discourse-ai/lib/inference/gemini_embeddings.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass GeminiEmbeddingsdef initialize(embedding_url, api_key, dimensions = nil, referer = Discourse.base_url)diff --git a/plugins/discourse-ai/lib/inference/hugging_face_text_embeddings.rb b/plugins/discourse-ai/lib/inference/hugging_face_text_embeddings.rbindex 67a964f88f7..66690ae7b86 100644--- a/plugins/discourse-ai/lib/inference/hugging_face_text_embeddings.rb+++ b/plugins/discourse-ai/lib/inference/hugging_face_text_embeddings.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass HuggingFaceTextEmbeddingsdef initialize(endpoint, key, referer = Discourse.base_url)diff --git a/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb b/plugins/discourse-ai/lib/inference/open_ai_embeddings.rbindex ec1845d9cf0..8a0e4bb642c 100644--- a/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb+++ b/plugins/discourse-ai/lib/inference/open_ai_embeddings.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass OpenAiEmbeddingsdef initialize(endpoint, api_key, model, dimensions)diff --git a/plugins/discourse-ai/lib/inference/open_ai_image_generator.rb b/plugins/discourse-ai/lib/inference/open_ai_image_generator.rbindex 83501989ae9..e6b725b62c6 100644--- a/plugins/discourse-ai/lib/inference/open_ai_image_generator.rb+++ b/plugins/discourse-ai/lib/inference/open_ai_image_generator.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass OpenAiImageGeneratorTIMEOUT = 60diff --git a/plugins/discourse-ai/lib/inference/stability_generator.rb b/plugins/discourse-ai/lib/inference/stability_generator.rbindex 124f5d8acee..acf7ef01636 100644--- a/plugins/discourse-ai/lib/inference/stability_generator.rb+++ b/plugins/discourse-ai/lib/inference/stability_generator.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAi+module DiscourseAimodule Inferenceclass StabilityGeneratorTIMEOUT = 120diff --git a/plugins/discourse-ai/lib/personas/persona.rb b/plugins/discourse-ai/lib/personas/persona.rbindex 47ce08e7b71..fa71ecace2a 100644--- a/plugins/discourse-ai/lib/personas/persona.rb+++ b/plugins/discourse-ai/lib/personas/persona.rb@@ -285,7 +285,7 @@ module DiscourseAireturn replaced if !context.format_dates- ::DiscourseAi::AiHelper::DateFormatter.process_date_placeholders(replaced, context.user)+ DiscourseAi::AiHelper::DateFormatter.process_date_placeholders(replaced, context.user)enddef tool_instance(tool_call, bot_user:, llm:, context:, existing_tools:)diff --git a/plugins/discourse-ai/lib/tasks/modules/toxicity/calibration.rake b/plugins/discourse-ai/lib/tasks/modules/toxicity/calibration.rakeindex 30ed632e52a..aa866f99231 100644--- a/plugins/discourse-ai/lib/tasks/modules/toxicity/calibration.rake+++ b/plugins/discourse-ai/lib/tasks/modules/toxicity/calibration.rake@@ -1,7 +1,7 @@# frozen_string_literal: truedef classify(content)- ::DiscourseAi::Inference::DiscourseClassifier.perform!(+ DiscourseAi::Inference::DiscourseClassifier.perform!("#{SiteSetting.ai_toxicity_inference_service_api_endpoint}/api/v1/classify",SiteSetting.ai_toxicity_inference_service_api_model,content,diff --git a/plugins/discourse-ai/plugin.rb b/plugins/discourse-ai/plugin.rbindex e56a9e0332b..8da569c363b 100644--- a/plugins/discourse-ai/plugin.rb+++ b/plugins/discourse-ai/plugin.rb@@ -61,12 +61,12 @@ module ::DiscourseAiendend-Rails.autoloaders.main.push_dir(File.join(__dir__, "lib"), namespace: ::DiscourseAi)+Rails.autoloaders.main.push_dir(File.join(__dir__, "lib"), namespace: DiscourseAi)require_relative "lib/engine"require_relative "lib/configuration/module"-::DiscourseAi::Configuration::Module::NAMES.each do |module_name|+DiscourseAi::Configuration::Module::NAMES.each do |module_name|register_site_setting_area("ai-features/#{module_name}")enddiff --git a/plugins/discourse-ai/spec/jobs/regular/detect_translate_post_spec.rb b/plugins/discourse-ai/spec/jobs/regular/detect_translate_post_spec.rbindex 6d4dc8cfc80..3ea8b0c41ca 100644--- a/plugins/discourse-ai/spec/jobs/regular/detect_translate_post_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/detect_translate_post_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::DetectTranslatePost do- fab!(:post)subject(:job) { described_class.new }+ fab!(:post)+let(:locales) { %w[en ja] }before dodiff --git a/plugins/discourse-ai/spec/jobs/regular/detect_translate_topic_spec.rb b/plugins/discourse-ai/spec/jobs/regular/detect_translate_topic_spec.rbindex 32d952a1525..4a8bca9d368 100644--- a/plugins/discourse-ai/spec/jobs/regular/detect_translate_topic_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/detect_translate_topic_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::DetectTranslateTopic do- fab!(:topic)subject(:job) { described_class.new }+ fab!(:topic)+let(:locales) { %w[en ja] }before dodiff --git a/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb b/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rbindex f2815e27b25..1670369ab62 100644--- a/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/localize_posts_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::LocalizePosts do- fab!(:post)subject(:job) { described_class.new }+ fab!(:post)+let(:locales) { %w[en ja de] }before dodiff --git a/plugins/discourse-ai/spec/jobs/regular/localize_topics_spec.rb b/plugins/discourse-ai/spec/jobs/regular/localize_topics_spec.rbindex 1f2fe0d35bf..394854b2d7a 100644--- a/plugins/discourse-ai/spec/jobs/regular/localize_topics_spec.rb+++ b/plugins/discourse-ai/spec/jobs/regular/localize_topics_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::LocalizeTopics do- fab!(:topic)subject(:job) { described_class.new }+ fab!(:topic)+let(:locales) { %w[en ja de] }before dodiff --git a/plugins/discourse-ai/spec/jobs/scheduled/categories_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/categories_locale_detection_backfill_spec.rbindex 3870c4a5750..313a94a4ad6 100644--- a/plugins/discourse-ai/spec/jobs/scheduled/categories_locale_detection_backfill_spec.rb+++ b/plugins/discourse-ai/spec/jobs/scheduled/categories_locale_detection_backfill_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::CategoriesLocaleDetectionBackfill do- fab!(:category) { Fabricate(:category, locale: nil) }subject(:job) { described_class.new }+ fab!(:category) { Fabricate(:category, locale: nil) }+before doassign_fake_provider_to(:ai_default_llm_model)enable_current_plugindiff --git a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rbindex d5cf6a23f3f..d74ae6cd5f4 100644--- a/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb+++ b/plugins/discourse-ai/spec/jobs/scheduled/posts_locale_detection_backfill_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::PostsLocaleDetectionBackfill do- fab!(:post) { Fabricate(:post, locale: nil) }subject(:job) { described_class.new }+ fab!(:post) { Fabricate(:post, locale: nil) }+before doassign_fake_provider_to(:ai_default_llm_model)enable_current_plugindiff --git a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rbindex 4235689fa1a..518c00d96ae 100644--- a/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb+++ b/plugins/discourse-ai/spec/jobs/scheduled/topics_locale_detection_backfill_spec.rb@@ -1,9 +1,10 @@# frozen_string_literal: truedescribe Jobs::TopicsLocaleDetectionBackfill do- fab!(:topic) { Fabricate(:topic, locale: nil) }subject(:job) { described_class.new }+ fab!(:topic) { Fabricate(:topic, locale: nil) }+before doassign_fake_provider_to(:ai_default_llm_model)enable_current_plugindiff --git a/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb b/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rbindex f7fb968965f..c4b246ea74c 100644--- a/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb+++ b/plugins/discourse-ai/spec/lib/completions/dialects/dialect_spec.rb@@ -77,7 +77,7 @@ RSpec.describe DiscourseAi::Completions::Dialects::Dialect doid: "123",name: "echo",content:- "<function_results>\n<result>\n<tool_name>echo</tool_name>\n<json>\n\"test message\"\n</json>\n</result>\n</function_results>\n\n#{::DiscourseAi::Completions::Dialects::XmlTools::DONE_MESSAGE}",+ "<function_results>\n<result>\n<tool_name>echo</tool_name>\n<json>\n\"test message\"\n</json>\n</result>\n</function_results>\n\n#{DiscourseAi::Completions::Dialects::XmlTools::DONE_MESSAGE}",},],)diff --git a/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb b/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rbindex b9378d7dc8c..58d01d77faa 100644--- a/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb+++ b/plugins/discourse-ai/spec/lib/modules/automation/report_context_generator_spec.rb@@ -45,7 +45,7 @@ module DiscourseAibefore { enable_current_plugin }- if defined?(::DiscourseSolved)+ if defined?(DiscourseSolved)it "will correctly denote solved topics" doFabricate(:solved_topic, topic: topic_with_likes, answer_post: post_with_likes2)diff --git a/plugins/discourse-assign/app/controllers/discourse_assign/assign_controller.rb b/plugins/discourse-assign/app/controllers/discourse_assign/assign_controller.rbindex 31a776b3fed..5b41a45292e 100644--- a/plugins/discourse-assign/app/controllers/discourse_assign/assign_controller.rb+++ b/plugins/discourse-assign/app/controllers/discourse_assign/assign_controller.rb@@ -2,7 +2,7 @@module DiscourseAssignclass AssignController < ApplicationController- requires_plugin DiscourseAssign::PLUGIN_NAME+ requires_plugin PLUGIN_NAMErequires_loginbefore_action :ensure_logged_in, :ensure_assign_alloweddiff --git a/plugins/discourse-assign/config/routes.rb b/plugins/discourse-assign/config/routes.rbindex ef974f3d876..5d08284d0d5 100644--- a/plugins/discourse-assign/config/routes.rb+++ b/plugins/discourse-assign/config/routes.rb@@ -10,7 +10,7 @@ DiscourseAssign::Engine.routes.draw doendDiscourse::Application.routes.draw do- mount ::DiscourseAssign::Engine, at: "/assign"+ mount DiscourseAssign::Engine, at: "/assign"get "topics/private-messages-assigned/:username" => "list#private_messages_assigned",:as => "topics_private_messages_assigned",diff --git a/plugins/discourse-assign/lib/discourse_assign/engine.rb b/plugins/discourse-assign/lib/discourse_assign/engine.rbindex 29cff854917..41a3ce967d9 100644--- a/plugins/discourse-assign/lib/discourse_assign/engine.rb+++ b/plugins/discourse-assign/lib/discourse_assign/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseAssign+module DiscourseAssignclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseAssigndiff --git a/plugins/discourse-calendar/config/routes.rb b/plugins/discourse-calendar/config/routes.rbindex 74bd6b0ab90..5af4a238b54 100644--- a/plugins/discourse-calendar/config/routes.rb+++ b/plugins/discourse-calendar/config/routes.rb@@ -19,8 +19,8 @@ DiscoursePostEvent::Engine.routes.draw doendDiscourse::Application.routes.draw do- mount ::DiscourseCalendar::Engine, at: "/"- mount ::DiscoursePostEvent::Engine, at: "/"+ mount DiscourseCalendar::Engine, at: "/"+ mount DiscoursePostEvent::Engine, at: "/"scope constraints: StaffConstraint.new doget "/admin/plugins/calendar" => "admin/plugins#index"diff --git a/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb b/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rbindex c76439965d9..cdc4d28f7da 100644--- a/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb+++ b/plugins/discourse-calendar/jobs/scheduled/create_holiday_events.rb@@ -1,122 +1,124 @@# frozen_string_literal: truemodule Jobs- class ::DiscourseCalendar::CreateHolidayEvents < ::Jobs::Scheduled- every 10.minutes-- def execute(args)- return if !SiteSetting.calendar_enabled- return if !SiteSetting.calendar_automatic_holidays_enabled-- return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence-- require "holidays" if !defined?(Holidays)-- today = Date.today-- regions_and_user_ids = Hash.new { |h, k| h[k] = [] }-- UserCustomField- .where(name: ::DiscourseCalendar::REGION_CUSTOM_FIELD)- .pluck(:user_id, :value)- .each { |user_id, region| regions_and_user_ids[region] << user_id if region.present? }-- usernames =- User- .real- .activated- .not_suspended- .not_silenced- .where(id: regions_and_user_ids.values.flatten)- .pluck(:id, :username)- .to_h-- timezones =- UserOption- .where(user_id: usernames.keys)- .where.not(timezone: nil)- .pluck(:user_id, :timezone)- .map do |user_id, timezone|- [- user_id,- (- begin- TZInfo::Timezone.get(timezone)- rescue StandardError- nil+ module DiscourseCalendar+ class CreateHolidayEvents < ::Jobs::Scheduled+ every 10.minutes++ def execute(args)+ return if !SiteSetting.calendar_enabled+ return if !SiteSetting.calendar_automatic_holidays_enabled++ return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence++ require "holidays" if !defined?(Holidays)++ today = Date.today++ regions_and_user_ids = Hash.new { |h, k| h[k] = [] }++ UserCustomField+ .where(name: ::DiscourseCalendar::REGION_CUSTOM_FIELD)+ .pluck(:user_id, :value)+ .each { |user_id, region| regions_and_user_ids[region] << user_id if region.present? }++ usernames =+ User+ .real+ .activated+ .not_suspended+ .not_silenced+ .where(id: regions_and_user_ids.values.flatten)+ .pluck(:id, :username)+ .to_h++ timezones =+ UserOption+ .where(user_id: usernames.keys)+ .where.not(timezone: nil)+ .pluck(:user_id, :timezone)+ .map do |user_id, timezone|+ [+ user_id,+ (+ begin+ TZInfo::Timezone.get(timezone)+ rescue StandardError+ nil+ end+ ),+ ]+ end+ .to_h++ # Remove holidays for deactivated/suspended/silenced users+ CalendarEvent.where(post_id: nil).where.not(user_id: usernames.keys).destroy_all++ # Remove future holidays when users changed their region+ CalendarEvent+ .joins(user: :_custom_fields)+ .where(post_id: nil)+ .where("start_date > ?", today)+ .where("user_custom_fields.name = ?", ::DiscourseCalendar::REGION_CUSTOM_FIELD)+ .where("LENGTH(COALESCE(user_custom_fields.value, '')) > 0")+ .where("user_custom_fields.value != calendar_events.region")+ .destroy_all++ regions_and_user_ids.each do |region, user_ids|+ ::DiscourseCalendar::Holiday+ .find_holidays_for(+ region_code: region,+ start_date: today,+ end_date: 6.months.from_now,+ show_holiday_observed_on_dates: true,+ )+ .filter { |holiday| (1..5) === holiday[:date].wday && holiday[:disabled] === false }+ .each do |holiday|+ user_ids.each do |user_id|+ next unless usernames[user_id]++ date = holiday[:date]++ if tz = timezones[user_id]+ date = holiday[:date].in_time_zone(tz)+ date = date.change(hour_adjustment) if hour_adjustmentend- ),- ]- end- .to_h-- # Remove holidays for deactivated/suspended/silenced users- CalendarEvent.where(post_id: nil).where.not(user_id: usernames.keys).destroy_all-- # Remove future holidays when users changed their region- CalendarEvent- .joins(user: :_custom_fields)- .where(post_id: nil)- .where("start_date > ?", today)- .where("user_custom_fields.name = ?", ::DiscourseCalendar::REGION_CUSTOM_FIELD)- .where("LENGTH(COALESCE(user_custom_fields.value, '')) > 0")- .where("user_custom_fields.value != calendar_events.region")- .destroy_all-- regions_and_user_ids.each do |region, user_ids|- DiscourseCalendar::Holiday- .find_holidays_for(- region_code: region,- start_date: today,- end_date: 6.months.from_now,- show_holiday_observed_on_dates: true,- )- .filter { |holiday| (1..5) === holiday[:date].wday && holiday[:disabled] === false }- .each do |holiday|- user_ids.each do |user_id|- next unless usernames[user_id]-- date = holiday[:date]-- if tz = timezones[user_id]- date = holiday[:date].in_time_zone(tz)- date = date.change(hour_adjustment) if hour_adjustment- end- event =- CalendarEvent- .where(topic_id: topic_id, user_id: user_id, description: holiday[:name])- .where(- "start_date >= :from AND start_date <= :to",- from: date - 1.day,- to: date + 1.day,- )- .first_or_initialize-- event.update!(- topic_id: topic_id,- user_id: user_id,- description: holiday[:name],- start_date: date,- region: region,- username: usernames[user_id],- timezone: tz&.name,- )+ event =+ CalendarEvent+ .where(topic_id: topic_id, user_id: user_id, description: holiday[:name])+ .where(+ "start_date >= :from AND start_date <= :to",+ from: date - 1.day,+ to: date + 1.day,+ )+ .first_or_initialize++ event.update!(+ topic_id: topic_id,+ user_id: user_id,+ description: holiday[:name],+ start_date: date,+ region: region,+ username: usernames[user_id],+ timezone: tz&.name,+ )+ endend- end- end- end-- def hour_adjustment- if SiteSetting.all_day_event_start_time.empty? || SiteSetting.all_day_event_end_time.empty?- return+ endend- @holiday_hour ||=- begin- split = SiteSetting.all_day_event_start_time.split(":")- { hour: split.first, min: split.second }+ def hour_adjustment+ if SiteSetting.all_day_event_start_time.empty? || SiteSetting.all_day_event_end_time.empty?+ returnend++ @holiday_hour ||=+ begin+ split = SiteSetting.all_day_event_start_time.split(":")+ { hour: split.first, min: split.second }+ end+ endendendenddiff --git a/plugins/discourse-calendar/jobs/scheduled/delete_expired_event_posts.rb b/plugins/discourse-calendar/jobs/scheduled/delete_expired_event_posts.rbindex b386a158c21..0b97a401bea 100644--- a/plugins/discourse-calendar/jobs/scheduled/delete_expired_event_posts.rb+++ b/plugins/discourse-calendar/jobs/scheduled/delete_expired_event_posts.rb@@ -1,56 +1,58 @@# frozen_string_literal: truemodule Jobs- class ::DiscourseCalendar::DeleteExpiredEventPosts < ::Jobs::Scheduled- every 10.minutes+ module DiscourseCalendar+ class DeleteExpiredEventPosts < ::Jobs::Scheduled+ every 10.minutes- def execute(args)- return unless SiteSetting.calendar_enabled+ def execute(args)+ return unless SiteSetting.calendar_enabled- delay = SiteSetting.delete_expired_event_posts_after- return if delay < 0+ delay = SiteSetting.delete_expired_event_posts_after+ return if delay < 0- calendar_topic_ids =- Post- .joins(:_custom_fields)- .where(post_custom_fields: { name: DiscourseCalendar::CALENDAR_CUSTOM_FIELD })- .pluck(:topic_id)+ calendar_topic_ids =+ Post+ .joins(:_custom_fields)+ .where(post_custom_fields: { name: ::DiscourseCalendar::CALENDAR_CUSTOM_FIELD })+ .pluck(:topic_id)- post_events =- CalendarEvent- .joins(:post, :topic)- .where(topic_id: calendar_topic_ids)- .where("TRIM(COALESCE(calendar_events.recurrence, '')) = ''")- .where("NOT topics.closed AND NOT topics.archived")+ post_events =+ CalendarEvent+ .joins(:post, :topic)+ .where(topic_id: calendar_topic_ids)+ .where("TRIM(COALESCE(calendar_events.recurrence, '')) = ''")+ .where("NOT topics.closed AND NOT topics.archived")- event_post_ids = post_events.pluck(:post_id).to_set+ event_post_ids = post_events.pluck(:post_id).to_set- post_events.each do |event|- end_date = event.end_date.presence || event.start_date + 24.hours- next if end_date + delay.hour > Time.current+ post_events.each do |event|+ end_date = event.end_date.presence || event.start_date + 24.hours+ next if end_date + delay.hour > Time.current- # get all the replies to the post- reply_ids = event.post.reply_ids(system_guardian)- replies = Post.where(id: reply_ids.map { |r| r[:id] })+ # get all the replies to the post+ reply_ids = event.post.reply_ids(system_guardian)+ replies = Post.where(id: reply_ids.map { |r| r[:id] })- # only delete replies that have no event- replies.each { |reply| destroy_post(reply) if !event_post_ids.include?(reply.id) }+ # only delete replies that have no event+ replies.each { |reply| destroy_post(reply) if !event_post_ids.include?(reply.id) }- # delete the post- destroy_post(event.post)+ # delete the post+ destroy_post(event.post)+ endend- end- def destroy_post(post)- PostDestroyer.new(- Discourse.system_user,- post,- context: I18n.t("discourse_calendar.event_expired"),- ).destroy- end+ def destroy_post(post)+ PostDestroyer.new(+ Discourse.system_user,+ post,+ context: I18n.t("discourse_calendar.event_expired"),+ ).destroy+ end- def system_guardian- @system_guardian ||= Guardian.new(Discourse.system_user)+ def system_guardian+ @system_guardian ||= Guardian.new(Discourse.system_user)+ endendendenddiff --git a/plugins/discourse-calendar/jobs/scheduled/monitor_event_dates.rb b/plugins/discourse-calendar/jobs/scheduled/monitor_event_dates.rbindex a500264d8cb..4ca3d84e274 100644--- a/plugins/discourse-calendar/jobs/scheduled/monitor_event_dates.rb+++ b/plugins/discourse-calendar/jobs/scheduled/monitor_event_dates.rb@@ -1,80 +1,84 @@# frozen_string_literal: true+module Jobs- class ::DiscourseCalendar::MonitorEventDates < ::Jobs::Scheduled- every 1.minute+ module DiscourseCalendar+ class MonitorEventDates < ::Jobs::Scheduled+ every 1.minute- def execute(args)- DiscoursePostEvent::EventDate.pending.find_each do |event_date|- send_reminder(event_date)- trigger_events(event_date)- finish(event_date)+ def execute(args)+ DiscoursePostEvent::EventDate.pending.find_each do |event_date|+ send_reminder(event_date)+ trigger_events(event_date)+ finish(event_date)+ endend- end- def send_reminder(event_date)- due_reminders(event_date).each do |reminder|- ::Jobs.enqueue(- :discourse_post_event_send_reminder,- event_id: event_date.event.id,- reminder: reminder[:description],- )- event_date.update!(reminder_counter: event_date.reminder_counter + 1)+ def send_reminder(event_date)+ due_reminders(event_date).each do |reminder|+ ::Jobs.enqueue(+ :discourse_post_event_send_reminder,+ event_id: event_date.event.id,+ reminder: reminder[:description],+ )+ event_date.update!(reminder_counter: event_date.reminder_counter + 1)+ endend- end- def trigger_events(event_date)- if event_date.starts_at - 1.hour <= Time.current && event_date.event_will_start_sent_at.blank?- event_date.update!(event_will_start_sent_at: DateTime.now)- DiscourseEvent.trigger(:discourse_post_event_event_will_start, event_date.event)- end+ def trigger_events(event_date)+ if event_date.starts_at - 1.hour <= Time.current &&+ event_date.event_will_start_sent_at.blank?+ event_date.update!(event_will_start_sent_at: DateTime.now)+ DiscourseEvent.trigger(:discourse_post_event_event_will_start, event_date.event)+ end- if event_date.started? && event_date.event_started_sent_at.blank?- event_date.update!(event_started_sent_at: DateTime.now)- DiscourseEvent.trigger(:discourse_post_event_event_started, event_date.event)+ if event_date.started? && event_date.event_started_sent_at.blank?+ event_date.update!(event_started_sent_at: DateTime.now)+ DiscourseEvent.trigger(:discourse_post_event_event_started, event_date.event)+ endend- end- def finish(event_date)- return if !event_date.ended?- event_date.update!(finished_at: Time.current)+ def finish(event_date)+ return if !event_date.ended?+ event_date.update!(finished_at: Time.current)- DiscourseEvent.trigger(:discourse_post_event_event_ended, event_date.event)- MessageBus.publish(- "/topic/#{event_date.event.post.topic_id}",- reload_topic: true,- refresh_stream: true,- )+ DiscourseEvent.trigger(:discourse_post_event_event_ended, event_date.event)+ MessageBus.publish(+ "/topic/#{event_date.event.post.topic_id}",+ reload_topic: true,+ refresh_stream: true,+ )- return if event_date.event.recurrence.blank?- event_date.event.set_next_date- event_date.event.set_topic_bump- end+ return if event_date.event.recurrence.blank?+ event_date.event.set_next_date+ event_date.event.set_topic_bump+ end- def due_reminders(event_date)- return [] if event_date.event.reminders.blank?- event_date- .event- .reminders- .split(",")- .map do |reminder|- unit, value, type = reminder.split(".").reverse+ def due_reminders(event_date)+ return [] if event_date.event.reminders.blank?+ event_date+ .event+ .reminders+ .split(",")+ .map do |reminder|+ unit, value, type = reminder.split(".").reverse- next if type === "bumpTopic" || !validate_reminder_unit(unit)- reminder = "notification.#{value}.#{unit}" if type.blank?+ next if type === "bumpTopic" || !validate_reminder_unit(unit)+ reminder = "notification.#{value}.#{unit}" if type.blank?- date = event_date.starts_at - value.to_i.public_send(unit)- { description: reminder, date: date }- end- .compact- .select { |reminder| reminder[:date] <= Time.current }- .sort_by { |reminder| reminder[:date] }- .drop(event_date.reminder_counter)- end+ date = event_date.starts_at - value.to_i.public_send(unit)+ { description: reminder, date: date }+ end+ .compact+ .select { |reminder| reminder[:date] <= Time.current }+ .sort_by { |reminder| reminder[:date] }+ .drop(event_date.reminder_counter)+ end- private+ private- def validate_reminder_unit(input)- ActiveSupport::Duration::PARTS.any? { |part| part.to_s == input }+ def validate_reminder_unit(input)+ ActiveSupport::Duration::PARTS.any? { |part| part.to_s == input }+ endendendenddiff --git a/plugins/discourse-calendar/jobs/scheduled/update_holiday_usernames.rb b/plugins/discourse-calendar/jobs/scheduled/update_holiday_usernames.rbindex b7c4b9a22bc..df2cd2e95b2 100644--- a/plugins/discourse-calendar/jobs/scheduled/update_holiday_usernames.rb+++ b/plugins/discourse-calendar/jobs/scheduled/update_holiday_usernames.rb@@ -1,53 +1,55 @@# frozen_string_literal: truemodule Jobs- class ::DiscourseCalendar::UpdateHolidayUsernames < ::Jobs::Scheduled- every 10.minutes+ module DiscourseCalendar+ class UpdateHolidayUsernames < ::Jobs::Scheduled+ every 10.minutes- def execute(args)- return unless SiteSetting.calendar_enabled- return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence+ def execute(args)+ return unless SiteSetting.calendar_enabled+ return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence- events = CalendarEvent.where(topic_id: topic_id)- users_on_holiday = DiscourseCalendar::UsersOnHoliday.from(events)+ events = CalendarEvent.where(topic_id: topic_id)+ users_on_holiday = ::DiscourseCalendar::UsersOnHoliday.from(events)- DiscourseCalendar.users_on_holiday = users_on_holiday.values.map { |u| u[:username] }- synchronize_user_custom_fields(users_on_holiday)- set_holiday_statuses(users_on_holiday)- end+ ::DiscourseCalendar.users_on_holiday = users_on_holiday.values.map { |u| u[:username] }+ synchronize_user_custom_fields(users_on_holiday)+ set_holiday_statuses(users_on_holiday)+ end- private+ private- def synchronize_user_custom_fields(users_on_holiday)- custom_field_name = DiscourseCalendar::HOLIDAY_CUSTOM_FIELD+ def synchronize_user_custom_fields(users_on_holiday)+ custom_field_name = ::DiscourseCalendar::HOLIDAY_CUSTOM_FIELD- if users_on_holiday.present?- user_ids = users_on_holiday.keys- values = user_ids.map { |id| "(#{id}, '#{custom_field_name}', 't', now(), now())" }+ if users_on_holiday.present?+ user_ids = users_on_holiday.keys+ values = user_ids.map { |id| "(#{id}, '#{custom_field_name}', 't', now(), now())" }- DB.exec <<~SQL, custom_field_name+ DB.exec <<~SQL, custom_field_nameINSERT INTO user_custom_fields (user_id, name, value, created_at, updated_at)VALUES #{values.join(",")}ON CONFLICT (user_id, name) WHERE (name = ?) DO NOTHINGSQL- DB.exec <<~SQL, custom_field_name, user_ids+ DB.exec <<~SQL, custom_field_name, user_idsDELETE FROM user_custom_fieldsWHERE name = ?AND user_id NOT IN (?)SQL- else- DB.exec("DELETE FROM user_custom_fields WHERE name = ?", custom_field_name)+ else+ DB.exec("DELETE FROM user_custom_fields WHERE name = ?", custom_field_name)+ endend- end- def set_holiday_statuses(users_on_holiday)- return if !SiteSetting.enable_user_status+ def set_holiday_statuses(users_on_holiday)+ return if !SiteSetting.enable_user_status- User- .where(id: users_on_holiday.keys)- .includes(:user_status)- .each { |u| DiscourseCalendar::HolidayStatus.set!(u, users_on_holiday[u.id][:ends_at]) }+ User+ .where(id: users_on_holiday.keys)+ .includes(:user_status)+ .each { |u| ::DiscourseCalendar::HolidayStatus.set!(u, users_on_holiday[u.id][:ends_at]) }+ endendendenddiff --git a/plugins/discourse-calendar/lib/discourse_calendar/engine.rb b/plugins/discourse-calendar/lib/discourse_calendar/engine.rbindex 281db7e2c45..5efdc1f0aaf 100644--- a/plugins/discourse-calendar/lib/discourse_calendar/engine.rb+++ b/plugins/discourse-calendar/lib/discourse_calendar/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseCalendar+module DiscourseCalendarclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseCalendardiff --git a/plugins/discourse-calendar/spec/integration/post_spec.rb b/plugins/discourse-calendar/spec/integration/post_spec.rbindex 1c03ae07824..31c27e1df5e 100644--- a/plugins/discourse-calendar/spec/integration/post_spec.rb+++ b/plugins/discourse-calendar/spec/integration/post_spec.rb@@ -687,7 +687,7 @@ describe Post doraw = 'Vacation [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ Jobs::DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)# the job has set the holiday status:status = post.user.user_status@@ -708,7 +708,7 @@ describe Post doraw = 'Vacation [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ Jobs::DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)# the job has set the holiday status:status = post.user.user_statusdiff --git a/plugins/discourse-calendar/spec/jobs/scheduled/create_holiday_events_spec.rb b/plugins/discourse-calendar/spec/jobs/scheduled/create_holiday_events_spec.rbindex d0d1b11e234..df5cd352653 100644--- a/plugins/discourse-calendar/spec/jobs/scheduled/create_holiday_events_spec.rb+++ b/plugins/discourse-calendar/spec/jobs/scheduled/create_holiday_events_spec.rb@@ -1,6 +1,8 @@# frozen_string_literal: true-describe DiscourseCalendar::CreateHolidayEvents do+describe Jobs::DiscourseCalendar::CreateHolidayEvents do+ subject(:job) { described_class.new }+let(:calendar_post) { create_post(raw: "[calendar]\n[/calendar]") }let(:frenchy) do@@ -21,7 +23,7 @@ describe DiscourseCalendar::CreateHolidayEvents dofrenchyfreeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.where(user_id: frenchy.id).count).to eq(0)end@@ -29,7 +31,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "adds all holidays in the next 6 months" dofrenchyfreeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.pluck(:region, :description, :start_date, :user_id)).to match_array([@@ -45,7 +47,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "checks for observed dates" doaussiefreeze_time Time.zone.local(2020, 1, 20)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)# The "Australia Day" is always observed on a Mondayexpect(CalendarEvent.pluck(:region, :description, :start_date, :user_id)).to match_array(@@ -60,7 +62,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "only checks for holidays during business days" dofrenchyfreeze_time Time.zone.local(2019, 7, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)# The "Fête Nationale" is on July 14th but it's on a Sunday in 2019expect(CalendarEvent.pluck(:region, :description, :start_date, :user_id)).to match_array(@@ -104,48 +106,44 @@ describe DiscourseCalendar::CreateHolidayEvents do},)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.pluck(:region, :description, :start_date, :user_id)).to eq([])endit "does not create duplicates when username is changed" dofrenchy- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)created_event = CalendarEvent.lastexpect(created_event.username).to eq(frenchy.username)frenchy.update!(username: "new_username")- expect { DiscourseCalendar::CreateHolidayEvents.new.execute(nil) }.not_to change {- CalendarEvent.count- }+ expect { job.execute(nil) }.not_to change { CalendarEvent.count }expect(created_event.reload.username).to eq("new_username")endit "does not create duplicates when timezone is changed" dofrenchy- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)created_event = CalendarEvent.lastexpect(created_event.timezone).to eq(frenchy.user_option.timezone)frenchy.user_option.update!(timezone: "Asia/Taipei")- expect { DiscourseCalendar::CreateHolidayEvents.new.execute(nil) }.not_to change {- CalendarEvent.count- }+ expect { job.execute(nil) }.not_to change { CalendarEvent.count }expect(created_event.reload.timezone).to eq("Asia/Taipei")endit "cleans up holidays from deactivated/silenced/suspended users" dofrenchyfreeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.exists?(user_id: frenchy.id)).to eq(true)frenchy.active = falsefrenchy.save!- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.exists?(user_id: frenchy.id)).to eq(false)end@@ -153,7 +151,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "cleans up holidays from users who changed their region" dofrenchyfreeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.exists?(user_id: frenchy.id)).to eq(true)@@ -162,7 +160,7 @@ describe DiscourseCalendar::CreateHolidayEvents dofreeze_time Time.zone.local(2020, 1, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)# Past 'fr' holidays should not be removedexpect(@@ -204,7 +202,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "only adds enabled holidays to the calendar" dofrenchyfreeze_time Time.zone.local(2019, 7, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.pluck(:region, :description, :start_date, :user_id)).to match_array([@@ -218,7 +216,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "doesn't add disabled holidays to the calendar" dofrenchyfreeze_time Time.zone.local(2019, 7, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.pluck(:description)).not_to include(france_assomption[:holiday_name])expect(CalendarEvent.pluck(:description)).not_to include(france_toussaint[:holiday_name])@@ -229,7 +227,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "uses the user TZ when available" dofrenchy.user_option.update!(timezone: "Europe/Paris")freeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)calendar_event = CalendarEvent.firstexpect(calendar_event.region).to eq("fr")@@ -248,7 +246,7 @@ describe DiscourseCalendar::CreateHolidayEvents doit "uses the user TZ when available" dofrenchy.user_option.update!(timezone: "Europe/Paris")freeze_time Time.zone.local(2019, 8, 1)- DiscourseCalendar::CreateHolidayEvents.new.execute(nil)+ job.execute(nil)calendar_event = CalendarEvent.firstexpect(calendar_event.region).to eq("fr")diff --git a/plugins/discourse-calendar/spec/jobs/scheduled/delete_expired_event_posts_spec.rb b/plugins/discourse-calendar/spec/jobs/scheduled/delete_expired_event_posts_spec.rbindex a9256230609..a7f0c13f8b1 100644--- a/plugins/discourse-calendar/spec/jobs/scheduled/delete_expired_event_posts_spec.rb+++ b/plugins/discourse-calendar/spec/jobs/scheduled/delete_expired_event_posts_spec.rb@@ -1,6 +1,8 @@# frozen_string_literal: true-describe DiscourseCalendar::DeleteExpiredEventPosts do+describe Jobs::DiscourseCalendar::DeleteExpiredEventPosts do+ subject(:job) { described_class.new }+before doJobs.run_immediately!SiteSetting.calendar_enabled = true@@ -25,7 +27,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts doraw: "Summer ☀️ Solstice [date=#{Date.current.year + 1}-06-21]",)- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post_with_one_date.id)).to eq(false)expect(Post.exists?(post_with_two_dates.id)).to eq(false)@@ -51,7 +53,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts dodescription: "Matariki",)- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(CalendarEvent.exists?(matariki.id)).to eq(true)end@@ -60,7 +62,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts dopost = create_post(raw: "Discourse 💬 Launch 🚀 on [date=2013-02-05]")CalendarEvent.create!(topic: post.topic, post: post, start_date: Date.new(2013, 2, 5))- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post.id)).to eq(true)end@@ -72,7 +74,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts doraw: 'WWW - Weekly Wednesday Watercooler [date=2022-01-05 recurring="1.week"] 🐸',)- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post.id)).to eq(true)end@@ -86,7 +88,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts docalendar_topic.update!(archived: true)- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post.id)).to eq(true)end@@ -100,7 +102,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts docalendar_topic.update!(closed: true)- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post.id)).to eq(true)end@@ -151,7 +153,7 @@ describe DiscourseCalendar::DeleteExpiredEventPosts dofreeze_time Time.parse("2018-10-01 00:00:00 UTC")- DiscourseCalendar::DeleteExpiredEventPosts.new.execute(nil)+ job.execute(nil)expect(Post.exists?(post.id)).to eq(false)expect(Post.exists?(reply_without_event.id)).to eq(false)diff --git a/plugins/discourse-calendar/spec/jobs/scheduled/monitor_event_dates_spec.rb b/plugins/discourse-calendar/spec/jobs/scheduled/monitor_event_dates_spec.rbindex 6259c9f11e3..a240873ed06 100644--- a/plugins/discourse-calendar/spec/jobs/scheduled/monitor_event_dates_spec.rb+++ b/plugins/discourse-calendar/spec/jobs/scheduled/monitor_event_dates_spec.rb@@ -1,6 +1,8 @@# frozen_string_literal: true-describe DiscourseCalendar::MonitorEventDates do+describe Jobs::DiscourseCalendar::MonitorEventDates do+ subject(:job) { described_class.new }+fab!(:post_1) { Fabricate(:post) }fab!(:post_2) { Fabricate(:post) }fab!(:post_3) { Fabricate(:post) }@@ -31,9 +33,7 @@ describe DiscourseCalendar::MonitorEventDates dodescribe "#send_reminder" doit "lodge reminder jobs in correct times" do- expect_not_enqueued_with(job: :discourse_post_event_send_reminder) do- described_class.new.execute({})- end+ expect_not_enqueued_with(job: :discourse_post_event_send_reminder) { job.execute({}) }freeze_time(7.days.after - 59.minutes)expect_enqueued_with(@@ -42,7 +42,7 @@ describe DiscourseCalendar::MonitorEventDates doevent_id: past_event.id,reminder: "notification.1.hours",},- ) { described_class.new.execute({}) }+ ) { job.execute({}) }freeze_time(7.days.after - 14.minutes)expect_enqueued_with(@@ -51,7 +51,7 @@ describe DiscourseCalendar::MonitorEventDates doevent_id: past_event.id,reminder: "notification.15.minutes",},- ) { described_class.new.execute({}) }+ ) { job.execute({}) }freeze_time(7.days.after - 9.minutes)expect_not_enqueued_with(@@ -60,26 +60,22 @@ describe DiscourseCalendar::MonitorEventDates doevent_id: past_event.id,reminder: "notification.10.minutes",},- ) { described_class.new.execute({}) }+ ) { job.execute({}) }freeze_time 7.days.after- expect_not_enqueued_with(job: :discourse_post_event_send_reminder) do- described_class.new.execute({})- end+ expect_not_enqueued_with(job: :discourse_post_event_send_reminder) { job.execute({}) }endit "does not lodge reminder jobs when event is deleted" dofreeze_time(7.days.after - 59.minutes)past_event.update!(deleted_at: Time.now)- expect_not_enqueued_with(job: :discourse_post_event_send_reminder) do- described_class.new.execute({})- end+ expect_not_enqueued_with(job: :discourse_post_event_send_reminder) { job.execute({}) }endenddescribe "#trigger_events" doit "sends singe event 1 hours before and when due" do- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }expect(events).not_to include(event_name: :discourse_post_event_event_will_start,params: [past_event],@@ -89,10 +85,10 @@ describe DiscourseCalendar::MonitorEventDates doparams: [past_event],)- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }freeze_time(7.days.after - 59.minutes)- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }expect(events).to include(event_name: :discourse_post_event_event_will_start,params: [past_event],@@ -103,7 +99,7 @@ describe DiscourseCalendar::MonitorEventDates do)freeze_time(7.days.after)- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }expect(events).not_to include(event_name: :discourse_post_event_event_will_start,params: [past_event],@@ -113,7 +109,7 @@ describe DiscourseCalendar::MonitorEventDates doparams: [past_event],)- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }expect(events).not_to include(event_name: :discourse_post_event_event_will_start,params: [past_event],@@ -127,13 +123,13 @@ describe DiscourseCalendar::MonitorEventDates dodescribe "#finish" doit "finishes past event" do- described_class.new.execute({})+ job.execute({})expect(future_date.finished_at).to eq(nil)expect(past_date.finished_at).to eq(nil)freeze_time 8.days.after- described_class.new.execute({})+ job.execute({})future_date.reloadexpect(future_date.finished_at).to eq(nil)expect(past_event.event_dates.pending.count).to eq(0)@@ -149,7 +145,7 @@ describe DiscourseCalendar::MonitorEventDates dofreeze_time 8.days.after- events = DiscourseEvent.track_events { described_class.new.execute({}) }+ events = DiscourseEvent.track_events { job.execute({}) }expect(future_date.finished_at).to eq(nil)expect(past_event.event_dates.pending.count).to eq(1)@@ -193,10 +189,9 @@ describe DiscourseCalendar::MonitorEventDates doit "doesn’t list events with invalid reminders" dofreeze_time(7.days.after - 1.minutes)- event_dates_monitor = DiscourseCalendar::MonitorEventDates.new- expect(event_dates_monitor.due_reminders(invalid_event.event_dates.first)).to be_blank- expect(event_dates_monitor.due_reminders(valid_event.event_dates.first).length).to eq(1)+ expect(job.due_reminders(invalid_event.event_dates.first)).to be_blank+ expect(job.due_reminders(valid_event.event_dates.first).length).to eq(1)endendenddiff --git a/plugins/discourse-calendar/spec/jobs/scheduled/update_holiday_usernames_spec.rb b/plugins/discourse-calendar/spec/jobs/scheduled/update_holiday_usernames_spec.rbindex 41381b483de..db3e05e690e 100644--- a/plugins/discourse-calendar/spec/jobs/scheduled/update_holiday_usernames_spec.rb+++ b/plugins/discourse-calendar/spec/jobs/scheduled/update_holiday_usernames_spec.rb@@ -1,6 +1,8 @@# frozen_string_literal: true-describe DiscourseCalendar::UpdateHolidayUsernames do+describe Jobs::DiscourseCalendar::UpdateHolidayUsernames do+ subject(:job) { described_class.new }+let(:calendar_post) { create_post(raw: "[calendar]\n[/calendar]") }before do@@ -15,12 +17,12 @@ describe DiscourseCalendar::UpdateHolidayUsernames doraw = 'Rome [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)expect(DiscourseCalendar.users_on_holiday).to eq([post.user.username])freeze_time Time.utc(2018, 6, 7, 18, 40)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)expect(DiscourseCalendar.users_on_holiday).to eq([])end@@ -34,7 +36,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames doraw2 = 'Rome [date="2018-06-05"]' # the whole daypost2 = create_post(raw: raw2, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)expect(UserCustomField.exists?(name: DiscourseCalendar::HOLIDAY_CUSTOM_FIELD,@@ -49,7 +51,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames do).to be_truthyfreeze_time Time.utc(2018, 6, 6, 10, 00)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)expect(UserCustomField.exists?(name: DiscourseCalendar::HOLIDAY_CUSTOM_FIELD,@@ -64,7 +66,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames do).to be_falseyfreeze_time Time.utc(2018, 6, 7, 10, 00)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)expect(UserCustomField.exists?(name: DiscourseCalendar::HOLIDAY_CUSTOM_FIELD,@@ -86,7 +88,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames doraw = 'Rome [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadstatus = post.user.user_status@@ -103,7 +105,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames doraw = 'Rome [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadexpect(post.user.user_status).to be_nil@@ -118,7 +120,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames docustom_status = { description: "I am working on holiday", emoji: "construction_worker_man" }post.user.set_status!(custom_status[:description], custom_status[:emoji])- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadstatus = post.user.user_status@@ -149,7 +151,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames do)freeze_time tomorrow + 2.day- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadstatus = post.user.user_status@@ -166,7 +168,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames doraw = 'Rome [date="2018-06-05" time="10:20:00"] to [date="2018-06-06" time="10:20:00"]'post = create_post(raw: raw, topic: calendar_post.topic)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadexpect(post.user.user_status).to be_present@@ -178,7 +180,7 @@ describe DiscourseCalendar::UpdateHolidayUsernames do{ raw: 'Rome [date="2018-06-05" time="10:20:00"] to [date="2018-12-10" time="10:20:00"]' },revised_at: Time.now,)- DiscourseCalendar::UpdateHolidayUsernames.new.execute(nil)+ job.execute(nil)post.user.reloadexpect(post.user.user_status).to be_presentdiff --git a/plugins/discourse-calendar/spec/lib/calendar_first_day_of_week_spec.rb b/plugins/discourse-calendar/spec/lib/calendar_first_day_of_week_spec.rbindex 176264d7712..c130dfb935f 100644--- a/plugins/discourse-calendar/spec/lib/calendar_first_day_of_week_spec.rb+++ b/plugins/discourse-calendar/spec/lib/calendar_first_day_of_week_spec.rb@@ -1,7 +1,5 @@# frozen_string_literal: true-require "rails_helper"-describe SiteSetting dobefore { SiteSetting.calendar_enabled = true }diff --git a/plugins/discourse-calendar/spec/serializers/post_serializer_spec.rb b/plugins/discourse-calendar/spec/serializers/post_serializer_spec.rbindex 31fa158013f..0dbf5266996 100644--- a/plugins/discourse-calendar/spec/serializers/post_serializer_spec.rb+++ b/plugins/discourse-calendar/spec/serializers/post_serializer_spec.rb@@ -32,18 +32,18 @@ describe PostSerializer doit "groups calendar events correctly" douser = Fabricate(:user)- user.upsert_custom_fields(::DiscourseCalendar::REGION_CUSTOM_FIELD => "ar")+ user.upsert_custom_fields(DiscourseCalendar::REGION_CUSTOM_FIELD => "ar")user.user_option.update!(timezone: "America/Buenos_Aires")user2 = Fabricate(:user)- user2.upsert_custom_fields(::DiscourseCalendar::REGION_CUSTOM_FIELD => "ar")+ user2.upsert_custom_fields(DiscourseCalendar::REGION_CUSTOM_FIELD => "ar")user2.user_option.update!(timezone: "America/Buenos_Aires")post = create_post(raw: "[calendar]\n[/calendar]")SiteSetting.holiday_calendar_topic_id = post.topic.idfreeze_time Date.new(2021, 4, 1)- ::DiscourseCalendar::CreateHolidayEvents.new.execute({})+ Jobs::DiscourseCalendar::CreateHolidayEvents.new.execute({})json = PostSerializer.new(post.reload, scope: Guardian.new).as_jsonexpect(@@ -64,7 +64,7 @@ describe PostSerializer do)freeze_time Date.new(2022, 4, 1)- ::DiscourseCalendar::CreateHolidayEvents.new.execute({})+ Jobs::DiscourseCalendar::CreateHolidayEvents.new.execute({})json = PostSerializer.new(post.reload, scope: Guardian.new).as_jsonexpect(json[:post][:calendar_details].map { |x| { x[:from].year => x[:name] } }).to include(diff --git a/plugins/discourse-chat-integration/app/controllers/chat_controller.rb b/plugins/discourse-chat-integration/app/controllers/chat_controller.rbindex 9d09cae3ece..ef0804f8377 100644--- a/plugins/discourse-chat-integration/app/controllers/chat_controller.rb+++ b/plugins/discourse-chat-integration/app/controllers/chat_controller.rb@@ -9,7 +9,7 @@ class DiscourseChatIntegration::ChatController < ApplicationControllerdef list_providersproviders =- ::DiscourseChatIntegration::Provider.enabled_providers.map do |x|+ DiscourseChatIntegration::Provider.enabled_providers.map do |x|{name: x::PROVIDER_NAME,id: x::PROVIDER_NAME,@@ -26,8 +26,7 @@ class DiscourseChatIntegration::ChatController < ApplicationControllertopic_id = params[:topic_id].to_ichannel = DiscourseChatIntegration::Channel.find(channel_id)-- provider = ::DiscourseChatIntegration::Provider.get_by_name(channel.provider)+ provider = DiscourseChatIntegration::Provider.get_by_name(channel.provider)raise Discourse::NotFound if !DiscourseChatIntegration::Provider.is_enabled(provider)@@ -49,7 +48,7 @@ class DiscourseChatIntegration::ChatController < ApplicationControllerenddef list_channels- providers = ::DiscourseChatIntegration::Provider.enabled_provider_names+ providers = DiscourseChatIntegration::Provider.enabled_provider_namesrequested_provider = params[:provider]raise Discourse::InvalidParameters if !providers.include?(requested_provider)@@ -60,8 +59,7 @@ class DiscourseChatIntegration::ChatController < ApplicationControllerdef create_channelbegin- providers =- ::DiscourseChatIntegration::Provider.enabled_providers.map { |x| x::PROVIDER_NAME }+ providers = DiscourseChatIntegration::Provider.enabled_providers.map { |x| x::PROVIDER_NAME }if !defined?(params[:channel]) && defined?(params[:channel][:provider])raise Discourse::InvalidParameters, "Provider is not valid"diff --git a/plugins/discourse-chat-integration/app/initializers/discourse_chat_integration.rb b/plugins/discourse-chat-integration/app/initializers/discourse_chat_integration.rbindex e38dcd878e4..5f7d55b512b 100644--- a/plugins/discourse-chat-integration/app/initializers/discourse_chat_integration.rb+++ b/plugins/discourse-chat-integration/app/initializers/discourse_chat_integration.rb@@ -1,16 +1,14 @@# frozen_string_literal: true-module ::DiscourseChatIntegration- PLUGIN_NAME = "discourse-chat-integration".freeze-+module DiscourseChatIntegrationclass AdminEngine < ::Rails::Engineengine_name "#{PLUGIN_NAME}-admin"- isolate_namespace ::DiscourseChatIntegration+ isolate_namespace DiscourseChatIntegrationendclass PublicEngine < ::Rails::Engineengine_name "#{PLUGIN_NAME}-public"- isolate_namespace ::DiscourseChatIntegration+ isolate_namespace DiscourseChatIntegrationenddef self.pstore_get(key)diff --git a/plugins/discourse-chat-integration/app/jobs/regular/notify_chats.rb b/plugins/discourse-chat-integration/app/jobs/regular/notify_chats.rbindex fe7bbeee580..38d49292d16 100644--- a/plugins/discourse-chat-integration/app/jobs/regular/notify_chats.rb+++ b/plugins/discourse-chat-integration/app/jobs/regular/notify_chats.rb@@ -6,7 +6,7 @@ module Jobsdef execute(args)return if !SiteSetting.chat_integration_enabled?- ::DiscourseChatIntegration::Manager.trigger_notifications(args[:post_id])+ DiscourseChatIntegration::Manager.trigger_notifications(args[:post_id])endendenddiff --git a/plugins/discourse-chat-integration/app/models/channel.rb b/plugins/discourse-chat-integration/app/models/channel.rbindex a27d5d8a378..f5126ad39c2 100644--- a/plugins/discourse-chat-integration/app/models/channel.rb+++ b/plugins/discourse-chat-integration/app/models/channel.rb@@ -39,9 +39,9 @@ class DiscourseChatIntegration::Channel < DiscourseChatIntegration::PluginModeldef data_valid?# If provider is invalid, don't try and check data- return if ::DiscourseChatIntegration::Provider.provider_names.exclude? provider+ return if DiscourseChatIntegration::Provider.provider_names.exclude? provider- params = ::DiscourseChatIntegration::Provider.get_by_name(provider)::CHANNEL_PARAMETERS+ params = DiscourseChatIntegration::Provider.get_by_name(provider)::CHANNEL_PARAMETERSunless params.map { |p| p[:key] }.sort == data.keys.sorterrors.add(:data, "data does not match the required structure for provider #{provider}")diff --git a/plugins/discourse-chat-integration/app/routes/discourse.rb b/plugins/discourse-chat-integration/app/routes/discourse.rbindex 8b4246052c8..7b1ab9b846e 100644--- a/plugins/discourse-chat-integration/app/routes/discourse.rb+++ b/plugins/discourse-chat-integration/app/routes/discourse.rb@@ -1,11 +1,11 @@# frozen_string_literal: trueDiscourse::Application.routes.append do- mount ::DiscourseChatIntegration::AdminEngine,+ mount DiscourseChatIntegration::AdminEngine,at: "/admin/plugins/chat-integration",constraints: AdminConstraint.new- mount ::DiscourseChatIntegration::PublicEngine, at: "/chat-transcript/", as: "chat-transcript"- mount ::DiscourseChatIntegration::Provider::HookEngine, at: "/chat-integration/"+ mount DiscourseChatIntegration::PublicEngine, at: "/chat-transcript/", as: "chat-transcript"+ mount DiscourseChatIntegration::Provider::HookEngine, at: "/chat-integration/"# For backwards compatibility with Slack pluginpost "/slack/command" =>diff --git a/plugins/discourse-chat-integration/app/routes/discourse_chat_integration.rb b/plugins/discourse-chat-integration/app/routes/discourse_chat_integration.rbindex 86a98c5977a..b473af8a2c6 100644--- a/plugins/discourse-chat-integration/app/routes/discourse_chat_integration.rb+++ b/plugins/discourse-chat-integration/app/routes/discourse_chat_integration.rb@@ -2,7 +2,7 @@require_dependency "admin_constraint"-module ::DiscourseChatIntegration+module DiscourseChatIntegrationAdminEngine.routes.draw doget "" => "chat#respond"get "/providers" => "chat#list_providers"diff --git a/plugins/discourse-chat-integration/app/services/manager.rb b/plugins/discourse-chat-integration/app/services/manager.rbindex 95791b2658a..7ec6d59e895 100644--- a/plugins/discourse-chat-integration/app/services/manager.rb+++ b/plugins/discourse-chat-integration/app/services/manager.rb@@ -102,8 +102,8 @@ module DiscourseChatIntegrationmatching_rules.each do |rule|# If there are any issues, skip to the next rulenext unless channel = rule.channel- next unless provider = ::DiscourseChatIntegration::Provider.get_by_name(channel.provider)- next unless is_enabled = ::DiscourseChatIntegration::Provider.is_enabled(provider)+ next unless provider = DiscourseChatIntegration::Provider.get_by_name(channel.provider)+ next unless is_enabled = DiscourseChatIntegration::Provider.is_enabled(provider)beginprovider.trigger_notification(post, channel, rule)diff --git a/plugins/discourse-chat-integration/app/services/problem_check/channel_errors.rb b/plugins/discourse-chat-integration/app/services/problem_check/channel_errors.rbindex 833a5053254..be29e149f1b 100644--- a/plugins/discourse-chat-integration/app/services/problem_check/channel_errors.rb+++ b/plugins/discourse-chat-integration/app/services/problem_check/channel_errors.rb@@ -14,8 +14,7 @@ class ProblemCheck::ChannelErrors < ProblemCheckdef channel_errors?DiscourseChatIntegration::Channel.find_each.any? do |channel|- channel.error_key.present? &&- ::DiscourseChatIntegration::Provider.is_enabled(channel.provider)+ channel.error_key.present? && DiscourseChatIntegration::Provider.is_enabled(channel.provider)endendenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rbindex 28427d7a77a..e3783dbf246 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider.rb@@ -42,12 +42,12 @@ module DiscourseChatIntegrationendclass HookEngine < ::Rails::Engine- engine_name DiscourseChatIntegration::PLUGIN_NAME + "-hooks"- isolate_namespace DiscourseChatIntegration::Provider+ engine_name PLUGIN_NAME + "-hooks"+ isolate_namespace Providerendclass HookController < ::ApplicationController- requires_plugin DiscourseChatIntegration::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEclass ProviderDisabled < StandardErrorenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/discord/discord_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/discord/discord_provider.rbindex e1d155a3524..456d3593cdf 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/discord/discord_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/discord/discord_provider.rb@@ -35,7 +35,7 @@ module DiscourseChatIntegrationenddef self.generate_discord_message(post)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topic@@ -99,7 +99,7 @@ module DiscourseChatIntegrationendif !response.kind_of?(Net::HTTPSuccess)- raise ::DiscourseChatIntegration::ProviderError.new(+ raise DiscourseChatIntegration::ProviderError.new(info: {error_key: nil,message: message,diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rbindex 59c12f26563..b3722e6ed29 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/flowdock/flowdock_provider.rb@@ -20,7 +20,7 @@ module DiscourseChatIntegration::Provider::FlowdockProviderenddef self.generate_flowdock_message(post, flow_token)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)message = {flow_token: flow_token,@@ -54,11 +54,11 @@ module DiscourseChatIntegration::Provider::FlowdockProviderunless response.kind_of?(Net::HTTPSuccess)error_key = nil- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ message: message,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/gitter/gitter_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/gitter/gitter_provider.rbindex 430377ccc0d..c23d89e71fd 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/gitter/gitter_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/gitter/gitter_provider.rb@@ -21,11 +21,11 @@ module DiscourseChatIntegrationresponse = Net::HTTP.post_form(URI(channel.data["webhook_url"]), message: message)unless response.kind_of? Net::HTTPSuccesserror_key = nil- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ message: message,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/google/google_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/google/google_provider.rbindex fbe54dc80e4..9fba9720b65 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/google/google_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/google/google_provider.rb@@ -28,11 +28,11 @@ module DiscourseChatIntegrationresponse = http.request(req)unless response.kind_of? Net::HTTPSuccess- raise ::DiscourseChatIntegration::ProviderError.new info: {- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/groupme/groupme_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/groupme/groupme_provider.rbindex c87ed17bc86..23b31f35c99 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/groupme/groupme_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/groupme/groupme_provider.rb@@ -6,7 +6,7 @@ module DiscourseChatIntegration::Provider::GroupmeProviderCHANNEL_PARAMETERS = [{ key: "groupme_instance_name", regex: '[\s\S]*', unique: true }]def self.generate_groupme_message(post)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topic@@ -77,7 +77,7 @@ module DiscourseChatIntegration::Provider::GroupmeProviderif last_error_raisedsuccessfully_sent = instance_names.length() - num_errorslast_error_raised[:success_rate] = "#{successfully_sent}/#{instance_names.length()}"- raise ::DiscourseChatIntegration::ProviderError.new info: last_error_raised+ raise DiscourseChatIntegration::ProviderError.new info: last_error_raisedendenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rbindex 8292517fe0b..ae507f7063e 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/guilded/guilded_provider.rb@@ -22,7 +22,7 @@ module DiscourseChatIntegrationresponse = send_message(webhook_url, message)if !response.kind_of?(Net::HTTPSuccess)- raise ::DiscourseChatIntegration::ProviderError.new(+ raise DiscourseChatIntegration::ProviderError.new(info: {error_key: nil,message: message,@@ -45,7 +45,7 @@ module DiscourseChatIntegrationend)end- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)icon_url =if (url = (SiteSetting.try(:site_logo_small_url) || SiteSetting.logo_small_url)).present?diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/matrix/matrix_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/matrix/matrix_provider.rbindex de6101af47b..e4d0b1d4cfe 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/matrix/matrix_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/matrix/matrix_provider.rb@@ -35,7 +35,7 @@ module DiscourseChatIntegrationenddef self.generate_matrix_message(post)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)message = {msgtype: SiteSetting.chat_integration_matrix_use_notice ? "m.notice" : "m.text",@@ -81,11 +81,11 @@ module DiscourseChatIntegrationerror_key = "chat_integration.provider.matrix.errors.unknown_room"endensure- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ message: message,+ response_body: response.body,+ }endendenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller.rbindex 64549a27cad..52b3cb42191 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_command_controller.rb@@ -2,7 +2,7 @@module DiscourseChatIntegration::Provider::MattermostProviderclass MattermostCommandController < DiscourseChatIntegration::Provider::HookController- requires_provider ::DiscourseChatIntegration::Provider::MattermostProvider::PROVIDER_NAME+ requires_provider DiscourseChatIntegration::Provider::MattermostProvider::PROVIDER_NAMEbefore_action :mattermost_token_valid?, only: :command@@ -49,7 +49,7 @@ module DiscourseChatIntegration::Provider::MattermostProvider},)- ::DiscourseChatIntegration::Helper.process_command(channel, tokens)+ DiscourseChatIntegration::Helper.process_command(channel, tokens)enddef mattermost_token_valid?diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_provider.rbindex 387b5e81f09..b768015e98a 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/mattermost/mattermost_provider.rb@@ -23,17 +23,17 @@ module DiscourseChatIntegrationelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddef self.mattermost_message(post, channel)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topicdiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider.rbindex d66a344ea3f..7feacc12f0b 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider.rb@@ -26,12 +26,12 @@ module DiscourseChatIntegration::Provider::PowerAutomateProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider.rbindex 2a9ebd89c8f..4ee99f2560c 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider.rb@@ -8,7 +8,7 @@ module DiscourseChatIntegration::Provider::RocketchatProviderCHANNEL_PARAMETERS = [{ key: "identifier", regex: '^[@#]\S*$', unique: true }]def self.rocketchat_message(post, channel)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topic@@ -67,12 +67,12 @@ module DiscourseChatIntegration::Provider::RocketchatProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_command_controller.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_command_controller.rbindex 31d972d4ff7..9f3b73bc87c 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_command_controller.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_command_controller.rb@@ -2,7 +2,7 @@module DiscourseChatIntegration::Provider::SlackProviderclass SlackCommandController < DiscourseChatIntegration::Provider::HookController- requires_provider ::DiscourseChatIntegration::Provider::SlackProvider::PROVIDER_NAME+ requires_provider DiscourseChatIntegration::Provider::SlackProvider::PROVIDER_NAMEbefore_action :slack_token_valid?, only: :commandbefore_action :slack_payload_token_valid?, only: :interactive@@ -66,7 +66,7 @@ module DiscourseChatIntegration::Provider::SlackProviderparams[:response_url],)else- { text: ::DiscourseChatIntegration::Helper.process_command(channel, tokens) }+ { text: DiscourseChatIntegration::Helper.process_command(channel, tokens) }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_provider.rbindex 6c8ab9b5e3c..608a00d3e52 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_provider.rb@@ -31,7 +31,7 @@ module DiscourseChatIntegration::Provider::SlackProviderenddef self.slack_message(post, channel, filter)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topic@@ -88,7 +88,7 @@ module DiscourseChatIntegration::Provider::SlackProviderenddef self.create_slack_message(context:, content:, url:, channel_name:)- sender = ::DiscourseChatIntegration::Helper.formatted_display_name(Discourse.system_user)+ sender = DiscourseChatIntegration::Helper.formatted_display_name(Discourse.system_user)content = replace_placehoders(content, context) if context["kind"] ==DiscourseAutomation::Triggers::TOPIC_TAGS_CHANGED@@ -188,11 +188,11 @@ module DiscourseChatIntegration::Provider::SlackProviderresponse = http.request(req)unless response.kind_of? Net::HTTPSuccess- raise ::DiscourseChatIntegration::ProviderError.new info: {- request: uri,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ request: uri,+ response_code: response.code,+ response_body: response.body,+ }endjson = JSON.parse(response.body)@@ -204,12 +204,12 @@ module DiscourseChatIntegration::Provider::SlackProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: uri,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: uri,+ response_code: response.code,+ response_body: response.body,+ }endts = json.dig("message", "thread_ts") || json["ts"]@@ -237,12 +237,12 @@ module DiscourseChatIntegration::Provider::SlackProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rbindex 8b648b587bd..bfcec1a547c 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/slack/slack_transcript.rb@@ -264,7 +264,7 @@ module DiscourseChatIntegration::Provider::SlackProviderenddef fetch_user_data- http = ::DiscourseChatIntegration::Provider::SlackProvider.slack_api_http+ http = DiscourseChatIntegration::Provider::SlackProvider.slack_api_httpcursor = nilreq = Net::HTTP::Post.new(URI("https://slack.com/api/users.list"))diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/teams/teams_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/teams/teams_provider.rbindex cac70da7b8d..deac9465812 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/teams/teams_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/teams/teams_provider.rb@@ -26,12 +26,12 @@ module DiscourseChatIntegration::Provider::TeamsProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_command_controller.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_command_controller.rbindex 1b8ac8ed66c..f4e39b27568 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_command_controller.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_command_controller.rb@@ -2,7 +2,7 @@module DiscourseChatIntegration::Provider::TelegramProviderclass TelegramCommandController < DiscourseChatIntegration::Provider::HookController- requires_provider ::DiscourseChatIntegration::Provider::TelegramProvider::PROVIDER_NAME+ requires_provider DiscourseChatIntegration::Provider::TelegramProvider::PROVIDER_NAMEbefore_action :telegram_token_valid?, only: :command@@ -94,7 +94,7 @@ module DiscourseChatIntegration::Provider::TelegramProvidertokens[0][0] = "" # Remove the slash from the first tokentokens[0] = tokens[0].split("@")[0] # Remove the bot name from the command (necessary for group chats)- ::DiscourseChatIntegration::Helper.process_command(channel, tokens)+ DiscourseChatIntegration::Helper.process_command(channel, tokens)enddef telegram_token_valid?diff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_provider.rbindex 9bb56a5fa31..ccb3e85f92b 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/telegram/telegram_provider.rb@@ -51,7 +51,7 @@ module DiscourseChatIntegrationenddef self.message_text(post)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topic@@ -104,11 +104,11 @@ module DiscourseChatIntegrationelsif response["description"].include? "Forbidden"error_key = "chat_integration.provider.telegram.errors.forbidden"end- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_body: response,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ message: message,+ response_body: response,+ }endenddiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/webex/webex_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/webex/webex_provider.rbindex 94ace863a8d..171a5e614e6 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/webex/webex_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/webex/webex_provider.rb@@ -31,17 +31,17 @@ module DiscourseChatIntegration::Provider::WebexProviderelseerror_key = nilend- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- request: req.body,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ request: req.body,+ response_code: response.code,+ response_body: response.body,+ }endenddef self.get_message(post)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)topic = post.topicdiff --git a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rbindex 9e33cc0d95e..b731274d97f 100644--- a/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb+++ b/plugins/discourse-chat-integration/lib/discourse_chat_integration/provider/zulip/zulip_provider.rb@@ -30,7 +30,7 @@ module DiscourseChatIntegrationenddef self.generate_zulip_message(post, stream, subject)- display_name = ::DiscourseChatIntegration::Helper.formatted_display_name(post.user)+ display_name = DiscourseChatIntegration::Helper.formatted_display_name(post.user)message =I18n.t(@@ -64,12 +64,12 @@ module DiscourseChatIntegration"chat_integration.provider.zulip.errors.does_not_exist" if response.body.include?("does not exist",)- raise ::DiscourseChatIntegration::ProviderError.new info: {- error_key: error_key,- message: message,- response_code: response.code,- response_body: response.body,- }+ raise DiscourseChatIntegration::ProviderError.new info: {+ error_key: error_key,+ message: message,+ response_code: response.code,+ response_body: response.body,+ }endenddiff --git a/plugins/discourse-chat-integration/plugin.rb b/plugins/discourse-chat-integration/plugin.rbindex 886bad98a47..2f3f63b412a 100644--- a/plugins/discourse-chat-integration/plugin.rb+++ b/plugins/discourse-chat-integration/plugin.rb@@ -14,6 +14,10 @@ register_asset "stylesheets/chat-integration.scss"register_svg_icon "rocket" if respond_to?(:register_svg_icon)register_svg_icon "arrow-circle-o-right" if respond_to?(:register_svg_icon)+module ::DiscourseChatIntegration+ PLUGIN_NAME = "discourse-chat-integration".freeze+end+# Site setting validators must be loaded before initializerequire_relative "lib/discourse_chat_integration/provider/slack/slack_enabled_setting_validator"require_relative "lib/discourse_chat_integration/chat_integration_reference_post"diff --git a/plugins/discourse-chat-integration/spec/dummy_provider.rb b/plugins/discourse-chat-integration/spec/dummy_provider.rbindex fcd6b3a5bef..aca39bc2b62 100644--- a/plugins/discourse-chat-integration/spec/dummy_provider.rb+++ b/plugins/discourse-chat-integration/spec/dummy_provider.rb@@ -2,7 +2,7 @@RSpec.shared_context "with dummy provider" dobefore(:each) do- module ::DiscourseChatIntegration::Provider::DummyProvider+ module DiscourseChatIntegration::Provider::DummyProviderPROVIDER_NAME = "dummy".freezePROVIDER_ENABLED_SETTING = :chat_integration_enabled # Tie to main plugin enabled settingCHANNEL_PARAMETERS = []@@ -30,14 +30,14 @@ RSpec.shared_context "with dummy provider" doendend- after(:each) { ::DiscourseChatIntegration::Provider.send(:remove_const, :DummyProvider) }+ after(:each) { DiscourseChatIntegration::Provider.send(:remove_const, :DummyProvider) }- let(:provider) { ::DiscourseChatIntegration::Provider::DummyProvider }+ let(:provider) { DiscourseChatIntegration::Provider::DummyProvider }endRSpec.shared_context "with validated dummy provider" dobefore(:each) do- module ::DiscourseChatIntegration::Provider::Dummy2Provider+ module DiscourseChatIntegration::Provider::Dummy2ProviderPROVIDER_NAME = "dummy2".freezePROVIDER_ENABLED_SETTING = :chat_integration_enabled # Tie to main plugin enabled settingCHANNEL_IDENTIFIER_KEY = "val".freeze@@ -62,7 +62,7 @@ RSpec.shared_context "with validated dummy provider" doendend- after(:each) { ::DiscourseChatIntegration::Provider.send(:remove_const, :Dummy2Provider) }+ after(:each) { DiscourseChatIntegration::Provider.send(:remove_const, :Dummy2Provider) }- let(:validated_provider) { ::DiscourseChatIntegration::Provider::Dummy2Provider }+ let(:validated_provider) { DiscourseChatIntegration::Provider::Dummy2Provider }enddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/discord/discord_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/discord/discord_provider_spec.rbindex 5ebe049260c..348178cbfc9 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/discord/discord_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/discord/discord_provider_spec.rb@@ -43,7 +43,7 @@ RSpec.describe DiscourseChatIntegration::Provider::DiscordProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rbindex cf1d7289d77..a37097c99a1 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/flowdock/flowdock_provider_spec.rb@@ -29,7 +29,7 @@ RSpec.describe DiscourseChatIntegration::Provider::FlowdockProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/gitter/gitter_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/gitter/gitter_provider_spec.rbindex 2ccac9054eb..65db5f2b12c 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/gitter/gitter_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/gitter/gitter_provider_spec.rb@@ -30,7 +30,7 @@ RSpec.describe DiscourseChatIntegration::Provider::GitterProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/google/google_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/google/google_provider_spec.rbindex 0c34647acc8..11520d82350 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/google/google_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/google/google_provider_spec.rb@@ -26,7 +26,7 @@ RSpec.describe DiscourseChatIntegration::Provider::GoogleProvider dostub1 = stub_request(:post, chan1.data["webhook_url"]).to_return(status: 400, body: "{}")expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/groupme/groupme_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/groupme/groupme_provider_spec.rbindex 0fb3012ed3e..b6b03fa8240 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/groupme/groupme_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/groupme/groupme_provider_spec.rb@@ -32,7 +32,7 @@ RSpec.describe DiscourseChatIntegration::Provider::GroupmeProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/guilded/guilded_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/guilded/guilded_provider_spec.rbindex 059fe212b40..5f68767e3e6 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/guilded/guilded_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/guilded/guilded_provider_spec.rb@@ -28,7 +28,7 @@ RSpec.describe DiscourseChatIntegration::Provider::GuildedProvider dostub_request(:post, "https://media.guilded.gg/webhooks/1234/abcd").to_return(status: 400)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/matrix/matrix_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/matrix/matrix_provider_spec.rbindex 5a14897c91e..628675c8d07 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/matrix/matrix_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/matrix/matrix_provider_spec.rb@@ -37,7 +37,7 @@ RSpec.describe DiscourseChatIntegration::Provider::MatrixProvider do).to_return(status: 400, body: '{"errmsg":"M_UNKNOWN"}')expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rbindex 8629b35a3a1..6f9dbf2a10d 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/mattermost/mattermost_provider_spec.rb@@ -50,7 +50,7 @@ RSpec.describe DiscourseChatIntegration::Provider::MattermostProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider_spec.rbindex 5fdfaa00d02..9ddfc91533d 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/powerautomate/powerautomate_provider_spec.rb@@ -27,7 +27,7 @@ RSpec.describe DiscourseChatIntegration::Provider::PowerAutomateProvider dostub1 = stub_request(:post, chan1.data["webhook_url"]).to_return(status: 400, body: "{}")expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider_spec.rbindex ecdb52402a5..c21a99252fe 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/rocketchat/rocketchat_provider_spec.rb@@ -28,7 +28,7 @@ RSpec.describe DiscourseChatIntegration::Provider::RocketchatProvider dostub1 = stub_request(:post, "https://example.com/abcd").to_return(status: 400, body: "{}")expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rbindex 367930e2965..fd18cc33bfb 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/slack/slack_provider_spec.rb@@ -87,7 +87,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceend@@ -201,7 +201,7 @@ RSpec.describe DiscourseChatIntegration::Provider::SlackProvider do},)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(@stub2).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/teams/teams_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/teams/teams_provider_spec.rbindex ce5fd892b23..5600368e827 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/teams/teams_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/teams/teams_provider_spec.rb@@ -27,7 +27,7 @@ RSpec.describe DiscourseChatIntegration::Provider::TeamsProvider dostub1 = stub_request(:post, chan1.data["webhook_url"]).to_return(status: 400, body: "{}")expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_provider_spec.rbindex 963cf16b502..b505126293f 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/telegram/telegram_provider_spec.rb@@ -41,7 +41,7 @@ RSpec.describe DiscourseChatIntegration::Provider::TelegramProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/webex/webex_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/webex/webex_provider_spec.rbindex 7c8cd72555b..b77d0cbcaa8 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/webex/webex_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/webex/webex_provider_spec.rb@@ -27,7 +27,7 @@ RSpec.describe DiscourseChatIntegration::Provider::WebexProvider dostub1 = stub_request(:post, chan1.data["webhook_url"]).to_return(status: 400, body: "{}")expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/zulip/zulip_provider_spec.rb b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/zulip/zulip_provider_spec.rbindex e66697076f4..d33cdda4d54 100644--- a/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/zulip/zulip_provider_spec.rb+++ b/plugins/discourse-chat-integration/spec/lib/discourse_chat_integration/provider/zulip/zulip_provider_spec.rb@@ -35,7 +35,7 @@ RSpec.describe DiscourseChatIntegration::Provider::ZulipProvider do)expect(stub1).to have_been_requested.times(0)expect { described_class.trigger_notification(post, chan1, nil) }.to raise_exception(- ::DiscourseChatIntegration::ProviderError,+ DiscourseChatIntegration::ProviderError,)expect(stub1).to have_been_requested.onceenddiff --git a/plugins/discourse-chat-integration/spec/services/manager_spec.rb b/plugins/discourse-chat-integration/spec/services/manager_spec.rbindex 92a21467e81..ed038859ab5 100644--- a/plugins/discourse-chat-integration/spec/services/manager_spec.rb+++ b/plugins/discourse-chat-integration/spec/services/manager_spec.rb@@ -4,7 +4,8 @@ require_dependency "post_creator"require_relative "../dummy_provider"RSpec.describe DiscourseChatIntegration::Manager do- let(:manager) { ::DiscourseChatIntegration::Manager }+ subject(:manager) { described_class }+let(:category) { Fabricate(:category) }let(:group) { Fabricate(:group) }let(:group2) { Fabricate(:group) }diff --git a/plugins/discourse-chat-integration/spec/system/create_channel_spec.rb b/plugins/discourse-chat-integration/spec/system/create_channel_spec.rbindex 80689b39cee..6102aa682a9 100644--- a/plugins/discourse-chat-integration/spec/system/create_channel_spec.rb+++ b/plugins/discourse-chat-integration/spec/system/create_channel_spec.rb@@ -5,7 +5,7 @@ RSpec.describe "Create channel", type: :system dofab!(:admin)include_context "with dummy provider"- let(:manager) { ::DiscourseChatIntegration::Manager }+ let(:manager) { DiscourseChatIntegration::Manager }let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: "dummy") }let(:category) { Fabricate(:category) }let(:topic) { Fabricate(:topic, category_id: category.id) }diff --git a/plugins/discourse-data-explorer/app/controllers/discourse_data_explorer/query_controller.rb b/plugins/discourse-data-explorer/app/controllers/discourse_data_explorer/query_controller.rbindex 0092822e3cc..dc0fc1fc08f 100644--- a/plugins/discourse-data-explorer/app/controllers/discourse_data_explorer/query_controller.rb+++ b/plugins/discourse-data-explorer/app/controllers/discourse_data_explorer/query_controller.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryController < ApplicationControllerrequires_plugin PLUGIN_NAMEdiff --git a/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query.rb b/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query.rbindex bf23fb9a02d..253a62095d6 100644--- a/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query.rb+++ b/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryFinderdef self.find(id)default_query = Queries.default[id.to_s]diff --git a/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query_group.rb b/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query_group.rbindex b261f1448ac..c3e87fd8b08 100644--- a/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query_group.rb+++ b/plugins/discourse-data-explorer/app/models/discourse_data_explorer/query_group.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryGroup < ActiveRecord::Baseself.table_name = "data_explorer_query_groups"diff --git a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_details_serializer.rb b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_details_serializer.rbindex d211777b9a0..8abb2eabd4a 100644--- a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_details_serializer.rb+++ b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_details_serializer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryDetailsSerializer < QuerySerializerattributes :sql, :param_info, :created_at, :hiddendiff --git a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rb b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rbindex 3e45f70f4a2..eee3f7de03c 100644--- a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rb+++ b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_bookmark_serializer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryGroupBookmarkSerializer < UserBookmarkBaseSerializerdef titlefancy_titlediff --git a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_serializer.rb b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_serializer.rbindex a99c26d66d7..882bdf4dfaf 100644--- a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_serializer.rb+++ b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_group_serializer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryGroupSerializer < ActiveModel::Serializerattributes :id, :group_id, :query_id, :bookmarkdiff --git a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_serializer.rb b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_serializer.rbindex 724e2556ea7..0ba23d5386a 100644--- a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_serializer.rb+++ b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/query_serializer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QuerySerializer < ActiveModel::Serializerattributes :id, :name, :description, :username, :group_ids, :last_run_at, :user_iddiff --git a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/small_post_with_excerpt_serializer.rb b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/small_post_with_excerpt_serializer.rbindex 1663de4d3c5..9b5a5247700 100644--- a/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/small_post_with_excerpt_serializer.rb+++ b/plugins/discourse-data-explorer/app/serializers/discourse_data_explorer/small_post_with_excerpt_serializer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass SmallPostWithExcerptSerializer < ApplicationSerializerattributes :id, :topic_id, :post_number, :excerpt, :username, :avatar_templatediff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/data_explorer.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/data_explorer.rbindex ff43fa5da23..73ba38d9c53 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/data_explorer.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/data_explorer.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorermodule DataExplorer# Used for ftype calls, see https://www.rubydoc.info/gems/pg/0.17.1/PG%2FResult:ftype# and /usr/include/postgresql/server/catalog/pg_type_d.hdiff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/engine.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/engine.rbindex 0b423308efb..ed13993aa9c 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/engine.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseDataExplorerdiff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/parameter.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/parameter.rbindex 961962531c4..f8b3d77b1d3 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/parameter.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/parameter.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass Parameterattr_accessor :identifier, :type, :default, :nullablediff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/queries.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/queries.rbindex 2849aa65d0f..d5860d58be8 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/queries.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/queries.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass Queriesdef self.default# WARNING: Edit the query hash carefullydiff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/query_group_bookmarkable.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/query_group_bookmarkable.rbindex b63d86f3efa..fc7e9eacf54 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/query_group_bookmarkable.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/query_group_bookmarkable.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass QueryGroupBookmarkable < BaseBookmarkabledef self.modelQueryGroupdiff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rbindex a518b1422d4..e6459006ed5 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/report_generator.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass ReportGeneratordef self.generate(query_id, query_params, recipients, opts = {})query = DiscourseDataExplorer::Query.find(query_id)diff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_format_converter.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_format_converter.rbindex 258f07fbabd..be2ecd267f2 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_format_converter.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_format_converter.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass ResultFormatConverterdef self.convert(file_type, result, opts = {})self.new(result, opts).send("to_#{file_type}")diff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_to_markdown.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_to_markdown.rbindex bc4acd778d5..44e00179576 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_to_markdown.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/result_to_markdown.rb@@ -2,7 +2,7 @@include HasSanitizableFields-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass ResultToMarkdowndef self.convert(pg_result, render_url_columns = false)relations, colrender = DataExplorer.add_extra_data(pg_result)diff --git a/plugins/discourse-data-explorer/lib/discourse_data_explorer/validation_error.rb b/plugins/discourse-data-explorer/lib/discourse_data_explorer/validation_error.rbindex ba15df8d63c..defd2f07aa8 100644--- a/plugins/discourse-data-explorer/lib/discourse_data_explorer/validation_error.rb+++ b/plugins/discourse-data-explorer/lib/discourse_data_explorer/validation_error.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseDataExplorer+module DiscourseDataExplorerclass ValidationError < StandardErrorendenddiff --git a/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb b/plugins/discourse-data-explorer/spec/lib/parameter_spec.rbindex ea300038b63..c639f833f7d 100644--- a/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb+++ b/plugins/discourse-data-explorer/spec/lib/parameter_spec.rb@@ -12,7 +12,7 @@ RSpec.describe DiscourseDataExplorer::Parameter doit "raises error for not-nullable blank string" doexpect { param("param123", :string, nil, false).cast_to_ruby("") }.to raise_error(- ::DiscourseDataExplorer::ValidationError,+ DiscourseDataExplorer::ValidationError,)end@@ -21,7 +21,7 @@ RSpec.describe DiscourseDataExplorer::Parameter doit "raises an error if not a double" doexpect { double_param.cast_to_ruby("abcd") }.to raise_error(- ::DiscourseDataExplorer::ValidationError,+ DiscourseDataExplorer::ValidationError,)end@@ -61,7 +61,7 @@ RSpec.describe DiscourseDataExplorer::Parameter doit "raises an error if no such post exists" dopost.destroyexpect { param("post_id", :post_id, nil, false).cast_to_ruby(post.url) }.to raise_error(- ::DiscourseDataExplorer::ValidationError,+ DiscourseDataExplorer::ValidationError,)endend@@ -69,7 +69,7 @@ RSpec.describe DiscourseDataExplorer::Parameter docontext "when the value provided is an integer" doit "raises an error if no such post exists" doexpect { param("post_id", :post_id, nil, false).cast_to_ruby("-999") }.to raise_error(- ::DiscourseDataExplorer::ValidationError,+ DiscourseDataExplorer::ValidationError,)end@@ -85,7 +85,7 @@ RSpec.describe DiscourseDataExplorer::Parameter docontext "when the value provided is an integer" doit "raises an error if no such group exists" doexpect { param("group_id", :group_id, nil, false).cast_to_ruby("-999") }.to raise_error(- ::DiscourseDataExplorer::ValidationError,+ DiscourseDataExplorer::ValidationError,)end@@ -102,10 +102,10 @@ RSpec.describe DiscourseDataExplorer::Parameter doit "raises an error if no such user exists" doexpect {param("user_id", :user_id, nil, false).cast_to_ruby("user_not_exist")- }.to raise_error(::DiscourseDataExplorer::ValidationError)+ }.to raise_error(DiscourseDataExplorer::ValidationError)expect {param("user_id", :user_id, nil, false).cast_to_ruby("[email protected]")- }.to raise_error(::DiscourseDataExplorer::ValidationError)+ }.to raise_error(DiscourseDataExplorer::ValidationError)endit "returns the user id if the user exists" dodiff --git a/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb b/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rbindex fa043522d62..6b6867e86b6 100644--- a/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb+++ b/plugins/discourse-data-explorer/spec/requests/query_controller_spec.rb@@ -311,7 +311,7 @@ describe DiscourseDataExplorer::QueryController do# Manual Test - change out the following line:#- # module ::DiscourseDataExplorer+ # module DiscourseDataExplorer# def self.run_query(...)# if query.sql =~ /;/#diff --git a/plugins/discourse-data-explorer/spec/system/param_input_spec.rb b/plugins/discourse-data-explorer/spec/system/param_input_spec.rbindex b25c0625cec..67ebff2c8dc 100644--- a/plugins/discourse-data-explorer/spec/system/param_input_spec.rb+++ b/plugins/discourse-data-explorer/spec/system/param_input_spec.rb@@ -64,7 +64,7 @@ RSpec.describe "Param input", type: :system doit "correctly displays parameter input boxes" dovisit("/admin/plugins/explorer/queries/#{all_params_query.id}")- ::DiscourseDataExplorer::Parameter+ DiscourseDataExplorer::Parameter.create_from_sql(ALL_PARAMS_SQL).each do |param|expect(page).to have_css(".query-params .param [name=\"#{param.identifier}\"]")diff --git a/plugins/discourse-gamification/app/controllers/discourse_gamification/gamification_leaderboard_controller.rb b/plugins/discourse-gamification/app/controllers/discourse_gamification/gamification_leaderboard_controller.rbindex eb9ea6406f2..f7afd831df9 100644--- a/plugins/discourse-gamification/app/controllers/discourse_gamification/gamification_leaderboard_controller.rb+++ b/plugins/discourse-gamification/app/controllers/discourse_gamification/gamification_leaderboard_controller.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass GamificationLeaderboardController < ::ApplicationControllerrequires_plugin PLUGIN_NAMEdiff --git a/plugins/discourse-gamification/app/models/discourse_gamification/deleted_gamification_leaderboard.rb b/plugins/discourse-gamification/app/models/discourse_gamification/deleted_gamification_leaderboard.rbindex e4ca5b5a503..f9da41a2578 100644--- a/plugins/discourse-gamification/app/models/discourse_gamification/deleted_gamification_leaderboard.rb+++ b/plugins/discourse-gamification/app/models/discourse_gamification/deleted_gamification_leaderboard.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass DeletedGamificationLeaderboardattr_reader :iddiff --git a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_leaderboard.rb b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_leaderboard.rbindex 8e901718b5a..8c5f376a890 100644--- a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_leaderboard.rb+++ b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_leaderboard.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass GamificationLeaderboard < ::ActiveRecord::BasePAGE_SIZE = 100diff --git a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score.rb b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score.rbindex f8b84a1bb6b..f9040bb7876 100644--- a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score.rb+++ b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass GamificationScore < ::ActiveRecord::Baseself.table_name = "gamification_scores"diff --git a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score_event.rb b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score_event.rbindex 3bd0d2d5ee9..83bc1a22626 100644--- a/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score_event.rb+++ b/plugins/discourse-gamification/app/models/discourse_gamification/gamification_score_event.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass GamificationScoreEvent < ::ActiveRecord::Baseself.table_name = "gamification_score_events"diff --git a/plugins/discourse-gamification/config/routes.rb b/plugins/discourse-gamification/config/routes.rbindex a13bdc7af76..871d70eed7a 100644--- a/plugins/discourse-gamification/config/routes.rb+++ b/plugins/discourse-gamification/config/routes.rb@@ -6,7 +6,7 @@ DiscourseGamification::Engine.routes.draw doendDiscourse::Application.routes.draw do- mount ::DiscourseGamification::Engine, at: "/leaderboard"+ mount DiscourseGamification::Engine, at: "/leaderboard"scope "/admin/plugins/discourse-gamification", constraints: StaffConstraint.new doget "/leaderboards" => "discourse_gamification/admin_gamification_leaderboard#index"diff --git a/plugins/discourse-gamification/lib/discourse_gamification/directory_integration.rb b/plugins/discourse-gamification/lib/discourse_gamification/directory_integration.rbindex 6f172eb3524..4afb53748c6 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/directory_integration.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/directory_integration.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass DirectoryIntegrationdef self.query<<~SQLdiff --git a/plugins/discourse-gamification/lib/discourse_gamification/engine.rb b/plugins/discourse-gamification/lib/discourse_gamification/engine.rbindex 4aa3b4ed3d7..b9295750832 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/engine.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseGamificationdiff --git a/plugins/discourse-gamification/lib/discourse_gamification/guardian_extension.rb b/plugins/discourse-gamification/lib/discourse_gamification/guardian_extension.rbindex 8bb66a05e4c..4b938e1d924 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/guardian_extension.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/guardian_extension.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationmodule GuardianExtensiondef can_see_leaderboard?(leaderboard)return true if leaderboard.visible_to_groups_ids.empty?diff --git a/plugins/discourse-gamification/lib/discourse_gamification/leaderboard_cached_view.rb b/plugins/discourse-gamification/lib/discourse_gamification/leaderboard_cached_view.rbindex 12e9b05bbc7..e3cce21a91f 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/leaderboard_cached_view.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/leaderboard_cached_view.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass LeaderboardCachedViewclass NotReadyError < StandardErrorend@@ -142,7 +142,7 @@ module ::DiscourseGamificationu.staged = FALSEANDu.active- AND+ AND(u.suspended_till IS NULL OR u.suspended_till < CURRENT_TIMESTAMP)ANDu.id > 0diff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_message_created.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_message_created.rbindex edec45dc02a..fd1e8c98b0e 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_message_created.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_message_created.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass ChatMessageCreated < Scorabledef self.enabled?SiteSetting.chat_enabled && score_multiplier > 0diff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_given.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_given.rbindex 490fa5681e7..fa9648f120c 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_given.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_given.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass ChatReactionGiven < Scorabledef self.enabled?SiteSetting.chat_enabled && score_multiplier > 0diff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_received.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_received.rbindex 458b3e82592..20f3a92e4ae 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_received.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/chat_reaction_received.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass ChatReactionReceived < Scorabledef self.enabled?SiteSetting.chat_enabled && score_multiplier > 0diff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/day_visited.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/day_visited.rbindex 77547f4efb9..dab6a175780 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/day_visited.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/day_visited.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass DayVisited < Scorabledef self.score_multiplierSiteSetting.day_visited_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/flag_created.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/flag_created.rbindex d782411c094..111a295fa5f 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/flag_created.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/flag_created.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass FlagCreated < Scorabledef self.score_multiplierSiteSetting.flag_created_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_given.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_given.rbindex 1ee4ad1aadd..4f44e310fda 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_given.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_given.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass LikeGiven < Scorabledef self.score_multiplierSiteSetting.like_given_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_received.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_received.rbindex 9c66ee2d0d8..021d855a2c9 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_received.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/like_received.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass LikeReceived < Scorabledef self.score_multiplierSiteSetting.like_received_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_created.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_created.rbindex 463799bcf31..d47f1703e93 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_created.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_created.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass PostCreated < Scorabledef self.score_multiplierSiteSetting.post_created_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_read.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_read.rbindex 61951141848..fa3732e0215 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_read.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/post_read.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass PostRead < Scorabledef self.score_multiplierSiteSetting.post_read_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_given.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_given.rbindex abad6606f16..14a54de55a3 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_given.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_given.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass ReactionGiven < Scorabledef self.enabled?- defined?(::DiscourseReactions) && SiteSetting.discourse_reactions_enabled &&+ defined?(DiscourseReactions) && SiteSetting.discourse_reactions_enabled &&score_multiplier > 0enddiff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_received.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_received.rbindex f906d034e62..9250193adc7 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_received.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/reaction_received.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass ReactionReceived < Scorabledef self.enabled?- defined?(::DiscourseReactions) && SiteSetting.discourse_reactions_enabled &&+ defined?(DiscourseReactions) && SiteSetting.discourse_reactions_enabled &&score_multiplier > 0enddiff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/scorable.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/scorable.rbindex 292e377efb5..6ef263a89e4 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/scorable.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/scorable.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass Scorableclass << selfdef enabled?diff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/solutions.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/solutions.rbindex 87a084bb613..252c6d2de8c 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/solutions.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/solutions.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass Solutions < Scorabledef self.enabled?defined?(DiscourseSolved) && SiteSetting.solved_enabled && superdiff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/time_read.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/time_read.rbindex a639f7855a9..23bb94071d0 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/time_read.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/time_read.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass TimeRead < Scorabledef self.score_multiplierSiteSetting.time_read_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/topic_created.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/topic_created.rbindex d40cf3d4bde..9388043ed8f 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/topic_created.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/topic_created.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass TopicCreated < Scorabledef self.score_multiplierSiteSetting.topic_created_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/scorables/user_invited.rb b/plugins/discourse-gamification/lib/discourse_gamification/scorables/user_invited.rbindex 85e138e1c72..61a55b87828 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/scorables/user_invited.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/scorables/user_invited.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationclass UserInvited < Scorabledef self.score_multiplierSiteSetting.user_invited_score_valuediff --git a/plugins/discourse-gamification/lib/discourse_gamification/user_extension.rb b/plugins/discourse-gamification/lib/discourse_gamification/user_extension.rbindex bc88bf5be9e..232762683fe 100644--- a/plugins/discourse-gamification/lib/discourse_gamification/user_extension.rb+++ b/plugins/discourse-gamification/lib/discourse_gamification/user_extension.rb@@ -1,12 +1,12 @@# frozen_string_literal: true-module ::DiscourseGamification+module DiscourseGamificationmodule UserExtensionextend ActiveSupport::Concernprepended dohas_many :gamification_scores,- class_name: "::DiscourseGamification::GamificationScore",+ class_name: "DiscourseGamification::GamificationScore",dependent: :destroyenddiff --git a/plugins/discourse-gamification/spec/fabricators/gamification_leaderboard.rb b/plugins/discourse-gamification/spec/fabricators/gamification_leaderboard.rbindex 74399753205..800cefed080 100644--- a/plugins/discourse-gamification/spec/fabricators/gamification_leaderboard.rb+++ b/plugins/discourse-gamification/spec/fabricators/gamification_leaderboard.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-Fabricator(:gamification_leaderboard, from: ::DiscourseGamification::GamificationLeaderboard) do+Fabricator(:gamification_leaderboard, from: DiscourseGamification::GamificationLeaderboard) doname { sequence(:name) { |i| "leaderboard#{i + 1}" } }created_by_id { Fabricate(:user).id }from_date { nil }diff --git a/plugins/discourse-gamification/spec/fabricators/gamification_score.rb b/plugins/discourse-gamification/spec/fabricators/gamification_score.rbindex d545b771af3..57d9226ae40 100644--- a/plugins/discourse-gamification/spec/fabricators/gamification_score.rb+++ b/plugins/discourse-gamification/spec/fabricators/gamification_score.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-Fabricator(:gamification_score, from: ::DiscourseGamification::GamificationScore) do+Fabricator(:gamification_score, from: DiscourseGamification::GamificationScore) douser_id { Fabricate(:user).id }score { 0 }date { Date.today }diff --git a/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb b/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rbindex 1686e8bc72f..a7b918fefac 100755--- a/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb+++ b/plugins/discourse-gamification/spec/lib/scorables/shared_scorables_spec.rb@@ -81,7 +81,7 @@ RSpec.shared_examples "No Score Value" doendend-RSpec.describe ::DiscourseGamification::LikeReceived do+RSpec.describe DiscourseGamification::LikeReceived doit_behaves_like "Scorable Type" dobefore doFabricate.times(10, :post, user: current_user)@@ -118,7 +118,7 @@ RSpec.describe ::DiscourseGamification::LikeReceived doendend-RSpec.describe ::DiscourseGamification::LikeGiven do+RSpec.describe DiscourseGamification::LikeGiven doit_behaves_like "Scorable Type" dobefore doFabricate.times(10, :post, user: other_user)@@ -161,7 +161,7 @@ RSpec.describe ::DiscourseGamification::LikeGiven doendend-RSpec.describe ::DiscourseGamification::PostCreated do+RSpec.describe DiscourseGamification::PostCreated doit_behaves_like "Scorable Type" dobefore doFabricate.times(2, :post, user: current_user, post_number: 2)@@ -212,7 +212,7 @@ RSpec.describe ::DiscourseGamification::PostCreated doendend-RSpec.describe ::DiscourseGamification::DayVisited do+RSpec.describe DiscourseGamification::DayVisited doit_behaves_like "Scorable Type" dobefore do(Date.new(2022, 01, 01)..Date.new(2022, 01, 30)).each do |date|@@ -225,7 +225,7 @@ RSpec.describe ::DiscourseGamification::DayVisited doendend-RSpec.describe ::DiscourseGamification::PostRead do+RSpec.describe DiscourseGamification::PostRead doit_behaves_like "Scorable Type" dobefore do(Date.new(2022, 01, 01)..Date.new(2022, 01, 30)).each do |date|@@ -238,7 +238,7 @@ RSpec.describe ::DiscourseGamification::PostRead doendend-RSpec.describe ::DiscourseGamification::TimeRead do+RSpec.describe DiscourseGamification::TimeRead doit_behaves_like "Scorable Type" dobefore do(Date.new(2022, 01, 01)..Date.new(2022, 01, 30)).each do |date|@@ -251,7 +251,7 @@ RSpec.describe ::DiscourseGamification::TimeRead doendend-RSpec.describe ::DiscourseGamification::FlagCreated do+RSpec.describe DiscourseGamification::FlagCreated doit_behaves_like "Scorable Type" dobefore doFabricate.times(10, :reviewable, created_by: current_user) do@@ -264,7 +264,7 @@ RSpec.describe ::DiscourseGamification::FlagCreated doendend-RSpec.describe ::DiscourseGamification::TopicCreated do+RSpec.describe DiscourseGamification::TopicCreated doit_behaves_like "Scorable Type" dobefore { Fabricate.times(10, :topic, user: current_user) }@@ -287,7 +287,7 @@ RSpec.describe ::DiscourseGamification::TopicCreated doendend-RSpec.describe ::DiscourseGamification::UserInvited do+RSpec.describe DiscourseGamification::UserInvited doit_behaves_like "Scorable Type" dobefore dostub_request(@@ -310,7 +310,7 @@ RSpec.describe ::DiscourseGamification::UserInvited doendend-RSpec.describe ::DiscourseGamification::ChatReactionReceived do+RSpec.describe DiscourseGamification::ChatReactionReceived doit_behaves_like "Scorable Type" dobefore doFabricate.times(10, :chat_message, user: current_user)@@ -336,7 +336,7 @@ RSpec.describe ::DiscourseGamification::ChatReactionReceived doendend-RSpec.describe ::DiscourseGamification::ChatReactionGiven do+RSpec.describe DiscourseGamification::ChatReactionGiven doit_behaves_like "Scorable Type" dobefore doFabricate.times(10, :chat_message, user: other_user)@@ -368,7 +368,7 @@ RSpec.describe ::DiscourseGamification::ChatReactionGiven doendend-RSpec.describe ::DiscourseGamification::ChatMessageCreated do+RSpec.describe DiscourseGamification::ChatMessageCreated doit_behaves_like "Scorable Type" dobefore { Fabricate.times(10, :chat_message, user: current_user) }diff --git a/plugins/discourse-gamification/spec/plugin_spec.rb b/plugins/discourse-gamification/spec/plugin_spec.rbindex 624b59929e3..8cf43b7cae2 100644--- a/plugins/discourse-gamification/spec/plugin_spec.rb+++ b/plugins/discourse-gamification/spec/plugin_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-describe ::DiscourseGamification do+describe DiscourseGamification dolet(:user) { Fabricate(:user) }let!(:gamification_score) { Fabricate(:gamification_score, user_id: user.id) }@@ -21,7 +21,7 @@ describe ::DiscourseGamification doendend-describe ::DiscourseGamification do+describe DiscourseGamification dolet(:guardian) { Guardian.new }let!(:default_gamification_leaderboard) { Fabricate(:gamification_leaderboard) }diff --git a/plugins/discourse-gamification/spec/system/admin_leaderboards_spec.rb b/plugins/discourse-gamification/spec/system/admin_leaderboards_spec.rbindex ccbb1900541..d721f03b69e 100644--- a/plugins/discourse-gamification/spec/system/admin_leaderboards_spec.rb+++ b/plugins/discourse-gamification/spec/system/admin_leaderboards_spec.rb@@ -34,7 +34,7 @@ describe "Admin leaderboards", type: :system doexpect(page).to have_content(I18n.t("js.gamification.leaderboard.save_success"))- expect(::DiscourseGamification::GamificationLeaderboard.last).to have_attributes(+ expect(DiscourseGamification::GamificationLeaderboard.last).to have_attributes(name: "My leaderboard",from_date: 12.months.ago.end_of_month.to_date,to_date: 11.months.ago.end_of_month.to_date,@@ -67,7 +67,7 @@ describe "Admin leaderboards", type: :system dodialog.click_dangerexpect(page).to have_content(I18n.t("js.gamification.leaderboard.delete_success"))- expect(::DiscourseGamification::GamificationLeaderboard.exists?(leaderboard.id)).to eq(false)+ expect(DiscourseGamification::GamificationLeaderboard.exists?(leaderboard.id)).to eq(false)endendenddiff --git a/plugins/discourse-github/app/lib/github_permalinks.rb b/plugins/discourse-github/app/lib/github_permalinks.rbindex 5d9bcf3d9a4..70b931b5de6 100644--- a/plugins/discourse-github/app/lib/github_permalinks.rb+++ b/plugins/discourse-github/app/lib/github_permalinks.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::GithubPermalinks+module GithubPermalinksdef self.replace_github_non_permalinks(post)# replaces github non-permalinks with permalinks containing a specific commit idregex = %r{https?://github\.com/[^/]+/[^/\s]+/blob/[^\s]+}idiff --git a/plugins/discourse-graphviz/plugin.rb b/plugins/discourse-graphviz/plugin.rbindex cd6d9a7b2f8..fc19d1b7bdd 100644--- a/plugins/discourse-graphviz/plugin.rb+++ b/plugins/discourse-graphviz/plugin.rb@@ -11,22 +11,20 @@ enabled_site_setting :discourse_graphviz_enabledregister_asset "stylesheets/common/graphviz.scss"-after_initialize do- module DiscourseGraphviz- class << self- def context- context = MiniRacer::Context.new- context.load("#{Rails.root}/plugins/discourse-graphviz/public/javascripts/viz-3.0.1.js")- context- end+module ::DiscourseGraphviz+ def self.context+ context = MiniRacer::Context.new+ context.load("#{Rails.root}/plugins/discourse-graphviz/public/javascripts/viz-3.0.1.js")+ context+ end- def allowed_svg_xpath- @@allowed_svg_xpath ||=- "//*[#{UploadCreator::ALLOWED_SVG_ELEMENTS.map { |e| "name()!='#{e}'" }.join(" and ")}]"- end- end+ def self.allowed_svg_xpath+ @@allowed_svg_xpath ||=+ "//*[#{UploadCreator::ALLOWED_SVG_ELEMENTS.map { |e| "name()!='#{e}'" }.join(" and ")}]"end+end+after_initialize doon(:before_post_process_cooked) do |doc, post|if SiteSetting.discourse_graphviz_enableddocdiff --git a/plugins/discourse-hcaptcha/app/controllers/discourse_hcaptcha/hcaptcha_controller.rb b/plugins/discourse-hcaptcha/app/controllers/discourse_hcaptcha/hcaptcha_controller.rbindex eda834ec03e..0c35a0266c6 100644--- a/plugins/discourse-hcaptcha/app/controllers/discourse_hcaptcha/hcaptcha_controller.rb+++ b/plugins/discourse-hcaptcha/app/controllers/discourse_hcaptcha/hcaptcha_controller.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::DiscourseHcaptcha+module DiscourseHcaptchaclass HcaptchaController < ::ApplicationController- requires_plugin DiscourseHcaptcha::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_configskip_before_action :redirect_to_login_if_requireddiff --git a/plugins/discourse-hcaptcha/config/routes.rb b/plugins/discourse-hcaptcha/config/routes.rbindex c99a7736cb9..47fe13566e2 100644--- a/plugins/discourse-hcaptcha/config/routes.rb+++ b/plugins/discourse-hcaptcha/config/routes.rb@@ -1,5 +1,5 @@# frozen_string_literal: true-Discourse::Application.routes.draw { mount ::DiscourseHcaptcha::Engine, at: "hcaptcha" }+Discourse::Application.routes.draw { mount DiscourseHcaptcha::Engine, at: "hcaptcha" }DiscourseHcaptcha::Engine.routes.draw { post "/create" => "hcaptcha#create" }diff --git a/plugins/discourse-hcaptcha/lib/discourse_hcaptcha/engine.rb b/plugins/discourse-hcaptcha/lib/discourse_hcaptcha/engine.rbindex a099a7730f5..af574807c34 100644--- a/plugins/discourse-hcaptcha/lib/discourse_hcaptcha/engine.rb+++ b/plugins/discourse-hcaptcha/lib/discourse_hcaptcha/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseHcaptcha+module DiscourseHcaptchaclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseHcaptchadiff --git a/plugins/discourse-lazy-videos/plugin.rb b/plugins/discourse-lazy-videos/plugin.rbindex 98d93219965..49a8d489aa9 100644--- a/plugins/discourse-lazy-videos/plugin.rb+++ b/plugins/discourse-lazy-videos/plugin.rb@@ -10,6 +10,9 @@ enabled_site_setting :lazy_videos_enabledregister_asset "stylesheets/lazy-videos.scss"+module ::DiscourseLazyVideos+end+require_relative "lib/discourse_lazy_videos/lazy_youtube"require_relative "lib/discourse_lazy_videos/lazy_vimeo"require_relative "lib/discourse_lazy_videos/lazy_tiktok"diff --git a/plugins/discourse-local-dates/lib/discourse_local_dates/engine.rb b/plugins/discourse-local-dates/lib/discourse_local_dates/engine.rbindex 2eac83b876f..946d00cb3d6 100644--- a/plugins/discourse-local-dates/lib/discourse_local_dates/engine.rb+++ b/plugins/discourse-local-dates/lib/discourse_local_dates/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseLocalDates+module DiscourseLocalDatesclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseLocalDatesdiff --git a/plugins/discourse-local-dates/plugin.rb b/plugins/discourse-local-dates/plugin.rbindex 6dad2042cfa..e90fed1af92 100644--- a/plugins/discourse-local-dates/plugin.rb+++ b/plugins/discourse-local-dates/plugin.rb@@ -11,12 +11,12 @@ register_asset "moment-timezone.js", :vendored_core_pretty_textenabled_site_setting :discourse_local_dates_enabled-after_initialize do- module ::DiscourseLocalDates- PLUGIN_NAME = "discourse-local-dates".freeze- POST_CUSTOM_FIELD = "local_dates".freeze- end+module ::DiscourseLocalDates+ PLUGIN_NAME = "discourse-local-dates".freeze+ POST_CUSTOM_FIELD = "local_dates".freeze+end+after_initialize dorequire_relative "lib/discourse_local_dates/engine"register_post_custom_field_type(DiscourseLocalDates::POST_CUSTOM_FIELD, :json)diff --git a/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb b/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rbindex 6a458e07c05..aad37df3305 100644--- a/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb+++ b/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-class ::DiscourseLti::LtiAuthenticator < Auth::ManagedAuthenticator+class DiscourseLti::LtiAuthenticator < Auth::ManagedAuthenticatordef name"lti"end@@ -24,7 +24,7 @@ class ::DiscourseLti::LtiAuthenticator < Auth::ManagedAuthenticatorenddef register_middleware(omniauth)- omniauth.provider ::DiscourseLti::LtiOmniauthStrategy,+ omniauth.provider DiscourseLti::LtiOmniauthStrategy,name: :lti,setup:lambda { |env|diff --git a/plugins/discourse-lti/plugin.rb b/plugins/discourse-lti/plugin.rbindex fa4e038592a..4546e2afbd3 100644--- a/plugins/discourse-lti/plugin.rb+++ b/plugins/discourse-lti/plugin.rb@@ -33,11 +33,11 @@ after_initialize do)next if uaa.nil?- custom_data = uaa.extra.dig("raw_info", ::DiscourseLti::CUSTOM_DATA_CLAIM)+ custom_data = uaa.extra.dig("raw_info", DiscourseLti::CUSTOM_DATA_CLAIM)next if custom_data.nil?invite = nil- ::DiscourseLti::DISCOURSE_INVITE_KEYS.each { |k| break if invite = custom_data[k] }+ DiscourseLti::DISCOURSE_INVITE_KEYS.each { |k| break if invite = custom_data[k] }next if invite.nil?parsed =@@ -58,12 +58,12 @@ after_initialize doon(:after_auth) do |authenticator, auth_result, session, cookies|next if !(authenticator.name.to_sym == :lti)if !auth_result.user && cookies["_t"] # User (probably) already logged in- raise ::DiscourseLti::ShouldReconnect.new+ raise DiscourseLti::ShouldReconnect.newendendreloadable_patch do- ::Users::OmniauthCallbacksController.rescue_from(::DiscourseLti::ShouldReconnect) do+ ::Users::OmniauthCallbacksController.rescue_from(DiscourseLti::ShouldReconnect) dosession[:auth_reconnect] = truecompleteend@@ -73,4 +73,4 @@ endrequire_relative "lib/discourse_lti/lti_omniauth_strategy"require_relative "lib/discourse_lti/lti_authenticator"-auth_provider authenticator: ::DiscourseLti::LtiAuthenticator.new+auth_provider authenticator: DiscourseLti::LtiAuthenticator.newdiff --git a/plugins/discourse-math/plugin.rb b/plugins/discourse-math/plugin.rbindex 3b09b8f83ed..85943751cc0 100644--- a/plugins/discourse-math/plugin.rb+++ b/plugins/discourse-math/plugin.rb@@ -12,6 +12,9 @@ register_asset "stylesheets/ext/discourse-chat.scss"enabled_site_setting :discourse_math_enabled+module ::DiscourseMath+end+after_initialize doif respond_to?(:chat) && SiteSetting.chat_enabledchat&.enable_markdown_feature("discourse-math")diff --git a/plugins/discourse-narrative-bot/app/controllers/discourse_narrative_bot/certificates_controller.rb b/plugins/discourse-narrative-bot/app/controllers/discourse_narrative_bot/certificates_controller.rbindex fc2043c49bb..bcff16bf3d2 100644--- a/plugins/discourse-narrative-bot/app/controllers/discourse_narrative_bot/certificates_controller.rb+++ b/plugins/discourse-narrative-bot/app/controllers/discourse_narrative_bot/certificates_controller.rb@@ -2,7 +2,7 @@module DiscourseNarrativeBotclass CertificatesController < ::ApplicationController- requires_plugin DiscourseNarrativeBot::PLUGIN_NAME+ requires_plugin PLUGIN_NAMElayout falseskip_before_action :check_xhrrequires_logindiff --git a/plugins/discourse-narrative-bot/app/jobs/regular/bot_input.rb b/plugins/discourse-narrative-bot/app/jobs/regular/bot_input.rbindex 9cfb0b4079e..36bcba06ee8 100644--- a/plugins/discourse-narrative-bot/app/jobs/regular/bot_input.rb+++ b/plugins/discourse-narrative-bot/app/jobs/regular/bot_input.rb@@ -8,7 +8,7 @@ module Jobsreturn unless user = User.find_by(id: args[:user_id])I18n.with_locale(user.effective_locale) do- ::DiscourseNarrativeBot::TrackSelector.new(+ DiscourseNarrativeBot::TrackSelector.new(args[:input].to_sym,user,post_id: args[:post_id],diff --git a/plugins/discourse-narrative-bot/app/jobs/regular/send_default_welcome_message.rb b/plugins/discourse-narrative-bot/app/jobs/regular/send_default_welcome_message.rbindex 078ee7b06d2..3b179e67805 100644--- a/plugins/discourse-narrative-bot/app/jobs/regular/send_default_welcome_message.rb+++ b/plugins/discourse-narrative-bot/app/jobs/regular/send_default_welcome_message.rb@@ -9,7 +9,7 @@ module Jobstitle = I18n.t("system_messages.#{type}.subject_template", params)raw = I18n.t("system_messages.#{type}.text_body_template", params)- discobot_user = ::DiscourseNarrativeBot::Base.new.discobot_user+ discobot_user = DiscourseNarrativeBot::Base.new.discobot_userpost =PostCreator.create!(diff --git a/plugins/discourse-narrative-bot/config/routes.rb b/plugins/discourse-narrative-bot/config/routes.rbindex 65e512d23ec..e5e93384a3a 100644--- a/plugins/discourse-narrative-bot/config/routes.rb+++ b/plugins/discourse-narrative-bot/config/routes.rb@@ -4,4 +4,4 @@ DiscourseNarrativeBot::Engine.routes.draw doget "/certificate" => "certificates#generate", :format => :svgend-Discourse::Application.routes.draw { mount ::DiscourseNarrativeBot::Engine, at: "/discobot" }+Discourse::Application.routes.draw { mount DiscourseNarrativeBot::Engine, at: "/discobot" }diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rbindex 0d485417e48..7e761eb99cf 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/certificate_generator.rb@@ -18,7 +18,7 @@ module DiscourseNarrativeBotend@date = I18n.l(date, format: :date_only)- @discobot_user = ::DiscourseNarrativeBot::Base.new.discobot_user+ @discobot_user = DiscourseNarrativeBot::Base.new.discobot_userenddef new_user_trackdiff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rbindex 0e96a6bcb62..30675c06f4b 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/post_guardian_extension.rb@@ -10,7 +10,7 @@ module DiscourseNarrativeBotdef can_create_post?(parent)if SiteSetting.discourse_narrative_bot_enabled &&parent.try(:subtype) == "system_message" &&- parent.try(:user) == ::DiscourseNarrativeBot::Base.new.discobot_user+ parent.try(:user) == DiscourseNarrativeBot::Base.new.discobot_userreturn trueenddiff --git a/plugins/discourse-narrative-bot/plugin.rb b/plugins/discourse-narrative-bot/plugin.rbindex 1a04596b53e..99d4e291423 100644--- a/plugins/discourse-narrative-bot/plugin.rb+++ b/plugins/discourse-narrative-bot/plugin.rb@@ -185,13 +185,13 @@ after_initialize doraw =I18n.t("discourse_narrative_bot.tl2_promotion_message.text_body_template",- discobot_username: ::DiscourseNarrativeBot::Base.new.discobot_username,+ discobot_username: DiscourseNarrativeBot::Base.new.discobot_username,reset_trigger:- "#{::DiscourseNarrativeBot::TrackSelector.reset_trigger} #{::DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}",+ "#{DiscourseNarrativeBot::TrackSelector.reset_trigger} #{DiscourseNarrativeBot::AdvancedUserNarrative.reset_trigger}",)PostCreator.create!(- ::DiscourseNarrativeBot::Base.new.discobot_user,+ DiscourseNarrativeBot::Base.new.discobot_user,title: I18n.t("discourse_narrative_bot.tl2_promotion_message.subject_template"),raw: raw,skip_validations: true,diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rbindex af349ee4ffb..67f5a564a28 100644--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/advanced_user_narrative_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe DiscourseNarrativeBot::AdvancedUserNarrative do- fab!(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }+ fab!(:narrative_bot) { DiscourseNarrativeBot::Base.new }fab!(:discobot_user) { narrative_bot.discobot_user }fab!(:discobot_username) { narrative_bot.discobot_username }fab!(:first_post) { Fabricate(:post, user: discobot_user) }diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rbindex f7c9ec1f4c8..a298c691925 100644--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/new_user_narrative_spec.rb@@ -2,7 +2,7 @@RSpec.describe DiscourseNarrativeBot::NewUserNarrative dofab!(:welcome_topic) { Fabricate(:topic, title: "Welcome to Discourse") }- fab!(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }+ fab!(:narrative_bot) { DiscourseNarrativeBot::Base.new }fab!(:discobot_user) { narrative_bot.discobot_user }fab!(:discobot_username) { narrative_bot.discobot_username }fab!(:first_post) { Fabricate(:post, user: discobot_user) }diff --git a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rbindex 4a346568fab..5fc221aaaf6 100644--- a/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb+++ b/plugins/discourse-narrative-bot/spec/discourse_narrative_bot/track_selector_spec.rb@@ -2,7 +2,7 @@RSpec.describe DiscourseNarrativeBot::TrackSelector dolet(:user) { Fabricate(:user) }- let(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }+ let(:narrative_bot) { DiscourseNarrativeBot::Base.new }let(:discobot_user) { narrative_bot.discobot_user }let(:discobot_username) { narrative_bot.discobot_username }let(:narrative) { DiscourseNarrativeBot::NewUserNarrative.new }diff --git a/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb b/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rbindex ba8217caa25..691ee1a2da2 100644--- a/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb+++ b/plugins/discourse-narrative-bot/spec/lib/site_setting_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe SiteSetting do- let(:narrative_bot) { ::DiscourseNarrativeBot::Base.new }+ let(:narrative_bot) { DiscourseNarrativeBot::Base.new }let(:discobot_user) { narrative_bot.discobot_user }before { SiteSetting.discourse_narrative_bot_enabled = true }diff --git a/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb b/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rbindex 22cdd10f680..410a88f46dc 100644--- a/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb+++ b/plugins/discourse-openid-connect/lib/omniauth_open_id_connect.rb@@ -2,7 +2,7 @@require "omniauth-oauth2"-module ::OmniAuth+module OmniAuthmodule OpenIDConnectclass DiscoveryError < Errorend@@ -39,7 +39,7 @@ module ::OmniAuthdef discover!discovery_document = options[:discovery_document]if discovery_document.nil?- raise ::OmniAuth::OpenIDConnect::DiscoveryError.new("Discovery document is missing")+ raise OmniAuth::OpenIDConnect::DiscoveryError.new("Discovery document is missing")enddiscovery_params = {@@ -51,7 +51,7 @@ module ::OmniAuthdiscovery_params.each do |internal_key, external_key|val = discovery_document[external_key]if val.nil? || val.empty?- raise ::OmniAuth::OpenIDConnect::DiscoveryError.new(+ raise OmniAuth::OpenIDConnect::DiscoveryError.new("missing discovery parameter #{external_key}",)end@@ -78,7 +78,7 @@ module ::OmniAuthdef request_phasebegindiscover! if options[:discovery]- rescue ::OmniAuth::OpenIDConnect::DiscoveryError => e+ rescue OmniAuth::OpenIDConnect::DiscoveryError => ereturn fail!(:openid_connect_discovery_error, e)end@@ -131,7 +131,7 @@ module ::OmniAuthreturn oauth2_callback_phase if env["omniauth.error"]oauth2_callback_phase- rescue ::OmniAuth::OpenIDConnect::DiscoveryError => e+ rescue OmniAuth::OpenIDConnect::DiscoveryError => efail!(:openid_connect_discovery_error, e)rescue ::JWT::DecodeError => efail!(:jwt_decode_failed, e)diff --git a/plugins/discourse-patreon/app/controllers/patreon/patreon_admin_controller.rb b/plugins/discourse-patreon/app/controllers/patreon/patreon_admin_controller.rbindex fce6b1c4a01..ae8b25f6590 100644--- a/plugins/discourse-patreon/app/controllers/patreon/patreon_admin_controller.rb+++ b/plugins/discourse-patreon/app/controllers/patreon/patreon_admin_controller.rb@@ -12,8 +12,8 @@ class Patreon::PatreonAdminController < Admin::AdminControllerdef listfilters = PluginStore.get(Patreon::PLUGIN_NAME, "filters") || {}- rewards = ::Patreon::Reward.all- last_sync = ::Patreon.get("last_sync") || {}+ rewards = Patreon::Reward.all+ last_sync = Patreon.get("last_sync") || {}groups = ::Group.all.pluck(:id)@@ -23,7 +23,7 @@ class Patreon::PatreonAdminController < Admin::AdminControllerenddef rewards- rewards = ::Patreon::Reward.all+ rewards = Patreon::Reward.allrender json: rewardsend@@ -84,7 +84,7 @@ class Patreon::PatreonAdminController < Admin::AdminControllerStaffActionLogger.new(current_user).log_check_email(user, context: params[:context])end- render json: { email: ::Patreon::Patron.attr("email", user) }+ render json: { email: Patreon::Patron.attr("email", user) }enddef patreon_tokens_present?diff --git a/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb b/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rbindex ebbbfaafa0f..d9767f458c7 100644--- a/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb+++ b/plugins/discourse-patreon/app/jobs/regular/sync_patron_groups.rb@@ -1,9 +1,9 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass SyncPatronGroups < ::Jobs::Basedef execute(args)- ::Patreon::Patron.sync_groups_by(patreon_id: args[:patreon_id])+ Patreon::Patron.sync_groups_by(patreon_id: args[:patreon_id])endendenddiff --git a/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb b/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rbindex 76bd7880889..a77149b3839 100644--- a/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb+++ b/plugins/discourse-patreon/app/jobs/scheduled/patreon_sync_patrons_to_groups.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass PatreonSyncPatronsToGroups < ::Jobs::Scheduledevery 6.hourssidekiq_options retry: false@@ -11,8 +11,8 @@ module ::Jobsreturnend- ::Patreon::Patron.update!- ::Patreon.set("last_sync", at: Time.now)+ Patreon::Patron.update!+ Patreon.set("last_sync", at: Time.now)endendenddiff --git a/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb b/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rbindex 1e1129265d7..240070cd411 100644--- a/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb+++ b/plugins/discourse-patreon/app/jobs/scheduled/patreon_update_tokens.rb@@ -1,13 +1,13 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass PatreonUpdateTokens < ::Jobs::Scheduledevery 7.daysdef execute(args)if SiteSetting.patreon_enabled && SiteSetting.patreon_creator_access_token &&SiteSetting.patreon_creator_refresh_token- ::Patreon::Tokens.update!+ Patreon::Tokens.update!endendenddiff --git a/plugins/discourse-patreon/lib/api.rb b/plugins/discourse-patreon/lib/api.rbindex 7a46d86cf72..997fdebf102 100644--- a/plugins/discourse-patreon/lib/api.rb+++ b/plugins/discourse-patreon/lib/api.rb@@ -2,7 +2,7 @@require "json"-module ::Patreon+module Patreonclass InvalidApiResponse < ::StandardErrorend@@ -43,7 +43,7 @@ module ::Patreonwhen 401ProblemCheckTracker[:access_token_invalid].problem!else- e = ::Patreon::InvalidApiResponse.new(response.body.presence || "")+ e = Patreon::InvalidApiResponse.new(response.body.presence || "")e.set_backtrace(caller)Discourse.warn_exception(e, message: I18n.t(INVALID_RESPONSE), env: { api_uri: uri })enddiff --git a/plugins/discourse-patreon/lib/campaign.rb b/plugins/discourse-patreon/lib/campaign.rbindex b9b20b8e6a3..2ae6ae3369b 100644--- a/plugins/discourse-patreon/lib/campaign.rb+++ b/plugins/discourse-patreon/lib/campaign.rb@@ -2,14 +2,14 @@require "json"-module ::Patreon+module Patreonclass Campaigndef self.update!rewards = {}campaign_rewards = []pledges_uris = []- response = ::Patreon::Api.campaign_data+ response = Patreon::Api.campaign_datareturn false if response.blank? || response["data"].blank?diff --git a/plugins/discourse-patreon/lib/discourse_patreon/engine.rb b/plugins/discourse-patreon/lib/discourse_patreon/engine.rbindex 7b10381ef5d..a6cd15d22aa 100644--- a/plugins/discourse-patreon/lib/discourse_patreon/engine.rb+++ b/plugins/discourse-patreon/lib/discourse_patreon/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Patreon+module PatreonUSER_DETAIL_FIELDS = %w[id amount_cents rewards declined_since].freezeclass Engine < ::Rails::Enginediff --git a/plugins/discourse-patreon/lib/patron.rb b/plugins/discourse-patreon/lib/patron.rbindex 95e24a3dddd..856d1fe1a45 100644--- a/plugins/discourse-patreon/lib/patron.rb+++ b/plugins/discourse-patreon/lib/patron.rb@@ -2,7 +2,7 @@require "json"-module ::Patreon+module Patreonclass Patrondef self.update!return unless Patreon::Campaign.update!diff --git a/plugins/discourse-patreon/lib/pledge.rb b/plugins/discourse-patreon/lib/pledge.rbindex 346dd063e8f..2137e84f9cc 100644--- a/plugins/discourse-patreon/lib/pledge.rb+++ b/plugins/discourse-patreon/lib/pledge.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Patreon+module Patreonclass Pledgedef self.create!(pledge_data)save!([pledge_data], true)@@ -39,7 +39,7 @@ module ::Patreonpledges_data = []uris.each do |uri|- pledge_data = ::Patreon::Api.get(uri)+ pledge_data = Patreon::Api.get(uri)# get next page if necessary and add to the current loopif pledge_data["links"] && pledge_data["links"]["next"]diff --git a/plugins/discourse-patreon/lib/seed.rb b/plugins/discourse-patreon/lib/seed.rbindex 9817e544fd7..883c452721a 100644--- a/plugins/discourse-patreon/lib/seed.rb+++ b/plugins/discourse-patreon/lib/seed.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Patreon+module Patreonclass Seeddef self.seed_content!flair =@@ -43,7 +43,7 @@ module ::Patreonbadge.save!basic_filter = { default_group.id.to_s => ["0"] }- ::Patreon.set("filters", basic_filter)+ Patreon.set("filters", basic_filter)endendenddiff --git a/plugins/discourse-patreon/lib/tokens.rb b/plugins/discourse-patreon/lib/tokens.rbindex 37a6a3ac535..f9e5160a29f 100644--- a/plugins/discourse-patreon/lib/tokens.rb+++ b/plugins/discourse-patreon/lib/tokens.rb@@ -2,7 +2,7 @@require "json"-module ::Patreon+module Patreonclass Tokensdef self.update!conn = Faraday.new(url: "https://api.patreon.com")diff --git a/plugins/discourse-patreon/plugin.rb b/plugins/discourse-patreon/plugin.rbindex 262fe806361..9e590031adc 100644--- a/plugins/discourse-patreon/plugin.rb+++ b/plugins/discourse-patreon/plugin.rb@@ -40,7 +40,7 @@ after_initialize dorequire_relative "lib/patron"require_relative "lib/tokens"- Discourse::Application.routes.prepend { mount ::Patreon::Engine, at: "/patreon" }+ Discourse::Application.routes.prepend { mount Patreon::Engine, at: "/patreon" }add_admin_route "patreon.title", "patreon"@@ -55,7 +55,7 @@ after_initialize doendon(:user_created) do |user|- filters = PluginStore.get(::Patreon::PLUGIN_NAME, "filters")+ filters = PluginStore.get(Patreon::PLUGIN_NAME, "filters")patreon_id = Patreon::Patron.all.key(user.email)if filters.present? && patreon_id.present?@@ -76,21 +76,21 @@ after_initialize doendend- ::Patreon::USER_DETAIL_FIELDS.each do |attribute|+ Patreon::USER_DETAIL_FIELDS.each do |attribute|add_to_serializer(:admin_detailed_user,"patreon_#{attribute}".to_sym,include_condition: -> do- ::Patreon::Patron.attr(attribute, object).present? &&+ Patreon::Patron.attr(attribute, object).present? &&(attribute != "amount_cents" || scope.is_admin?)end,- ) { ::Patreon::Patron.attr(attribute, object) }+ ) { Patreon::Patron.attr(attribute, object) }endadd_to_serializer(:admin_detailed_user,:patreon_email_exists,- include_condition: -> { ::Patreon::Patron.attr("email", object).present? },+ include_condition: -> { Patreon::Patron.attr("email", object).present? },) { true }add_to_serializer(:current_user, :show_donation_prompt?) dodiff --git a/plugins/discourse-patreon/spec/integration/patreon_spec.rb b/plugins/discourse-patreon/spec/integration/patreon_spec.rbindex d07e2a75585..7e702cc6378 100644--- a/plugins/discourse-patreon/spec/integration/patreon_spec.rb+++ b/plugins/discourse-patreon/spec/integration/patreon_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-RSpec.describe ::Patreon do+RSpec.describe Patreon dolet(:user1) { Fabricate(:user) }let(:user2) { Fabricate(:user) }let(:group) { Fabricate(:group) }diff --git a/plugins/discourse-patreon/spec/lib/api_spec.rb b/plugins/discourse-patreon/spec/lib/api_spec.rbindex 7e7cfab3593..2f84ec68413 100644--- a/plugins/discourse-patreon/spec/lib/api_spec.rb+++ b/plugins/discourse-patreon/spec/lib/api_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-RSpec.describe ::Patreon::Api do+RSpec.describe Patreon::Api dolet(:url) do"https://api.patreon.com/oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges&page%5Bcount%5D=100"enddiff --git a/plugins/discourse-patreon/spec/lib/campaign_spec.rb b/plugins/discourse-patreon/spec/lib/campaign_spec.rbindex 8e67cb6368d..2d3e9b8c25e 100644--- a/plugins/discourse-patreon/spec/lib/campaign_spec.rb+++ b/plugins/discourse-patreon/spec/lib/campaign_spec.rb@@ -2,7 +2,7 @@require_relative "../spec_helper"-RSpec.describe ::Patreon::Campaign do+RSpec.describe Patreon::Campaign dobefore docampaigns_url ="https://api.patreon.com/oauth2/api/current_user/campaigns?include=rewards,creator,goals,pledges&page%5Bcount%5D=100"diff --git a/plugins/discourse-patreon/spec/lib/patron_spec.rb b/plugins/discourse-patreon/spec/lib/patron_spec.rbindex c10ea7a700d..fa369c62430 100644--- a/plugins/discourse-patreon/spec/lib/patron_spec.rb+++ b/plugins/discourse-patreon/spec/lib/patron_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-RSpec.describe ::Patreon::Patron do+RSpec.describe Patreon::Patron doFabricator(:patreon_user_info, class_name: :user_associated_account) doprovider_name "patreon"userdiff --git a/plugins/discourse-patreon/spec/lib/seed_spec.rb b/plugins/discourse-patreon/spec/lib/seed_spec.rbindex 16dbb9f49be..419d3165855 100644--- a/plugins/discourse-patreon/spec/lib/seed_spec.rb+++ b/plugins/discourse-patreon/spec/lib/seed_spec.rb@@ -1,19 +1,19 @@# frozen_string_literal: true-RSpec.describe ::Patreon::Seed do+RSpec.describe Patreon::Seed doit "should seed contents correctly" dodescribed_class.seed_content!group = Group.lastexpect(group.name).to eq("patrons")expect(group.flair_upload).to be_presentexpect(Badge.last.name).to eq("Patron")- expect(::Patreon.get("filters")).to eq(group.id.to_s => ["0"])+ expect(Patreon.get("filters")).to eq(group.id.to_s => ["0"])endit "should not raise error if group already exists" dogroup = Fabricate(:group, name: "patrons")described_class.seed_content!- expect(::Patreon.get("filters")).to eq(group.id.to_s => ["0"])+ expect(Patreon.get("filters")).to eq(group.id.to_s => ["0"])endit "should not raise error if badge already exists" dodiff --git a/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb b/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rbindex f0df1de96fa..096aba3bdcf 100644--- a/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb+++ b/plugins/discourse-patreon/spec/requests/patreon_webhook_controller_spec.rb@@ -4,7 +4,7 @@ require "openssl"require "json"require_relative "../spec_helper"-RSpec.describe ::Patreon::PatreonWebhookController do+RSpec.describe Patreon::PatreonWebhookController dobefore doSiteSetting.patreon_enabled = trueSiteSetting.login_required = truediff --git a/plugins/discourse-policy/jobs/scheduled/check_policy.rb b/plugins/discourse-policy/jobs/scheduled/check_policy.rbindex 7374487191a..78845fcd35d 100644--- a/plugins/discourse-policy/jobs/scheduled/check_policy.rb+++ b/plugins/discourse-policy/jobs/scheduled/check_policy.rb@@ -1,11 +1,12 @@# frozen_string_literal: truemodule Jobs- class ::DiscoursePolicy::CheckPolicy < ::Jobs::Scheduled- every 6.hours+ module DiscoursePolicy+ class CheckPolicy < ::Jobs::Scheduled+ every 6.hours- def execute(args = nil)- sql = <<~SQL+ def execute(args = nil)+ sql = <<~SQLSELECT p.idFROM post_policies ppJOIN posts p ON p.id = pp.post_id@@ -20,54 +21,54 @@ module Jobs)SQL- post_ids = DB.query_single(sql, weekly: 1.week.ago, daily: 1.day.ago)+ post_ids = DB.query_single(sql, weekly: 1.week.ago, daily: 1.day.ago)- if post_ids.size > 0- Post- .where(id: post_ids)- .find_each do |post|- post.post_policy.update(last_reminded_at: Time.zone.now)+ if post_ids.size > 0+ Post+ .where(id: post_ids)+ .find_each do |post|+ post.post_policy.update(last_reminded_at: Time.zone.now)- missing_users(post).find_each do |user|- clear_existing_notification(user, post)- user.notifications.create!(- notification_type: Notification.types[:topic_reminder],- topic_id: post.topic_id,- post_number: post.post_number,- data: { topic_title: post.topic.title, display_username: user.username }.to_json,- high_priority: true,- )- end+ missing_users(post).find_each do |user|+ clear_existing_notification(user, post)+ user.notifications.create!(+ notification_type: Notification.types[:topic_reminder],+ topic_id: post.topic_id,+ post_number: post.post_number,+ data: { topic_title: post.topic.title, display_username: user.username }.to_json,+ high_priority: true,+ )+ end- users_to_email(post).find_each do |user|- DiscoursePolicy::PolicyMailer.send_email(user, post)+ users_to_email(post).find_each do |user|+ DiscoursePolicy::PolicyMailer.send_email(user, post)+ endend- end- end+ end- PostPolicy- .where("next_renew_at < ?", Time.zone.now)- .find_each do |policy|- policy- .policy_users- .accepted- .where("accepted_at < ?", policy.next_renew_at)- .update_all(expired_at: Time.zone.now)- next_renew = policy.renew_start+ PostPolicy+ .where("next_renew_at < ?", Time.zone.now)+ .find_each do |policy|+ policy+ .policy_users+ .accepted+ .where("accepted_at < ?", policy.next_renew_at)+ .update_all(expired_at: Time.zone.now)+ next_renew = policy.renew_start- if policy.renew_days.to_i < 1 &&- !PostPolicy.renew_intervals.keys.include?(policy.renew_interval)- Rails.logger.warn("Invalid policy on post #{policy.post_id}")- elsif next_renew.present?- while next_renew < Time.zone.now- next_renew = calculate_next_renew_date(next_renew, policy)+ if policy.renew_days.to_i < 1 &&+ !PostPolicy.renew_intervals.keys.include?(policy.renew_interval)+ Rails.logger.warn("Invalid policy on post #{policy.post_id}")+ elsif next_renew.present?+ while next_renew < Time.zone.now+ next_renew = calculate_next_renew_date(next_renew, policy)+ endend- end- policy.update(next_renew_at: next_renew)- end+ policy.update(next_renew_at: next_renew)+ end- DB.exec <<~SQL,+ DB.exec <<~SQL,UPDATE policy_users puSET expired_at = :nowFROM post_policies pp@@ -85,43 +86,44 @@ module Jobs(pp.renew_interval = :yearly AND pu.accepted_at < :now::timestamp - (INTERVAL '1 year')))SQL- now: Time.zone.now,- monthly: PostPolicy.renew_intervals["monthly"],- quarterly: PostPolicy.renew_intervals["quarterly"],- yearly: PostPolicy.renew_intervals["yearly"]- end+ now: Time.zone.now,+ monthly: PostPolicy.renew_intervals["monthly"],+ quarterly: PostPolicy.renew_intervals["quarterly"],+ yearly: PostPolicy.renew_intervals["yearly"]+ end- def calculate_next_renew_date(date, policy)- case policy.renew_interval- when "monthly"- date + 1.month- when "quarterly"- date + 3.months- when "yearly"- date + 1.year- else- date + policy.renew_days.to_i.days+ def calculate_next_renew_date(date, policy)+ case policy.renew_interval+ when "monthly"+ date + 1.month+ when "quarterly"+ date + 3.months+ when "yearly"+ date + 1.year+ else+ date + policy.renew_days.to_i.days+ endend- end- def missing_users(post)- post.post_policy.not_accepted_by- end+ def missing_users(post)+ post.post_policy.not_accepted_by+ end- def users_to_email(post)- post.post_policy.emailed_by- end+ def users_to_email(post)+ post.post_policy.emailed_by+ end- def clear_existing_notification(user, post)- existing_notification =- Notification.find_by(- notification_type: Notification.types[:topic_reminder],- topic_id: post.topic_id,- post_number: post.post_number,- user: user,- )- return if existing_notification.blank?- existing_notification.delete+ def clear_existing_notification(user, post)+ existing_notification =+ Notification.find_by(+ notification_type: Notification.types[:topic_reminder],+ topic_id: post.topic_id,+ post_number: post.post_number,+ user: user,+ )+ return if existing_notification.blank?+ existing_notification.delete+ endendendenddiff --git a/plugins/discourse-policy/lib/discourse_policy/engine.rb b/plugins/discourse-policy/lib/discourse_policy/engine.rbindex 772947229dc..660f6056200 100644--- a/plugins/discourse-policy/lib/discourse_policy/engine.rb+++ b/plugins/discourse-policy/lib/discourse_policy/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscoursePolicy+module DiscoursePolicyHAS_POLICY = "HasPolicy"POLICY_USER_DEFAULT_LIMIT = 25diff --git a/plugins/discourse-policy/plugin.rb b/plugins/discourse-policy/plugin.rbindex 98f6d9dfb0f..49af1901f31 100644--- a/plugins/discourse-policy/plugin.rb+++ b/plugins/discourse-policy/plugin.rb@@ -34,7 +34,7 @@ after_initialize dorequire_relative "lib/extensions/user_option_extension"require_relative "lib/policy_mailer"- Discourse::Application.routes.append { mount ::DiscoursePolicy::Engine, at: "/policy" }+ Discourse::Application.routes.append { mount DiscoursePolicy::Engine, at: "/policy" }Post.prepend DiscoursePolicy::PostExtensionPostSerializer.prepend DiscoursePolicy::PostSerializerExtensiondiff --git a/plugins/discourse-policy/spec/lib/check_policy_spec.rb b/plugins/discourse-policy/spec/lib/check_policy_spec.rbindex 914e9007c58..e33e7767577 100644--- a/plugins/discourse-policy/spec/lib/check_policy_spec.rb+++ b/plugins/discourse-policy/spec/lib/check_policy_spec.rb@@ -1,10 +1,7 @@# frozen_string_literal: true-describe DiscoursePolicy::CheckPolicy do- before do- enable_current_plugin- Jobs.run_immediately!- end+describe Jobs::DiscoursePolicy::CheckPolicy do+ subject(:job) { described_class.new }fab!(:user1) { Fabricate(:user) }fab!(:user2) { Fabricate(:user) }@@ -16,6 +13,11 @@ describe DiscoursePolicy::CheckPolicy dogroupend+ before do+ enable_current_plugin+ Jobs.run_immediately!+ end+def accept_policy(post)[user1, user2].each { |u| PolicyUser.add!(u, post.post_policy) }end@@ -35,13 +37,13 @@ describe DiscoursePolicy::CheckPolicy doaccept_policy(post)freeze_time Time.utc(2022)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to contain_exactly(user1, user2)freeze_time Time.utc(2023)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to be_empty@@ -63,7 +65,7 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time Time.utc(2022)PolicyUser.where(user_id: user2.id).update(accepted_at: Time.now)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to contain_exactly(user2)@@ -92,7 +94,7 @@ describe DiscoursePolicy::CheckPolicy doaccept_policy(post2)freeze_time Time.utc(2022)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to be_empty@@ -113,7 +115,7 @@ describe DiscoursePolicy::CheckPolicy doaccept_policy(post)freeze_time Time.utc(2020)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reload# did not hit renew start@@ -121,7 +123,7 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time Time.utc(2020, 10, 18)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to be_empty@@ -132,7 +134,7 @@ describe DiscoursePolicy::CheckPolicy doPolicyUser.add!(user2, post.post_policy)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to contain_exactly(user2)@@ -163,14 +165,14 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time Time.utc(2020, 10, 17)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to contain_exactly(user1, user2)freeze_time Time.utc(2020, 10, 18)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to be_empty@@ -203,14 +205,14 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time Time.utc(2020, 10, 30)- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to contain_exactly(user1, user2)freeze_time Time.utc(2020, 10, 16) + period + 1.day- DiscoursePolicy::CheckPolicy.new.execute+ job.executepost.reloadexpect(post.post_policy.accepted_by).to be_empty@@ -230,7 +232,7 @@ describe DiscoursePolicy::CheckPolicy dopost = create_post(raw: raw, user: Fabricate(:admin))- DiscoursePolicy::CheckPolicy.new.execute+ job.executeexpect(user1.notifications.where(notification_type: Notification.types[:topic_reminder]).count,@@ -241,8 +243,8 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time 2.weeks.from_now- DiscoursePolicy::CheckPolicy.new.execute- DiscoursePolicy::CheckPolicy.new.execute+ job.execute+ job.executeuser1_notifications =user1.notifications.where(@@ -274,7 +276,7 @@ describe DiscoursePolicy::CheckPolicy dopost = create_post(raw: raw, user: Fabricate(:admin))- DiscoursePolicy::CheckPolicy.new.execute+ job.executeexpect(user1.notifications.where(notification_type: Notification.types[:topic_reminder]).count,@@ -282,7 +284,7 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time 2.weeks.from_now- DiscoursePolicy::CheckPolicy.new.execute+ job.executeuser1_notification =user1@@ -297,7 +299,7 @@ describe DiscoursePolicy::CheckPolicy dofreeze_time 2.weeks.from_now- DiscoursePolicy::CheckPolicy.new.execute+ job.executeexpect(user1@@ -315,7 +317,7 @@ describe DiscoursePolicy::CheckPolicy doit "clears the next_renew_at when renew_start is nil" dopolicy = Fabricate(:post_policy, next_renew_at: 3.hours.ago, renew_start: nil, renew_days: 10)- DiscoursePolicy::CheckPolicy.new.execute+ job.executeexpect(policy.reload.next_renew_at).to be_nilenddiff --git a/plugins/discourse-policy/spec/lib/pretty_text_spec.rb b/plugins/discourse-policy/spec/lib/pretty_text_spec.rbindex 0bcf1735b6b..88e9e5b9f24 100644--- a/plugins/discourse-policy/spec/lib/pretty_text_spec.rb+++ b/plugins/discourse-policy/spec/lib/pretty_text_spec.rb@@ -76,11 +76,11 @@ describe PrettyText doPolicyUser.add!(user, post.post_policy)freeze_time(199.days.from_now)- ::DiscoursePolicy::CheckPolicy.new.execute(nil)+ Jobs::DiscoursePolicy::CheckPolicy.new.execute(nil)expect(post.post_policy.accepted_by).to eq([user])freeze_time(2.days.from_now)- ::DiscoursePolicy::CheckPolicy.new.execute(nil)+ Jobs::DiscoursePolicy::CheckPolicy.new.execute(nil)expect(post.post_policy.accepted_by).to be_emptyenddiff --git a/plugins/discourse-post-voting/config/routes.rb b/plugins/discourse-post-voting/config/routes.rbindex 916b31e4ec5..21eeb2d8bbf 100644--- a/plugins/discourse-post-voting/config/routes.rb+++ b/plugins/discourse-post-voting/config/routes.rb@@ -13,4 +13,4 @@ PostVoting::Engine.routes.draw dodelete "vote/comment" => "votes#destroy_comment_vote"end-Discourse::Application.routes.append { mount ::PostVoting::Engine, at: "post_voting" }+Discourse::Application.routes.append { mount PostVoting::Engine, at: "post_voting" }diff --git a/plugins/discourse-post-voting/lib/post_voting/engine.rb b/plugins/discourse-post-voting/lib/post_voting/engine.rbindex e5172b1eb73..34884a1dafc 100644--- a/plugins/discourse-post-voting/lib/post_voting/engine.rb+++ b/plugins/discourse-post-voting/lib/post_voting/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::PostVoting+module PostVotingCREATE_AS_POST_VOTING_DEFAULT = "create_as_post_voting_default"ONLY_POST_VOTING_IN_THIS_CATEGORY = "only_post_voting_in_this_category"diff --git a/plugins/discourse-reactions/lib/discourse_reactions/engine.rb b/plugins/discourse-reactions/lib/discourse_reactions/engine.rbindex 251088575b3..1e8f676a046 100644--- a/plugins/discourse-reactions/lib/discourse_reactions/engine.rb+++ b/plugins/discourse-reactions/lib/discourse_reactions/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseReactions+module DiscourseReactionsclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseReactionsdiff --git a/plugins/discourse-reactions/plugin.rb b/plugins/discourse-reactions/plugin.rbindex 2c1cd10f975..e3a7a581746 100644--- a/plugins/discourse-reactions/plugin.rb+++ b/plugins/discourse-reactions/plugin.rb@@ -60,7 +60,7 @@ after_initialize doNotification.singleton_class.prepend DiscourseReactions::NotificationExtensionend- Discourse::Application.routes.append { mount ::DiscourseReactions::Engine, at: "/" }+ Discourse::Application.routes.append { mount DiscourseReactions::Engine, at: "/" }add_to_serializer(:post, :reactions) doreactions = []diff --git a/plugins/discourse-reactions/spec/plugin_spec.rb b/plugins/discourse-reactions/spec/plugin_spec.rbindex 31bf72a7171..adcca014e14 100644--- a/plugins/discourse-reactions/spec/plugin_spec.rb+++ b/plugins/discourse-reactions/spec/plugin_spec.rb@@ -26,7 +26,7 @@ describe DiscourseReactions dodescribe "on_setting_change(discourse_reactions_excluded_from_like)" doit "kicks off the background job to sync post actions when site setting changes" do- expect_enqueued_with(job: ::Jobs::DiscourseReactions::LikeSynchronizer) do+ expect_enqueued_with(job: Jobs::DiscourseReactions::LikeSynchronizer) doSiteSetting.discourse_reactions_excluded_from_like = "confetti_ball|-1"endenddiff --git a/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb b/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rbindex f9d2ba04227..7d0257d05f4 100644--- a/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb+++ b/plugins/discourse-reactions/spec/requests/custom_reactions_controller_custom_emoji_spec.rb@@ -1,7 +1,5 @@# frozen_string_literal: true-require "rails_helper"-describe DiscourseReactions::CustomReactionsController dofab!(:user)fab!(:post_1) { Fabricate(:post) }diff --git a/plugins/discourse-rss-polling/plugin.rb b/plugins/discourse-rss-polling/plugin.rbindex 8626f42b854..808672df27c 100644--- a/plugins/discourse-rss-polling/plugin.rb+++ b/plugins/discourse-rss-polling/plugin.rb@@ -18,5 +18,5 @@ endrequire_relative "lib/discourse_rss_polling/engine"Discourse::Application.routes.append do- mount ::DiscourseRssPolling::Engine, at: "/admin/plugins/rss_polling"+ mount DiscourseRssPolling::Engine, at: "/admin/plugins/rss_polling"enddiff --git a/plugins/discourse-rss-polling/spec/jobs/poll_all_feeds_spec.rb b/plugins/discourse-rss-polling/spec/jobs/poll_all_feeds_spec.rbindex d0a5b7383da..0f4248a07cf 100644--- a/plugins/discourse-rss-polling/spec/jobs/poll_all_feeds_spec.rb+++ b/plugins/discourse-rss-polling/spec/jobs/poll_all_feeds_spec.rb@@ -1,8 +1,9 @@# frozen_string_literal: trueRSpec.describe Jobs::DiscourseRssPolling::PollAllFeeds do- SiteSetting.rss_polling_enabled = true- let(:job) { Jobs::DiscourseRssPolling::PollAllFeeds.new }+ subject(:job) { described_class.new }++ before { SiteSetting.rss_polling_enabled = true }describe "#execute" dobefore dodiff --git a/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb b/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rbindex 522f6654c54..1b02efe6a69 100644--- a/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb+++ b/plugins/discourse-rss-polling/spec/jobs/poll_feed_spec.rb@@ -1,11 +1,13 @@# frozen_string_literal: trueRSpec.describe Jobs::DiscourseRssPolling::PollFeed do- SiteSetting.rss_polling_enabled = true+ subject(:job) { described_class.new }+let(:feed_url) { "https://blog.discourse.org/feed/" }let(:author) { Fabricate(:user, trust_level: 1) }let(:raw_feed) { file_from_fixtures("feed.rss", "feed") }- let(:job) { Jobs::DiscourseRssPolling::PollFeed.new }++ before { SiteSetting.rss_polling_enabled = true }describe "#execute" dobefore dodiff --git a/plugins/discourse-solved/config/routes.rb b/plugins/discourse-solved/config/routes.rbindex 2569aa2193b..201333c398d 100644--- a/plugins/discourse-solved/config/routes.rb+++ b/plugins/discourse-solved/config/routes.rb@@ -7,4 +7,4 @@ DiscourseSolved::Engine.routes.draw doget "/by_user" => "solved_topics#by_user"end-Discourse::Application.routes.draw { mount ::DiscourseSolved::Engine, at: "solution" }+Discourse::Application.routes.draw { mount DiscourseSolved::Engine, at: "solution" }diff --git a/plugins/discourse-solved/lib/discourse_solved/accepted_answer_cache.rb b/plugins/discourse-solved/lib/discourse_solved/accepted_answer_cache.rbindex a25b2c2d85d..672abe5a776 100644--- a/plugins/discourse-solved/lib/discourse_solved/accepted_answer_cache.rb+++ b/plugins/discourse-solved/lib/discourse_solved/accepted_answer_cache.rb@@ -8,7 +8,7 @@ module DiscourseSolved@@allowed_accepted_cache["allowed"] = beginSet.new(CategoryCustomField.where(- name: ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,+ name: DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,value: "true",).pluck(:category_id),)diff --git a/plugins/discourse-solved/lib/discourse_solved/category_extension.rb b/plugins/discourse-solved/lib/discourse_solved/category_extension.rbindex 80dd9ae2fd0..57772cb52a8 100644--- a/plugins/discourse-solved/lib/discourse_solved/category_extension.rb+++ b/plugins/discourse-solved/lib/discourse_solved/category_extension.rb@@ -8,6 +8,6 @@ module DiscourseSolved::CategoryExtensionprivatedef reset_accepted_cache- ::DiscourseSolved::AcceptedAnswerCache.reset_accepted_answer_cache+ DiscourseSolved::AcceptedAnswerCache.reset_accepted_answer_cacheendenddiff --git a/plugins/discourse-solved/lib/discourse_solved/engine.rb b/plugins/discourse-solved/lib/discourse_solved/engine.rbindex 6c41a5eeff6..162f775b368 100644--- a/plugins/discourse-solved/lib/discourse_solved/engine.rb+++ b/plugins/discourse-solved/lib/discourse_solved/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseSolved+module DiscourseSolvedclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseSolveddiff --git a/plugins/discourse-solved/lib/discourse_solved/guardian_extensions.rb b/plugins/discourse-solved/lib/discourse_solved/guardian_extensions.rbindex 6ea7fec9f49..ecccdc5766f 100644--- a/plugins/discourse-solved/lib/discourse_solved/guardian_extensions.rb+++ b/plugins/discourse-solved/lib/discourse_solved/guardian_extensions.rb@@ -13,10 +13,10 @@ module DiscourseSolvedendreturn false if category_id.blank?- if !::DiscourseSolved::AcceptedAnswerCache.allowed- ::DiscourseSolved::AcceptedAnswerCache.reset_accepted_answer_cache+ if !DiscourseSolved::AcceptedAnswerCache.allowed+ DiscourseSolved::AcceptedAnswerCache.reset_accepted_answer_cacheend- ::DiscourseSolved::AcceptedAnswerCache.allowed.include?(category_id)+ DiscourseSolved::AcceptedAnswerCache.allowed.include?(category_id)enddef can_accept_answer?(topic, post)diff --git a/plugins/discourse-solved/lib/discourse_solved/register_filters.rb b/plugins/discourse-solved/lib/discourse_solved/register_filters.rbindex 027a7fac9f4..ed0163e3df5 100644--- a/plugins/discourse-solved/lib/discourse_solved/register_filters.rb+++ b/plugins/discourse-solved/lib/discourse_solved/register_filters.rb@@ -26,7 +26,7 @@ module DiscourseSolvedFROM topics tJOIN category_custom_fields ccON t.category_id = cc.category_id- AND cc.name = '#{::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD}'+ AND cc.name = '#{DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD}'AND cc.value = 'true')ORdiff --git a/plugins/discourse-solved/plugin.rb b/plugins/discourse-solved/plugin.rbindex 09b7835d318..4c256b5bb98 100644--- a/plugins/discourse-solved/plugin.rb+++ b/plugins/discourse-solved/plugin.rb@@ -186,7 +186,7 @@ after_initialize doregister_category_list_topics_preloader_associations(:solved) if SiteSetting.solved_enabledregister_topic_preloader_associations(:solved) if SiteSetting.solved_enabledSearch.custom_topic_eager_load { [:solved] } if SiteSetting.solved_enabled- Site.preloaded_category_custom_fields << ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD+ Site.preloaded_category_custom_fields << DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELDadd_api_key_scope(:solved,@@ -273,7 +273,7 @@ after_initialize doadd_to_serializer(:post, :accepted_answer) { topic&.solved&.answer_post_id == object.id }add_to_serializer(:post, :topic_accepted_answer) { topic&.solved&.present? }- on(:post_destroyed) { |post| ::DiscourseSolved.unaccept_answer!(post) }+ on(:post_destroyed) { |post| DiscourseSolved.unaccept_answer!(post) }on(:filter_auto_bump_topics) do |_category, filters|filters.push(diff --git a/plugins/discourse-solved/spec/integration/solved_spec.rb b/plugins/discourse-solved/spec/integration/solved_spec.rbindex 96a10bc87bc..6184939b878 100644--- a/plugins/discourse-solved/spec/integration/solved_spec.rb+++ b/plugins/discourse-solved/spec/integration/solved_spec.rb@@ -18,7 +18,7 @@ RSpec.describe "Managing Posts solved status" doCategoryCustomField.create(category_id: category.id,- name: ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,+ name: DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,value: "true",)@@ -142,7 +142,7 @@ RSpec.describe "Managing Posts solved status" docategory_custom_field =CategoryCustomField.new(category_id: category.id,- name: ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,+ name: DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,value: "true",)category_custom_field.save@@ -153,7 +153,7 @@ RSpec.describe "Managing Posts solved status" docategory_custom_field =CategoryCustomField.new(category_id: category.id,- name: ::DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,+ name: DiscourseSolved::ENABLE_ACCEPTED_ANSWERS_CUSTOM_FIELD,value: "false",)category_custom_field.savediff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/coupons_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/coupons_controller.rbindex 1ef1d5f0aba..72adf183e36 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/coupons_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/coupons_controller.rb@@ -6,7 +6,7 @@ module DiscourseSubscriptionsinclude DiscourseSubscriptions::Stripeinclude DiscourseSubscriptions::Group- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keydiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/plans_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/plans_controller.rbindex 7867581d2aa..fb5f8ea6471 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/plans_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/plans_controller.rb@@ -5,7 +5,7 @@ module DiscourseSubscriptionsclass PlansController < ::Admin::AdminControllerinclude DiscourseSubscriptions::Stripe- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keydiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/products_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/products_controller.rbindex d2d21fbb475..2c644c5d9c1 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/products_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/products_controller.rb@@ -5,7 +5,7 @@ module DiscourseSubscriptionsclass ProductsController < ::Admin::AdminControllerinclude DiscourseSubscriptions::Stripe- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keydiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rbindex 5e0b0756968..a4250b539e2 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin/subscriptions_controller.rb@@ -3,7 +3,7 @@module DiscourseSubscriptionsmodule Adminclass SubscriptionsController < ::Admin::AdminController- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEinclude DiscourseSubscriptions::Stripeinclude DiscourseSubscriptions::Groupdiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin_controller.rbindex 4efa4240d0a..c5d69b95384 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/admin_controller.rb@@ -2,7 +2,7 @@module DiscourseSubscriptionsclass AdminController < ::Admin::AdminController- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexhead 200diff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/hooks_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/hooks_controller.rbindex 15a9d7b4b93..5f7b8cf0ea8 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/hooks_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/hooks_controller.rb@@ -5,7 +5,7 @@ module DiscourseSubscriptionsinclude DiscourseSubscriptions::Groupinclude DiscourseSubscriptions::Stripe- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMElayout falsediff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/pricingtable_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/pricingtable_controller.rbindex eca32e407b5..d2ae713f785 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/pricingtable_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/pricingtable_controller.rb@@ -2,7 +2,7 @@module DiscourseSubscriptionsclass PricingtableController < ::ApplicationController- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef indexhead 200diff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rbindex 9721698eaba..2991bfee38b 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/subscribe_controller.rb@@ -5,7 +5,7 @@ module DiscourseSubscriptionsinclude DiscourseSubscriptions::Stripeinclude DiscourseSubscriptions::Group- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keyrequires_login except: %i[index contributors show]diff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/payments_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/payments_controller.rbindex 7bc4712e0cb..55325ceeee7 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/payments_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/payments_controller.rb@@ -5,7 +5,7 @@ module DiscourseSubscriptionsclass PaymentsController < ::ApplicationControllerinclude DiscourseSubscriptions::Stripe- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keyrequires_logindiff --git a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/subscriptions_controller.rb b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/subscriptions_controller.rbindex 913207eac38..68b85673810 100644--- a/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/subscriptions_controller.rb+++ b/plugins/discourse-subscriptions/app/controllers/discourse_subscriptions/user/subscriptions_controller.rb@@ -6,7 +6,7 @@ module DiscourseSubscriptionsinclude DiscourseSubscriptions::Stripeinclude DiscourseSubscriptions::Group- requires_plugin DiscourseSubscriptions::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :set_api_keyrequires_logindiff --git a/plugins/discourse-subscriptions/app/jobs/regular/manually_update_campaign_data.rb b/plugins/discourse-subscriptions/app/jobs/regular/manually_update_campaign_data.rbindex 7a3cc175c2f..806ed250422 100644--- a/plugins/discourse-subscriptions/app/jobs/regular/manually_update_campaign_data.rb+++ b/plugins/discourse-subscriptions/app/jobs/regular/manually_update_campaign_data.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass ManuallyUpdateCampaignData < ::Jobs::Basedef execute(args)return unless SiteSetting.discourse_subscriptions_campaign_enableddiff --git a/plugins/discourse-subscriptions/app/jobs/scheduled/refresh_subscriptions_campaign_data.rb b/plugins/discourse-subscriptions/app/jobs/scheduled/refresh_subscriptions_campaign_data.rbindex 46ef0a46dc3..febaeb8ad4d 100644--- a/plugins/discourse-subscriptions/app/jobs/scheduled/refresh_subscriptions_campaign_data.rb+++ b/plugins/discourse-subscriptions/app/jobs/scheduled/refresh_subscriptions_campaign_data.rb@@ -1,8 +1,8 @@# frozen_string_literal: true-module ::Jobs+module Jobsclass RefreshSubscriptionsCampaignData < ::Jobs::Scheduled- include ::DiscourseSubscriptions::Stripe+ include DiscourseSubscriptions::Stripeevery 30.minutesdef execute(args)diff --git a/plugins/discourse-subscriptions/lib/discourse_subscriptions/engine.rb b/plugins/discourse-subscriptions/lib/discourse_subscriptions/engine.rbindex d11dc5851ae..7a4410a0292 100644--- a/plugins/discourse-subscriptions/lib/discourse_subscriptions/engine.rb+++ b/plugins/discourse-subscriptions/lib/discourse_subscriptions/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseSubscriptions+module DiscourseSubscriptionsclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseSubscriptionsdiff --git a/plugins/discourse-subscriptions/plugin.rb b/plugins/discourse-subscriptions/plugin.rbindex 439a18fab0b..57d0918f6fe 100644--- a/plugins/discourse-subscriptions/plugin.rb+++ b/plugins/discourse-subscriptions/plugin.rb@@ -75,7 +75,7 @@ after_initialize dourl: "https://github.com/discourse/discourse-subscriptions",)- Discourse::Application.routes.append { mount ::DiscourseSubscriptions::Engine, at: "s" }+ Discourse::Application.routes.append { mount DiscourseSubscriptions::Engine, at: "s" }add_to_serializer(:site, :show_campaign_banner) dobegindiff --git a/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb b/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rbindex 353942c5f14..c3710a2107c 100644--- a/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb+++ b/plugins/discourse-subscriptions/spec/requests/subscribe_controller_spec.rb@@ -109,7 +109,7 @@ RSpec.describe DiscourseSubscriptions::SubscribeController doendit "is not subscribed" do- ::DiscourseSubscriptions::Customer.delete_all+ DiscourseSubscriptions::Customer.delete_all::Stripe::Product.expects(:list).with({ ids: product_ids, active: true })diff --git a/plugins/discourse-templates/lib/discourse_templates/engine.rb b/plugins/discourse-templates/lib/discourse_templates/engine.rbindex d031465cbbc..d73abfdd3b0 100644--- a/plugins/discourse-templates/lib/discourse_templates/engine.rb+++ b/plugins/discourse-templates/lib/discourse_templates/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseTemplates+module DiscourseTemplatesclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseTemplatesdiff --git a/plugins/discourse-templates/plugin.rb b/plugins/discourse-templates/plugin.rbindex 97f5cc1c2b0..ad5b62ad1d8 100644--- a/plugins/discourse-templates/plugin.rb+++ b/plugins/discourse-templates/plugin.rb@@ -29,7 +29,7 @@ after_initialize dorequire_relative "lib/discourse_templates/user_extension"Discourse::Application.routes.append do- mount ::DiscourseTemplates::Engine, at: "/discourse_templates"+ mount DiscourseTemplates::Engine, at: "/discourse_templates"endreloadable_patch do |plugin|diff --git a/plugins/discourse-topic-voting/app/controllers/discourse_topic_voting/votes_controller.rb b/plugins/discourse-topic-voting/app/controllers/discourse_topic_voting/votes_controller.rbindex 0832d4ee038..1ba02306fb3 100644--- a/plugins/discourse-topic-voting/app/controllers/discourse_topic_voting/votes_controller.rb+++ b/plugins/discourse-topic-voting/app/controllers/discourse_topic_voting/votes_controller.rb@@ -2,7 +2,7 @@module DiscourseTopicVotingclass VotesController < ::ApplicationController- requires_plugin DiscourseTopicVoting::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_logged_indiff --git a/plugins/discourse-topic-voting/lib/discourse_topic_voting/engine.rb b/plugins/discourse-topic-voting/lib/discourse_topic_voting/engine.rbindex 8d98f813f7c..de6180bd7e3 100644--- a/plugins/discourse-topic-voting/lib/discourse_topic_voting/engine.rb+++ b/plugins/discourse-topic-voting/lib/discourse_topic_voting/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseTopicVoting+module DiscourseTopicVotingclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace DiscourseTopicVotingdiff --git a/plugins/discourse-topic-voting/plugin.rb b/plugins/discourse-topic-voting/plugin.rbindex 0b993cc3c20..e2d1eaeb5d9 100755--- a/plugins/discourse-topic-voting/plugin.rb+++ b/plugins/discourse-topic-voting/plugin.rb@@ -216,7 +216,7 @@ after_initialize doendDiscourse::Application.routes.append do- mount ::DiscourseTopicVoting::Engine, at: "/voting"+ mount DiscourseTopicVoting::Engine, at: "/voting"get "topics/voted-by/:username" => "list#voted_by",:as => "voted_by",diff --git a/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rb b/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rbindex c6d1e37bd31..21171bf76b3 100644--- a/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rb+++ b/plugins/discourse-user-notes/app/controllers/discourse_user_notes/user_notes_controller.rb@@ -2,7 +2,7 @@module DiscourseUserNotesclass UserNotesController < ::ApplicationController- requires_plugin DiscourseUserNotes::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEbefore_action :ensure_logged_inbefore_action :ensure_staff@@ -10,7 +10,7 @@ module DiscourseUserNotesuser = User.where(id: params[:user_id]).firstraise Discourse::NotFound if user.blank?- notes = ::DiscourseUserNotes.notes_for(params[:user_id])+ notes = DiscourseUserNotes.notes_for(params[:user_id])render json: { extras: { username: user.username }, user_notes: create_json(notes.reverse) }end@@ -23,7 +23,7 @@ module DiscourseUserNotesenduser_note =- ::DiscourseUserNotes.add_note(user, params[:user_note][:raw], current_user.id, extras)+ DiscourseUserNotes.add_note(user, params[:user_note][:raw], current_user.id, extras)render json: create_json(user_note)end@@ -34,7 +34,7 @@ module DiscourseUserNotesraise Discourse::InvalidAccess.new unless guardian.can_delete_user_notes?- ::DiscourseUserNotes.remove_note(user, params[:id])+ DiscourseUserNotes.remove_note(user, params[:id])render json: success_jsonenddiff --git a/plugins/discourse-user-notes/lib/discourse_user_notes/engine.rb b/plugins/discourse-user-notes/lib/discourse_user_notes/engine.rbindex 6fbb04e9ac5..0df12b7e4a1 100644--- a/plugins/discourse-user-notes/lib/discourse_user_notes/engine.rb+++ b/plugins/discourse-user-notes/lib/discourse_user_notes/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscourseUserNotes+module DiscourseUserNotesCOUNT_FIELD = "user_notes_count"class Engine < ::Rails::Enginediff --git a/plugins/discourse-user-notes/plugin.rb b/plugins/discourse-user-notes/plugin.rbindex 70713cda5d6..889533dadfd 100644--- a/plugins/discourse-user-notes/plugin.rb+++ b/plugins/discourse-user-notes/plugin.rb@@ -25,7 +25,7 @@ after_initialize dorequire_relative "app/serializers/user_note_serializer"require_relative "app/controllers/discourse_user_notes/user_notes_controller"- Discourse::Application.routes.append { mount ::DiscourseUserNotes::Engine, at: "/user_notes" }+ Discourse::Application.routes.append { mount DiscourseUserNotes::Engine, at: "/user_notes" }allow_staff_user_custom_field(DiscourseUserNotes::COUNT_FIELD)@@ -49,12 +49,7 @@ after_initialize dowarning_link: "[#{warning_topic.title}](#{warning_topic.url})",)end- ::DiscourseUserNotes.add_note(- user,- raw_note,- Discourse::SYSTEM_USER_ID,- topic_id: self.topic_id,- )+ DiscourseUserNotes.add_note(user, raw_note, Discourse::SYSTEM_USER_ID, topic_id: self.topic_id)# Fire event after note is created for other plugins to hook intoDiscourseEvent.trigger(:user_warning_created, self)diff --git a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/issues_controller.rb b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/issues_controller.rbindex fd1f32f6886..9384c3414cb 100644--- a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/issues_controller.rb+++ b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/issues_controller.rb@@ -2,14 +2,14 @@module DiscourseZendeskPluginclass IssuesController < ApplicationController- include ::DiscourseZendeskPlugin::Helper+ include DiscourseZendeskPlugin::Helper- requires_plugin ::DiscourseZendeskPlugin::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEdef createtopic = Topic.find(params[:topic_id])- if topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD].blank?+ if topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD].blank?create_ticket(topic.first_post)enddiff --git a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rbindex 8e95839a0e1..6d803bc9000 100644--- a/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb+++ b/plugins/discourse-zendesk-plugin/app/controllers/discourse_zendesk_plugin/sync_controller.rb@@ -2,9 +2,9 @@module DiscourseZendeskPluginclass SyncController < ApplicationController- include ::DiscourseZendeskPlugin::Helper+ include DiscourseZendeskPlugin::Helper- requires_plugin ::DiscourseZendeskPlugin::PLUGIN_NAME+ requires_plugin PLUGIN_NAMElayout falsebefore_action :zendesk_token_valid?, only: :webhook@@ -30,7 +30,7 @@ module DiscourseZendeskPluginif latest_comment.present?existing_comment =PostCustomField.where(- name: ::DiscourseZendeskPlugin::ZENDESK_ID_FIELD,+ name: DiscourseZendeskPlugin::ZENDESK_ID_FIELD,value: latest_comment.id,).firstdiff --git a/plugins/discourse-zendesk-plugin/app/jobs/regular/zendesk_job.rb b/plugins/discourse-zendesk-plugin/app/jobs/regular/zendesk_job.rbindex 4ec994a3415..46dcb368d2f 100644--- a/plugins/discourse-zendesk-plugin/app/jobs/regular/zendesk_job.rb+++ b/plugins/discourse-zendesk-plugin/app/jobs/regular/zendesk_job.rb@@ -3,7 +3,7 @@module Jobsclass ZendeskJob < ::Jobs::Basesidekiq_options backtrace: true- include ::DiscourseZendeskPlugin::Helper+ include DiscourseZendeskPlugin::Helperdef execute(args)return unless SiteSetting.zendesk_enabled?@@ -30,11 +30,11 @@ module Jobsdef push_post!(post_id)post = Post.find_by(id: post_id)return if !post || post.user_id < 1- return if post.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD].present?+ return if post.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD].present?return if !DiscourseZendeskPlugin::Helper.autogeneration_category?(post.topic.category_id)return if !SiteSetting.zendesk_job_push_all_posts? && post.post_number > 1- ticket_id = post.topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD]+ ticket_id = post.topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD]if ticket_id.present?add_comment(post, ticket_id) if comment_eligible_for_sync?(post)elsediff --git a/plugins/discourse-zendesk-plugin/lib/discourse_zendesk_plugin/helper.rb b/plugins/discourse-zendesk-plugin/lib/discourse_zendesk_plugin/helper.rbindex 9bce6df2c17..fd93fae3c2a 100644--- a/plugins/discourse-zendesk-plugin/lib/discourse_zendesk_plugin/helper.rb+++ b/plugins/discourse-zendesk-plugin/lib/discourse_zendesk_plugin/helper.rb@@ -80,15 +80,15 @@ module DiscourseZendeskPluginenddef update_topic_custom_fields(topic, ticket)- topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = ticket["id"]- topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_API_URL_FIELD] = ticket["url"]+ topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = ticket["id"]+ topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_API_URL_FIELD] = ticket["url"]topic.save_custom_fieldsenddef update_post_custom_fields(post, comment)return if comment.blank?- post.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = comment["id"]+ post.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = comment["id"]post.save_custom_fieldsenddiff --git a/plugins/discourse-zendesk-plugin/plugin.rb b/plugins/discourse-zendesk-plugin/plugin.rbindex 972aa901948..7803314f2e4 100644--- a/plugins/discourse-zendesk-plugin/plugin.rb+++ b/plugins/discourse-zendesk-plugin/plugin.rb@@ -38,16 +38,16 @@ after_initialize doadd_to_serializer(:topic_view,- ::DiscourseZendeskPlugin::ZENDESK_ID_FIELD.to_sym,+ DiscourseZendeskPlugin::ZENDESK_ID_FIELD.to_sym,respect_plugin_enabled: false,- ) { object.topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD] }+ ) { object.topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD] }add_to_serializer(:topic_view,- ::DiscourseZendeskPlugin::ZENDESK_URL_FIELD.to_sym,+ DiscourseZendeskPlugin::ZENDESK_URL_FIELD.to_sym,respect_plugin_enabled: false,) do- id = object.topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD]+ id = object.topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD]uri = URI.parse(SiteSetting.zendesk_url)"#{uri.scheme}://#{uri.host}/agent/tickets/#{id}"enddiff --git a/plugins/discourse-zendesk-plugin/spec/jobs/regular/zendesk_job_spec.rb b/plugins/discourse-zendesk-plugin/spec/jobs/regular/zendesk_job_spec.rbindex 0d3bd918680..7f2a6069805 100644--- a/plugins/discourse-zendesk-plugin/spec/jobs/regular/zendesk_job_spec.rb+++ b/plugins/discourse-zendesk-plugin/spec/jobs/regular/zendesk_job_spec.rb@@ -10,8 +10,8 @@ RSpec.describe Jobs::ZendeskJob dolet(:post_user) { topic_user }let(:topic) doFabricate(:topic, user: topic_user).tap do |topic|- topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = ticket_id- topic.custom_fields[::DiscourseZendeskPlugin::ZENDESK_API_URL_FIELD] = ticket_url+ topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_ID_FIELD] = ticket_id+ topic.custom_fields[DiscourseZendeskPlugin::ZENDESK_API_URL_FIELD] = ticket_urltopic.save_custom_fieldsendenddiff --git a/plugins/poll/lib/poll/engine.rb b/plugins/poll/lib/poll/engine.rbindex 8b14aee4a5b..0e3ff9f2f2f 100644--- a/plugins/poll/lib/poll/engine.rb+++ b/plugins/poll/lib/poll/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::DiscoursePoll+module DiscoursePollDATA_PREFIX = "data-poll-"HAS_POLLS = "has_polls"DEFAULT_POLL_NAME = "poll"diff --git a/plugins/poll/lib/polls_validator.rb b/plugins/poll/lib/polls_validator.rbindex 8a0846906c8..ff5745fd701 100644--- a/plugins/poll/lib/polls_validator.rb+++ b/plugins/poll/lib/polls_validator.rb@@ -62,7 +62,7 @@ module DiscoursePolldef unique_poll_name?(polls, poll)if polls.has_key?(poll["name"])- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base, I18n.t("poll.multiple_polls_without_name"))else@post.errors.add(:base, I18n.t("poll.multiple_polls_with_same_name", name: poll["name"]))@@ -76,7 +76,7 @@ module DiscoursePolldef unique_options?(poll)if poll["options"].map { |o| o["id"] }.uniq.size != poll["options"].size- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base, I18n.t("poll.default_poll_must_have_different_options"))else@post.errors.add(@@ -93,7 +93,7 @@ module DiscoursePolldef any_blank_options?(poll)if poll["options"].any? { |o| o["html"].blank? }- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base, I18n.t("poll.default_poll_must_not_have_any_empty_options"))else@post.errors.add(@@ -110,7 +110,7 @@ module DiscoursePolldef at_least_one_option?(poll)if poll["options"].size < 1- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base, I18n.t("poll.default_poll_must_have_at_least_1_option"))else@post.errors.add(@@ -127,7 +127,7 @@ module DiscoursePolldef valid_number_of_options?(poll)if poll["options"].size > SiteSetting.poll_maximum_options- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base,I18n.t(@@ -159,7 +159,7 @@ module DiscoursePollmax = (poll["max"].presence || options).to_iif min > max || min <= 0 || max <= 0 || max > options || min >= options- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base,I18n.t("poll.default_poll_with_multiple_choices_has_invalid_parameters"),@@ -210,7 +210,7 @@ module DiscoursePoll@post.errors.add(:base, "Step #{I18n.t("errors.messages.greater_than", count: 0)}")valid = falseelsif ((max - min + 1) / step) < 2- if poll["name"] == ::DiscoursePoll::DEFAULT_POLL_NAME+ if poll["name"] == DiscoursePoll::DEFAULT_POLL_NAME@post.errors.add(:base, I18n.t("poll.default_poll_must_have_at_least_1_option"))else@post.errors.add(diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rbindex ca5691ccaf2..8c11179f021 100644--- a/plugins/poll/plugin.rb+++ b/plugins/poll/plugin.rb@@ -37,7 +37,7 @@ after_initialize dorequire_relative "lib/post_extension"require_relative "lib/user_extension"- Discourse::Application.routes.append { mount ::DiscoursePoll::Engine, at: "/polls" }+ Discourse::Application.routes.append { mount DiscoursePoll::Engine, at: "/polls" }allow_new_queued_post_payload_attribute("is_poll")register_post_custom_field_type(DiscoursePoll::HAS_POLLS, :boolean)diff --git a/plugins/poll/spec/controllers/polls_controller_spec.rb b/plugins/poll/spec/controllers/polls_controller_spec.rbindex a97a04209ca..dfa14025546 100644--- a/plugins/poll/spec/controllers/polls_controller_spec.rb+++ b/plugins/poll/spec/controllers/polls_controller_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: true-RSpec.describe ::DiscoursePoll::PollsController do- routes { ::DiscoursePoll::Engine.routes }+RSpec.describe DiscoursePoll::PollsController do+ routes { DiscoursePoll::Engine.routes }let!(:user) { log_in }let(:topic) { Fabricate(:topic) }diff --git a/plugins/poll/spec/lib/polls_validator_spec.rb b/plugins/poll/spec/lib/polls_validator_spec.rbindex 7d022f545cd..53f5d81ef0b 100644--- a/plugins/poll/spec/lib/polls_validator_spec.rb+++ b/plugins/poll/spec/lib/polls_validator_spec.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-RSpec.describe ::DiscoursePoll::PollsValidator do+RSpec.describe DiscoursePoll::PollsValidator dosubject(:validator) { described_class.new(post) }let(:post) { Fabricate(:post) }diff --git a/plugins/poll/spec/models/poll_spec.rb b/plugins/poll/spec/models/poll_spec.rbindex 6e577f1f5d7..1ffa24c40be 100644--- a/plugins/poll/spec/models/poll_spec.rb+++ b/plugins/poll/spec/models/poll_spec.rb@@ -1,11 +1,11 @@# frozen_string_literal: true-RSpec.describe ::DiscoursePoll::Poll do+RSpec.describe DiscoursePoll::Poll dodescribe ".transform_for_user_field_override" doit "Transforms UserField name if a matching CustomUserField is present" douser_field_name = "Something Cool"user_field = Fabricate(:user_field, name: user_field_name)- expect(::DiscoursePoll::Poll.transform_for_user_field_override(user_field_name)).to eq(+ expect(DiscoursePoll::Poll.transform_for_user_field_override(user_field_name)).to eq("user_field_#{user_field.id}",)end@@ -13,7 +13,7 @@ RSpec.describe ::DiscoursePoll::Poll doit "does not transform UserField name if a matching CustomUserField is not present" douser_field_name = "Something Cool"user_field = Fabricate(:user_field, name: "Something Else!")- expect(::DiscoursePoll::Poll.transform_for_user_field_override(user_field_name)).to eq(+ expect(DiscoursePoll::Poll.transform_for_user_field_override(user_field_name)).to eq(user_field_name,)enddiff --git a/plugins/styleguide/app/controllers/styleguide/styleguide_controller.rb b/plugins/styleguide/app/controllers/styleguide/styleguide_controller.rbindex 48acab9e0ea..82e18b1acdf 100644--- a/plugins/styleguide/app/controllers/styleguide/styleguide_controller.rb+++ b/plugins/styleguide/app/controllers/styleguide/styleguide_controller.rb@@ -2,7 +2,7 @@module Styleguideclass StyleguideController < ApplicationController- requires_plugin Styleguide::PLUGIN_NAME+ requires_plugin PLUGIN_NAMEskip_before_action :check_xhrdef indexdiff --git a/plugins/styleguide/lib/styleguide/engine.rb b/plugins/styleguide/lib/styleguide/engine.rbindex 588775eb66f..1fb69f5db71 100644--- a/plugins/styleguide/lib/styleguide/engine.rb+++ b/plugins/styleguide/lib/styleguide/engine.rb@@ -1,6 +1,6 @@# frozen_string_literal: true-module ::Styleguide+module Styleguideclass Engine < ::Rails::Engineengine_name PLUGIN_NAMEisolate_namespace Styleguidediff --git a/plugins/styleguide/plugin.rb b/plugins/styleguide/plugin.rbindex cfe0840b4bd..c48c7ed0ad9 100644--- a/plugins/styleguide/plugin.rb+++ b/plugins/styleguide/plugin.rb@@ -15,7 +15,7 @@ endrequire_relative "lib/styleguide/engine"-Discourse::Application.routes.append { mount ::Styleguide::Engine, at: "/styleguide" }+Discourse::Application.routes.append { mount Styleguide::Engine, at: "/styleguide" }after_initialize doregister_asset_filter do |type, request, opts|diff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rbindex fdb6104506e..a45a6dfb15d 100644--- a/script/bulk_import/base.rb+++ b/script/bulk_import/base.rb@@ -315,7 +315,7 @@ class BulkImport::Base@chat_message_mapping = load_index(MAPPING_TYPES[:chat_message])@last_chat_message_id = last_id(Chat::Message)- if defined?(::DiscourseReactions)+ if defined?(DiscourseReactions)puts "Loading reaction indexes..."@discourse_reaction_mapping = load_index(MAPPING_TYPES[:discourse_reactions_reaction])@last_discourse_reaction_id = last_id(DiscourseReactions::Reaction)@@ -516,7 +516,7 @@ class BulkImport::Basecreated_atupdated_at]- GROUP_COLUMNS << :assignable_level if defined?(::DiscourseAssign)+ GROUP_COLUMNS << :assignable_level if defined?(DiscourseAssign)USER_COLUMNS = %i[iddiff --git a/script/bulk_import/generic_bulk.rb b/script/bulk_import/generic_bulk.rbindex 69317bf5dd1..78028f3fe7d 100644--- a/script/bulk_import/generic_bulk.rb+++ b/script/bulk_import/generic_bulk.rb@@ -371,7 +371,7 @@ class BulkImport::Generic < BulkImport::Baseputs "", "Importing category moderation groups..."moderation_groups = query(<<~SQL)- SELECT c.id AS category_id,+ SELECT c.id AS category_id,m.value AS group_idFROM categories c,JSON_EACH(c.moderation_group_ids) m@@ -1125,15 +1125,15 @@ class BulkImport::Generic < BulkImport::Baseenddef event_bbcode(event)- return unless defined?(::DiscoursePostEvent)+ return unless defined?(DiscoursePostEvent)starts_at = to_datetime(event["starts_at"])ends_at = to_datetime(event["ends_at"])- status = ::DiscoursePostEvent::Event.statuses[event["status"]].to_s+ status = DiscoursePostEvent::Event.statuses[event["status"]].to_sname =if (name = event["name"].presence)- name.ljust(::DiscoursePostEvent::Event::MIN_NAME_LENGTH, ".").truncate(- ::DiscoursePostEvent::Event::MAX_NAME_LENGTH,+ name.ljust(DiscoursePostEvent::Event::MIN_NAME_LENGTH, ".").truncate(+ DiscoursePostEvent::Event::MAX_NAME_LENGTH,)endurl = event["url"]@@ -1648,7 +1648,7 @@ class BulkImport::Generic < BulkImport::Basedef import_user_notesputs "", "Importing user notes..."- unless defined?(::DiscourseUserNotes)+ unless defined?(DiscourseUserNotes)puts " Skipping import of user notes because the plugin is not installed."returnend@@ -1701,7 +1701,7 @@ class BulkImport::Generic < BulkImport::Basedef import_user_note_countsputs "", "Importing user note counts..."- unless defined?(::DiscourseUserNotes)+ unless defined?(DiscourseUserNotes)puts " Skipping import of user notes because the plugin is not installed."returnend@@ -2095,7 +2095,7 @@ class BulkImport::Generic < BulkImport::Basedef import_post_voting_votesputs "", "Importing votes for posts..."- unless defined?(::PostVoting)+ unless defined?(PostVoting)puts " Skipping import of votes for posts because the plugin is not installed."returnend@@ -2150,7 +2150,7 @@ class BulkImport::Generic < BulkImport::Baseenddef import_topic_voting_votes- unless defined?(::DiscourseTopicVoting)+ unless defined?(DiscourseTopicVoting)puts "", "Skipping topic voting votes, because the topic voting plugin is not installed."returnend@@ -2222,7 +2222,7 @@ class BulkImport::Generic < BulkImport::Baseenddef import_answers- unless defined?(::DiscourseSolved)+ unless defined?(DiscourseSolved)puts " Skipping import of solved topics"returnend@@ -2285,7 +2285,7 @@ class BulkImport::Generic < BulkImport::Basedef import_gamification_scoresputs "", "Importing gamification scores..."- unless defined?(::DiscourseGamification)+ unless defined?(DiscourseGamification)puts " Skipping import of gamification scores because the plugin is not installed."returnend@@ -2327,7 +2327,7 @@ class BulkImport::Generic < BulkImport::Basedef import_post_eventsputs "", "Importing events..."- unless defined?(::DiscoursePostEvent)+ unless defined?(DiscoursePostEvent)puts " Skipping import of events because the plugin is not installed."returnend@@ -2340,7 +2340,7 @@ class BulkImport::Generic < BulkImport::Basedefault_custom_fields = "{}"timezone = "UTC"- public_group_invitees = "{#{::DiscoursePostEvent::Event::PUBLIC_GROUP}}"+ public_group_invitees = "{#{DiscoursePostEvent::Event::PUBLIC_GROUP}}"standalone_invitees = "{}"existing_events = DiscoursePostEvent::Event.pluck(:id).to_set@@ -2360,7 +2360,7 @@ class BulkImport::Generic < BulkImport::Basetimezone: timezone,raw_invitees:(- if row["status"] == ::DiscoursePostEvent::Event.statuses[:public]+ if row["status"] == DiscoursePostEvent::Event.statuses[:public]public_group_inviteeselsestandalone_invitees@@ -3171,7 +3171,7 @@ class BulkImport::Generic < BulkImport::Baseenddef import_reaction_users- unless defined?(::DiscourseReactions)+ unless defined?(DiscourseReactions)puts "","Skipping reaction users import, because the Discourse Reactions plugin is not installed."return@@ -3211,7 +3211,7 @@ class BulkImport::Generic < BulkImport::Baseenddef import_reactions- unless defined?(::DiscourseReactions)+ unless defined?(DiscourseReactions)puts "", "Skipping reactions import, because the Discourse Reactions plugin is not installed."returnend@@ -3253,7 +3253,7 @@ class BulkImport::Generic < BulkImport::Baseenddef import_reaction_shadow_likes- unless defined?(::DiscourseReactions)+ unless defined?(DiscourseReactions)puts "","Skipping reaction shadow likes import, because the Discourse Reactions plugin is not installed."returndiff --git a/spec/jobs/crawl_topic_link_spec.rb b/spec/jobs/crawl_topic_link_spec.rbindex 95818fb2341..6904c2d2c64 100644--- a/spec/jobs/crawl_topic_link_spec.rb+++ b/spec/jobs/crawl_topic_link_spec.rb@@ -1,7 +1,7 @@# frozen_string_literal: trueRSpec.describe Jobs::CrawlTopicLink do- let(:job) { Jobs::CrawlTopicLink.new }+ subject(:job) { described_class.new }it "needs a topic_link_id" doexpect { job.execute({}) }.to raise_error(Discourse::InvalidParameters)diff --git a/spec/jobs/process_post_spec.rb b/spec/jobs/process_post_spec.rbindex 0053cab8f3a..bbc6b933b67 100644--- a/spec/jobs/process_post_spec.rb+++ b/spec/jobs/process_post_spec.rb@@ -99,8 +99,9 @@ RSpec.describe Jobs::ProcessPost doenddescribe "#enqueue_pull_hotlinked_images" do+ subject(:job) { described_class.new }+fab!(:post) { Fabricate(:post, created_at: 20.days.ago) }- let(:job) { Jobs::ProcessPost.new }it "runs even when download_remote_images_to_local is disabled" do# We want to run it to pull hotlinked optimized imagesdiff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex a854ef0a1e5..cf9fffaa89e 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -638,8 +638,9 @@ RSpec.describe Jobs::PullHotlinkedImages doenddescribe "#disable_if_low_on_disk_space" do+ subject(:job) { described_class.new }+fab!(:post) { Fabricate(:post, user: user, created_at: 20.days.ago) }- let(:job) { Jobs::PullHotlinkedImages.new }before doSiteSetting.download_remote_images_to_local = truediff --git a/spec/jobs/update_topic_hot_scores_spec.rb b/spec/jobs/update_topic_hot_scores_spec.rbindex 50feb31d81b..7ba777857ad 100644--- a/spec/jobs/update_topic_hot_scores_spec.rb+++ b/spec/jobs/update_topic_hot_scores_spec.rb@@ -3,7 +3,7 @@require "file_store/s3_store"RSpec.describe Jobs::UpdateTopicHotScores do- let(:job) { subject }+ subject(:job) { described_class.new }fab!(:topic) { Fabricate(:topic, created_at: 1.day.ago) }