A platform for community discussion. Free, open, simple.
DEV: update syntax tree to latest (#24623)
Samb09422428d3b
diff --git a/Gemfile.lock b/Gemfile.lockindex f19fb2d149a..3dc4aeed419 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -484,7 +484,7 @@ GEMsprockets (>= 3.0.0)sshkey (3.0.0)stackprof (0.2.25)- syntax_tree (6.1.1)+ syntax_tree (6.2.0)prettier_print (>= 1.2.0)syntax_tree-disable_ternary (1.0.0)test-prof (1.3.0)diff --git a/app/controllers/admin/api_controller.rb b/app/controllers/admin/api_controller.rbindex 6238287c067..aaa5929e5aa 100644--- a/app/controllers/admin/api_controller.rb+++ b/app/controllers/admin/api_controller.rb@@ -14,7 +14,6 @@ class Admin::ApiController < Admin::AdminControllerApiKey.where(hidden: false).includes(:user, :api_key_scopes)- # Sort revoked keys by revoked_at and active keys by created_at.order("revoked_at DESC NULLS FIRST, created_at DESC").offset(offset).limit(limit)diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rbindex 71320a2db10..7ae69f3c466 100644--- a/app/jobs/scheduled/clean_up_uploads.rb+++ b/app/jobs/scheduled/clean_up_uploads.rb@@ -33,11 +33,11 @@ module Jobs.where("uploads.retain_hours IS NULL OR uploads.created_at < current_timestamp - interval '1 hour' * uploads.retain_hours",)- .where("uploads.created_at < ?", grace_period.hour.ago)- # Don't remove any secure uploads.+ .where("uploads.created_at < ?", grace_period.hour.ago) # Don't remove any secure uploads..where("uploads.access_control_post_id IS NULL")- .joins("LEFT JOIN upload_references ON upload_references.upload_id = uploads.id")- # Don't remove any uploads linked to an UploadReference.+ .joins(+ "LEFT JOIN upload_references ON upload_references.upload_id = uploads.id",+ ) # Don't remove any uploads linked to an UploadReference..where("upload_references.upload_id IS NULL").with_no_non_post_relationsdiff --git a/app/models/api_key.rb b/app/models/api_key.rbindex c8611418b74..e86d27d2a95 100644--- a/app/models/api_key.rb+++ b/app/models/api_key.rb@@ -12,10 +12,10 @@ class ApiKey < ActiveRecord::Basescope :revoked, -> { where("revoked_at IS NOT NULL") }scope :with_key,- ->(key) {+ ->(key) dohashed = self.hash_key(key)where(key_hash: hashed)- }+ endvalidates :description, length: { maximum: 255 }diff --git a/app/models/bookmark.rb b/app/models/bookmark.rbindex 239824566ba..911fe9f1ff9 100644--- a/app/models/bookmark.rb+++ b/app/models/bookmark.rb@@ -130,14 +130,14 @@ class Bookmark < ActiveRecord::Basescope :with_reminders, -> { where("reminder_at IS NOT NULL") }scope :pending_reminders,- ->(before_time = Time.now.utc) {+ ->(before_time = Time.now.utc) dowith_reminders.where("reminder_at <= ?", before_time).where(reminder_last_sent_at: nil)- }+ endscope :pending_reminders_for_user, ->(user) { pending_reminders.where(user: user) }scope :for_user_in_topic,- ->(user_id, topic_id) {+ ->(user_id, topic_id) dojoins("LEFT JOIN posts ON posts.id = bookmarks.bookmarkable_id AND bookmarks.bookmarkable_type = 'Post'",).joins(@@ -149,7 +149,7 @@ class Bookmark < ActiveRecord::Baseuser_id: user_id,topic_id: topic_id,)- }+ enddef self.count_per_day(opts = nil)opts ||= {}diff --git a/app/models/category.rb b/app/models/category.rbindex 0c13d560e02..69d1cf35078 100644--- a/app/models/category.rb+++ b/app/models/category.rb@@ -170,7 +170,7 @@ class Category < ActiveRecord::Basescope :latest, -> { order("topic_count DESC") }scope :secured,- ->(guardian = nil) {+ ->(guardian = nil) doids = guardian.secure_category_ids if guardianif ids.present?@@ -181,13 +181,13 @@ class Category < ActiveRecord::Baseelsewhere("NOT categories.read_restricted").references(:categories)end- }+ endTOPIC_CREATION_PERMISSIONS ||= [:full]POST_CREATION_PERMISSIONS ||= %i[create_post full]scope :topic_create_allowed,- ->(guardian) {+ ->(guardian) doscoped = scoped_to_permissions(guardian, TOPIC_CREATION_PERMISSIONS)if !SiteSetting.allow_uncategorized_topics && !guardian.is_staff?@@ -195,7 +195,7 @@ class Category < ActiveRecord::Baseendscoped- }+ endscope :post_create_allowed,->(guardian) { scoped_to_permissions(guardian, POST_CREATION_PERMISSIONS) }diff --git a/app/models/email_token.rb b/app/models/email_token.rbindex 7a04e7c2296..5cfcfc446d8 100644--- a/app/models/email_token.rb+++ b/app/models/email_token.rb@@ -10,12 +10,12 @@ class EmailToken < ActiveRecord::Basescope :unconfirmed, -> { where(confirmed: false) }scope :active,- -> {+ -> dowhere(expired: false).where("created_at >= ?",SiteSetting.email_token_valid_hours.hours.ago,)- }+ endafter_initialize doif self.token_hash.blank?diff --git a/app/models/external_upload_stub.rb b/app/models/external_upload_stub.rbindex 10004f29069..baa9bbfb9c1 100644--- a/app/models/external_upload_stub.rb+++ b/app/models/external_upload_stub.rb@@ -17,22 +17,22 @@ class ExternalUploadStub < ActiveRecord::Base}scope :expired_created,- -> {+ -> dowhere("status = ? AND created_at <= ?",ExternalUploadStub.statuses[:created],CREATED_EXPIRY_HOURS.hours.ago,)- }+ endscope :expired_uploaded,- -> {+ -> dowhere("status = ? AND created_at <= ?",ExternalUploadStub.statuses[:uploaded],UPLOADED_EXPIRY_HOURS.hours.ago,)- }+ endbefore_create doself.unique_identifier = SecureRandom.uuiddiff --git a/app/models/notification.rb b/app/models/notification.rbindex 91c506a28dd..4fe1d393b73 100644--- a/app/models/notification.rb+++ b/app/models/notification.rb@@ -25,14 +25,14 @@ class Notification < ActiveRecord::Base}scope :unread_type, ->(user, type, limit = 30) { unread_types(user, [type], limit) }scope :unread_types,- ->(user, types, limit = 30) {+ ->(user, types, limit = 30) dowhere(user_id: user.id, read: false, notification_type: types).visible.includes(:topic).limit(limit)- }+ endscope :prioritized,- ->(deprioritized_types = []) {+ ->(deprioritized_types = []) doscope = order("notifications.high_priority AND NOT notifications.read DESC")if deprioritized_types.present?scope =@@ -46,11 +46,11 @@ class Notification < ActiveRecord::Basescope = scope.order("NOT notifications.read DESC")endscope.order("notifications.created_at DESC")- }+ endscope :for_user_menu,- ->(user_id, limit: 30) {+ ->(user_id, limit: 30) dowhere(user_id: user_id).visible.prioritized.includes(:topic).limit(limit)- }+ endattr_accessor :skip_send_emaildiff --git a/app/models/post.rb b/app/models/post.rbindex bf391920499..473e306911a 100644--- a/app/models/post.rb+++ b/app/models/post.rb@@ -89,13 +89,13 @@ class Post < ActiveRecord::Baseregister_custom_field_type(NOTICE, :json)scope :private_posts_for_user,- ->(user) {+ ->(user) dowhere("topics.id IN (#{Topic::PRIVATE_MESSAGES_SQL_USER})OR topics.id IN (#{Topic::PRIVATE_MESSAGES_SQL_GROUP})",user_id: user.id,)- }+ endscope :by_newest, -> { order("created_at DESC, id DESC") }scope :by_post_number, -> { order("post_number ASC") }@@ -111,7 +111,7 @@ class Post < ActiveRecord::Base->(guardian) { where("posts.post_type IN (?)", Topic.visible_post_types(guardian&.user)) }scope :for_mailing_list,- ->(user, since) {+ ->(user, since) doq =created_since(since).joins("INNER JOIN (#{Topic.for_digest(user, Time.at(0)).select(:id).to_sql}) AS digest_topics ON digest_topics.id = posts.topic_id",@@ -120,10 +120,10 @@ class Post < ActiveRecord::Baseq = q.where.not(post_type: Post.types[:whisper]) unless user.staff?q- }+ endscope :raw_match,- ->(pattern, type = "string") {+ ->(pattern, type = "string") dotype = type&.downcasecase type@@ -132,10 +132,10 @@ class Post < ActiveRecord::Basewhen "regex"where("raw ~* ?", "(?n)#{pattern}")end- }+ endscope :have_uploads,- -> {+ -> dowhere("(@@ -151,7 +151,7 @@ class Post < ActiveRecord::Base)","%/uploads/#{RailsMultisite::ConnectionManagement.current_db}/%",)- }+ enddelegate :username, to: :userdiff --git a/app/models/remote_theme.rb b/app/models/remote_theme.rbindex 85f7f47ed28..774ab344400 100644--- a/app/models/remote_theme.rb+++ b/app/models/remote_theme.rb@@ -34,11 +34,11 @@ class RemoteTheme < ActiveRecord::Basehas_one :theme, autosave: falsescope :joined_remotes,- -> {+ -> dojoins("JOIN themes ON themes.remote_theme_id = remote_themes.id").where.not(remote_url: "",)- }+ endvalidates_format_of :minimum_discourse_version,:maximum_discourse_version,diff --git a/app/models/tag.rb b/app/models/tag.rbindex 3076504e540..ac32eee2a70 100644--- a/app/models/tag.rb+++ b/app/models/tag.rb@@ -22,18 +22,18 @@ class Tag < ActiveRecord::Basevalidates :description, length: { maximum: 1000 }scope :where_name,- ->(name) {+ ->(name) doname = Array(name).map(&:downcase)where("lower(tags.name) IN (?)", name)- }+ end# tags that have never been used and don't belong to a tag groupscope :unused,- -> {+ -> dowhere(staff_topic_count: 0, pm_topic_count: 0, target_tag_id: nil).joins("LEFT JOIN tag_group_memberships tgm ON tags.id = tgm.tag_id",).where("tgm.tag_id IS NULL")- }+ endscope :used_tags_in_regular_topics,->(guardian) { where("tags.#{Tag.topic_count_column(guardian)} > 0") }diff --git a/app/models/tag_user.rb b/app/models/tag_user.rbindex 21a01e5c925..5b55a261dd2 100644--- a/app/models/tag_user.rb+++ b/app/models/tag_user.rb@@ -5,7 +5,7 @@ class TagUser < ActiveRecord::Basebelongs_to :userscope :notification_level_visible,- ->(notification_levels = TagUser.notification_levels.values) {+ ->(notification_levels = TagUser.notification_levels.values) doselect("tag_users.*").distinct.joins(@@ -24,7 +24,7 @@ class TagUser < ActiveRecord::Baseeveryone_group_id: Group::AUTO_GROUPS[:everyone],notification_levels: notification_levels,)- }+ enddef self.notification_levelsNotificationLevels.alldiff --git a/app/models/theme.rb b/app/models/theme.rbindex a644266c5a1..e471e14d36a 100644--- a/app/models/theme.rb+++ b/app/models/theme.rb@@ -75,7 +75,7 @@ class Theme < ActiveRecord::Basescope :user_selectable, -> { where("user_selectable OR id = ?", SiteSetting.default_theme_id) }scope :include_relations,- -> {+ -> doincludes(:child_themes,:parent_themes,@@ -88,7 +88,7 @@ class Theme < ActiveRecord::Base:theme_translation_overrides,theme_fields: :upload,)- }+ enddef notify_color_change(color, scheme: nil)scheme ||= color.color_schemediff --git a/app/models/theme_field.rb b/app/models/theme_field.rbindex 8173d49e492..c3d02c7fa63 100644--- a/app/models/theme_field.rb+++ b/app/models/theme_field.rb@@ -19,7 +19,7 @@ class ThemeField < ActiveRecord::Baseendscope :find_by_theme_ids,- ->(theme_ids) {+ ->(theme_ids) doreturn none unless theme_ids.present?where(theme_id: theme_ids).joins(@@ -27,10 +27,10 @@ class ThemeField < ActiveRecord::BaseSELECT #{theme_ids.map.with_index { |id, idx| "#{id.to_i} AS theme_id, #{idx} AS theme_sort_column" }.join(" UNION ALL SELECT ")}) as X ON X.theme_id = theme_fields.theme_id",).order("theme_sort_column")- }+ endscope :filter_locale_fields,- ->(locale_codes) {+ ->(locale_codes) doreturn none unless locale_codes.present?where(target_id: Theme.targets[:translations], name: locale_codes).joins(@@ -41,20 +41,20 @@ class ThemeField < ActiveRecord::Base*locale_codes.map.with_index { |code, index| [code, index] },),).order("Y.locale_sort_column")- }+ endscope :find_first_locale_fields,- ->(theme_ids, locale_codes) {+ ->(theme_ids, locale_codes) dofind_by_theme_ids(theme_ids).filter_locale_fields(locale_codes).reorder("X.theme_sort_column", "Y.locale_sort_column").select("DISTINCT ON (X.theme_sort_column) *")- }+ endscope :svg_sprite_fields,- -> {+ -> dowhere(type_id: ThemeField.theme_var_type_ids, name: SvgSprite.theme_sprite_variable_name)- }+ enddef self.types@types ||=diff --git a/app/models/topic.rb b/app/models/topic.rbindex 9457847360a..fab6c594b0d 100644--- a/app/models/topic.rb+++ b/app/models/topic.rb@@ -317,13 +317,13 @@ class Topic < ActiveRecord::BaseSQLscope :private_messages_for_user,- ->(user) {+ ->(user) doprivate_messages.where("topics.id IN (#{PRIVATE_MESSAGES_SQL_USER})OR topics.id IN (#{PRIVATE_MESSAGES_SQL_GROUP})",user_id: user.id,)- }+ endscope :listable_topics, -> { where("topics.archetype <> ?", Archetype.private_message) }diff --git a/app/models/topic_timer.rb b/app/models/topic_timer.rbindex 22abd8b3c96..9d4b5c3105e 100644--- a/app/models/topic_timer.rb+++ b/app/models/topic_timer.rb@@ -23,9 +23,9 @@ class TopicTimer < ActiveRecord::Basescope :scheduled_bump_topics,-> { where(status_type: TopicTimer.types[:bump], deleted_at: nil).pluck(:topic_id) }scope :pending_timers,- ->(before_time = Time.now.utc) {+ ->(before_time = Time.now.utc) dowhere("execute_at <= :before_time AND deleted_at IS NULL", before_time: before_time)- }+ endbefore_save doself.created_at ||= Time.zone.now if execute_atdiff --git a/app/models/user.rb b/app/models/user.rbindex 2b11ce613c5..a4a868fda44 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -103,7 +103,7 @@ class User < ActiveRecord::Basehas_many :badges, through: :user_badgeshas_many :default_featured_user_badges,- -> {+ -> domax_featured_rank =(if SiteSetting.max_favorite_badges > 0@@ -113,7 +113,7 @@ class User < ActiveRecord::Baseend)for_enabled_badges.grouped_with_count.where("featured_rank <= ?", max_featured_rank)- },+ end,class_name: "UserBadge"has_many :topics_allowed, through: :topic_allowed_users, source: :topic@@ -249,18 +249,18 @@ class User < ActiveRecord::Base->(email) { joins(:user_emails).where("lower(user_emails.email) IN (?)", email) }scope :with_primary_email,- ->(email) {+ ->(email) dojoins(:user_emails).where("lower(user_emails.email) IN (?) AND user_emails.primary",email,)- }+ endscope :human_users, -> { where("users.id > 0") }# excluding fake users like the system user or anonymous usersscope :real,- -> {+ -> dohuman_users.where("NOT EXISTS(SELECT 1@@ -268,7 +268,7 @@ class User < ActiveRecord::BaseWHERE a.user_id = users.id)",)- }+ end# TODO-PERF: There is no indexes on any of these# and NotifyMailingListSubscribers does a select-all-and-loop@@ -281,16 +281,16 @@ class User < ActiveRecord::Basescope :not_staged, -> { where(staged: false) }scope :filter_by_username,- ->(filter) {+ ->(filter) doif filter.is_a?(Array)where("username_lower ~* ?", "(#{filter.join("|")})")elsewhere("username_lower ILIKE ?", "%#{filter}%")end- }+ endscope :filter_by_username_or_email,- ->(filter) {+ ->(filter) doif filter.is_a?(String) && filter =~ /.+@.+/# probably an email so try the bypassif user_id = UserEmail.where("lower(email) = ?", filter.downcase).pick(:user_id)@@ -311,10 +311,10 @@ class User < ActiveRecord::Basefilter: "%#{filter}%",)end- }+ endscope :watching_topic,- ->(topic) {+ ->(topic) dojoins(DB.sql_fragment("LEFT JOIN category_users ON category_users.user_id = users.id AND category_users.category_id = :category_id",@@ -333,7 +333,7 @@ class User < ActiveRecord::Base.where("category_users.notification_level > 0 OR topic_users.notification_level > 0 OR tag_users.notification_level > 0",)- }+ endmodule NewTopicDurationALWAYS = -1diff --git a/app/models/user_badge.rb b/app/models/user_badge.rbindex 618632656c1..20d456d26a9 100644--- a/app/models/user_badge.rb+++ b/app/models/user_badge.rb@@ -10,15 +10,15 @@ class UserBadge < ActiveRecord::BaseBOOLEAN_ATTRIBUTES = %w[is_favorite]scope :grouped_with_count,- -> {+ -> dogroup(:badge_id, :user_id).select_for_grouping.order("MAX(featured_rank) ASC").includes(:user, :granted_by, { badge: :badge_type }, post: :topic)- }+ endscope :select_for_grouping,- -> {+ -> doselect(UserBadge.attribute_names.map do |name|operation = BOOLEAN_ATTRIBUTES.include?(name) ? "BOOL_OR" : "MAX"@@ -26,7 +26,7 @@ class UserBadge < ActiveRecord::Baseend,'COUNT(*) AS "count"',)- }+ endscope :for_enabled_badges,-> { where("user_badges.badge_id IN (SELECT id FROM badges WHERE enabled)") }diff --git a/app/models/user_custom_field.rb b/app/models/user_custom_field.rbindex 92255cc5648..fde4b371c6a 100644--- a/app/models/user_custom_field.rb+++ b/app/models/user_custom_field.rb@@ -4,11 +4,11 @@ class UserCustomField < ActiveRecord::Basebelongs_to :userscope :searchable,- -> {+ -> dojoins("INNER JOIN user_fields ON user_fields.id = REPLACE(user_custom_fields.name, 'user_field_', '')::INTEGER AND user_fields.searchable IS TRUE AND user_custom_fields.name like 'user_field_%'",)- }+ endend# == Schema Informationdiff --git a/app/models/watched_word.rb b/app/models/watched_word.rbindex e03bd95fd20..0ceccd5272d 100644--- a/app/models/watched_word.rb+++ b/app/models/watched_word.rb@@ -27,12 +27,12 @@ class WatchedWord < ActiveRecord::Baseafter_destroy -> { WordWatcher.clear_cache! }scope :for,- ->(word:) {+ ->(word:) dowhere("(word ILIKE :word AND case_sensitive = 'f') OR (word LIKE :word AND case_sensitive = 't')",word: word,)- }+ enddef self.actions@actions ||=diff --git a/plugins/chat/app/models/chat/channel.rb b/plugins/chat/app/models/chat/channel.rbindex 8e585bb0b09..652b12edf7b 100644--- a/plugins/chat/app/models/chat/channel.rb+++ b/plugins/chat/app/models/chat/channel.rb@@ -48,17 +48,17 @@ module Chatbefore_validation :generate_auto_slugscope :with_categories,- -> {+ -> dojoins("LEFT JOIN categories ON categories.id = chat_channels.chatable_id AND chat_channels.chatable_type = 'Category'",)- }+ endscope :public_channels,- -> {+ -> dowith_categories.where(chatable_type: public_channel_chatable_types).where("categories.id IS NOT NULL",)- }+ enddelegate :empty?, to: :chat_messages, prefix: truediff --git a/plugins/chat/app/models/chat/message.rb b/plugins/chat/app/models/chat/message.rbindex c3a5ea2cce8..d151a8cc3fa 100644--- a/plugins/chat/app/models/chat/message.rb+++ b/plugins/chat/app/models/chat/message.rb@@ -30,11 +30,11 @@ module Chatdependent: :destroy,foreign_key: :chat_message_idhas_many :bookmarks,- -> {+ -> dounscope(where: :bookmarkable_type).where(bookmarkable_type: Chat::Message.polymorphic_name,)- },+ end,as: :bookmarkable,dependent: :destroyhas_many :upload_references,@@ -53,21 +53,21 @@ module Chatforeign_key: :chat_message_idscope :in_public_channel,- -> {+ -> dojoins(:chat_channel).where(chat_channel: {chatable_type: Chat::Channel.public_channel_chatable_types,},)- }+ endscope :in_dm_channel,- -> {+ -> dojoins(:chat_channel).where(chat_channel: {chatable_type: Chat::Channel.direct_channel_chatable_types,},)- }+ endscope :created_before, ->(date) { where("chat_messages.created_at < ?", date) }scope :uncooked, -> { where("cooked_version <> ? or cooked_version IS NULL", BAKED_VERSION) }diff --git a/plugins/chat/app/models/chat/thread.rb b/plugins/chat/app/models/chat/thread.rbindex 1b852f7bec4..7531dfbd658 100644--- a/plugins/chat/app/models/chat/thread.rb+++ b/plugins/chat/app/models/chat/thread.rb@@ -17,11 +17,11 @@ module Chatclass_name: "Chat::Message"has_many :chat_messages,- -> {+ -> dowhere("deleted_at IS NULL").order("chat_messages.created_at ASC, chat_messages.id ASC",)- },+ end,foreign_key: :thread_id,primary_key: :id,class_name: "Chat::Message"diff --git a/spec/lib/backup_restore/s3_backup_store_spec.rb b/spec/lib/backup_restore/s3_backup_store_spec.rbindex 297572e131f..1d94b55932b 100644--- a/spec/lib/backup_restore/s3_backup_store_spec.rb+++ b/spec/lib/backup_restore/s3_backup_store_spec.rb@@ -25,27 +25,27 @@ RSpec.describe BackupRestore::S3BackupStore do@s3_client.stub_responses(:list_objects_v2,- ->(context) {+ ->(context) docheck_context(context){ contents: objects_with_prefix(context) }- },+ end,)@s3_client.stub_responses(:delete_object,- ->(context) {+ ->(context) docheck_context(context)expect do @objects.delete_if { |obj| obj[:key] == context.params[:key] } end.to change {@objects}- },+ end,)@s3_client.stub_responses(:head_object,- ->(context) {+ ->(context) docheck_context(context)if object = @objects.find { |obj| obj[:key] == context.params[:key] }@@ -53,12 +53,12 @@ RSpec.describe BackupRestore::S3BackupStore doelse{ status_code: 404, headers: {}, body: "" }end- },+ end,)@s3_client.stub_responses(:get_object,- ->(context) {+ ->(context) docheck_context(context)if object = @objects.find { |obj| obj[:key] == context.params[:key] }@@ -66,12 +66,12 @@ RSpec.describe BackupRestore::S3BackupStore doelse{ status_code: 404, headers: {}, body: "" }end- },+ end,)@s3_client.stub_responses(:put_object,- ->(context) {+ ->(context) docheck_context(context)@objects << {@@ -79,7 +79,7 @@ RSpec.describe BackupRestore::S3BackupStore dosize: context.params[:body].size,last_modified: Time.zone.now,}- },+ end,)SiteSetting.s3_backup_bucket = "s3-backup-bucket"diff --git a/spec/lib/inline_oneboxer_spec.rb b/spec/lib/inline_oneboxer_spec.rbindex cf821f0118b..ad32b243fc0 100644--- a/spec/lib/inline_oneboxer_spec.rb+++ b/spec/lib/inline_oneboxer_spec.rb@@ -130,9 +130,9 @@ RSpec.describe InlineOneboxer dotopic = Fabricate(:topic, title: "Inline oneboxer")Fabricate(:post, topic: topic) # OPFabricate(:post, topic: topic)- lookup = ->(number) {+ lookup = ->(number) doInlineOneboxer.lookup("#{topic.url}/#{number}", skip_cache: true)[:title]- }+ endposts = topic.reload.posts.order("post_number ASC")expect(lookup.call(0)).to eq("Inline oneboxer")diff --git a/spec/lib/middleware/request_tracker_spec.rb b/spec/lib/middleware/request_tracker_spec.rbindex 30705a0b897..8edb6319a71 100644--- a/spec/lib/middleware/request_tracker_spec.rb+++ b/spec/lib/middleware/request_tracker_spec.rb@@ -667,10 +667,10 @@ RSpec.describe Middleware::RequestTracker doendlet(:logger) do- ->(env, data) {+ ->(env, data) do@env = env@data = data- }+ endendbefore { Middleware::RequestTracker.register_detailed_request_logger(logger) }diff --git a/spec/lib/new_post_manager_spec.rb b/spec/lib/new_post_manager_spec.rbindex 429bcc3e891..16a8a6ce7fc 100644--- a/spec/lib/new_post_manager_spec.rb+++ b/spec/lib/new_post_manager_spec.rb@@ -382,9 +382,9 @@ RSpec.describe NewPostManager doresultend- @queue_handler = ->(manager) {+ @queue_handler = ->(manager) domanager.args[:raw] =~ /queue me/ ? manager.enqueue("default") : nil- }+ endNewPostManager.add_handler(&@counter_handler)NewPostManager.add_handler(&@queue_handler)diff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rbindex a501619faa4..1e7c6e5feff 100644--- a/spec/lib/plugin/instance_spec.rb+++ b/spec/lib/plugin/instance_spec.rb@@ -771,12 +771,12 @@ RSpec.describe Plugin::Instance doto: Notification.types[:code_review_commit_approved],threshold: 1,consolidation_window: 1.minute,- unconsolidated_query_blk: ->(notifications, _data) {+ unconsolidated_query_blk: ->(notifications, _data) donotifications.where("(data::json ->> 'consolidated') IS NULL")- },- consolidated_query_blk: ->(notifications, _data) {+ end,+ consolidated_query_blk: ->(notifications, _data) donotifications.where("(data::json ->> 'consolidated') IS NOT NULL")- },+ end,).set_mutations(set_data_blk: ->(notification) { notification.data_hash.merge(consolidated: true) },)diff --git a/spec/lib/post_destroyer_spec.rb b/spec/lib/post_destroyer_spec.rbindex 672190e6ec2..15550b1aeb8 100644--- a/spec/lib/post_destroyer_spec.rb+++ b/spec/lib/post_destroyer_spec.rb@@ -391,11 +391,11 @@ RSpec.describe PostDestroyer douser_stat = post2.user.user_statcalled = 0- topic_destroyed = ->(topic, user) {+ topic_destroyed = ->(topic, user) doexpect(topic).to eq(post2.topic)expect(user).to eq(post2.user)called += 1- }+ endDiscourseEvent.on(:topic_destroyed, &topic_destroyed)@@ -414,11 +414,11 @@ RSpec.describe PostDestroyer doexpect(user_stat.reload.topic_count).to eq(1)called = 0- topic_recovered = ->(topic, user) {+ topic_recovered = ->(topic, user) doexpect(topic).to eq(post2.topic)expect(user).to eq(post2.user)called += 1- }+ endDiscourseEvent.on(:topic_recovered, &topic_recovered)diff --git a/spec/lib/s3_inventory_spec.rb b/spec/lib/s3_inventory_spec.rbindex 92172aef965..1aaf094de18 100644--- a/spec/lib/s3_inventory_spec.rb+++ b/spec/lib/s3_inventory_spec.rb@@ -16,7 +16,7 @@ RSpec.describe "S3Inventory" doclient.stub_responses(:list_objects,- ->(context) {+ ->(context) doexpect(context.params[:prefix]).to eq("#{S3Inventory::INVENTORY_PREFIX}/#{S3Inventory::INVENTORY_VERSION}/bucket/original/hive",)@@ -48,7 +48,7 @@ RSpec.describe "S3Inventory" do],next_marker: "eyJNYXJrZXIiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAyfQ==",}- },+ end,)inventory.stubs(:cleanup!)diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rbindex 3efcf065fb8..19fe0f58d45 100644--- a/spec/models/report_spec.rb+++ b/spec/models/report_spec.rb@@ -206,14 +206,14 @@ RSpec.describe Report doif arg == :flaguser = Fabricate(:user)topic = Fabricate(:topic, user: user)- builder = ->(dt) {+ builder = ->(dt) doPostActionCreator.create(user,Fabricate(:post, topic: topic, user: user),:spam,created_at: dt,)- }+ endelsif arg == :signupbuilder = ->(dt) { Fabricate(:user, created_at: dt) }elsediff --git a/spec/models/topic_user_spec.rb b/spec/models/topic_user_spec.rbindex 79f762026c4..5cfb63fb02f 100644--- a/spec/models/topic_user_spec.rb+++ b/spec/models/topic_user_spec.rb@@ -590,10 +590,10 @@ RSpec.describe TopicUser docalled = 0visits = []- user_first_visit = ->(topic_id, user_id) {+ user_first_visit = ->(topic_id, user_id) dovisits << "#{topic_id}-#{user_id}"called += 1- }+ endDiscourseEvent.on(:topic_first_visited_by_user, &user_first_visit)diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rbindex 106ee53adad..fc9aa061680 100644--- a/spec/requests/topics_controller_spec.rb+++ b/spec/requests/topics_controller_spec.rb@@ -309,11 +309,11 @@ RSpec.describe TopicsController dobegincalled = false- assert = ->(original_topic, destination_topic) {+ assert = ->(original_topic, destination_topic) docalled = trueexpect(original_topic).to eq(topic)expect(destination_topic).to eq(dest_topic)- }+ endDiscourseEvent.on(:topic_merged, &assert)diff --git a/spec/services/user_silencer_spec.rb b/spec/services/user_silencer_spec.rbindex 574010d3120..c4f66015f94 100644--- a/spec/services/user_silencer_spec.rb+++ b/spec/services/user_silencer_spec.rb@@ -70,10 +70,10 @@ RSpec.describe UserSilencer docontext "with a plugin hook" dobefore do- @override_silence_message = ->(opts) {+ @override_silence_message = ->(opts) doopts[:silence_message_params][:message_title] = "override title"opts[:silence_message_params][:message_raw] = "override raw"- }+ endDiscourseEvent.on(:user_silenced, &@override_silence_message)end