Skip to content

A platform for community discussion. Free, open, simple.

DEV: Upgrade Rails to version 8.0.2

Loïc Guitaut0eab7daea450
diff --git a/.annotaterb.yml b/.annotaterb.yml
new file mode 100644
index 00000000000..bff89c0762e
--- /dev/null
+++ b/.annotaterb.yml
@@ -0,0 +1,60 @@
+---
+:position: after
+:position_in_additional_file_patterns: before
+:position_in_class: after
+:position_in_factory: before
+:position_in_fixture: before
+:position_in_routes: before
+:position_in_serializer: before
+:position_in_test: before
+:classified_sort: true
+:exclude_controllers: true
+:exclude_factories: true
+:exclude_fixtures: true
+:exclude_helpers: true
+:exclude_scaffolds: true
+:exclude_serializers: true
+:exclude_sti_subclasses: false
+:exclude_tests: true
+:force: false
+:format_markdown: false
+:format_rdoc: false
+:format_yard: false
+:frozen: false
+:ignore_model_sub_dir: false
+:ignore_unknown_models: false
+:include_version: false
+:show_check_constraints: false
+:show_complete_foreign_keys: false
+:show_foreign_keys: true
+:show_indexes: true
+:simple_indexes: false
+:sort: false
+:timestamp: false
+:trace: false
+:with_comment: false
+:with_column_comments: false
+:with_table_comments: false
+:active_admin: false
+:command:
+:debug: false
+:hide_default_column_types: ""
+:hide_limit_column_types: ""
+:timestamp_columns:
+ - created_at
+ - updated_at
+:ignore_columns:
+:ignore_routes:
+:models: true
+:routes: false
+:skip_on_db_migrate: true
+:target_action: :do_annotations
+:wrapper:
+:wrapper_close:
+:wrapper_open:
+:classes_default_to_s: []
+:additional_file_patterns: []
+:model_dir: <%= Dir["app/models", "plugins/*/app/models"] %>
+:require: []
+:root_dir:
+ - ""
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 25269b0450f..2f19e903299 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -175,6 +175,7 @@ jobs:
${{ env.LOAD_PLUGINS }}-
${{ env.USES_PARALLEL_DATABASES }}-
${{ env.PARALLEL_TEST_PROCESSORS }}-
+ ${{ matrix.target }}-
- name: Restore database from cache
if: steps.app-cache.outputs.cache-hit == 'true'
@@ -186,6 +187,8 @@ jobs:
- name: Create and migrate database
if: steps.app-cache.outputs.cache-hit != 'true'
+ env:
+ LOAD_PLUGINS: ${{ (matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}
run: |
bin/rake db:create
script/silence_successful_output bin/rake db:migrate
@@ -194,6 +197,8 @@ jobs:
if: >-
env.USES_PARALLEL_DATABASES == 'true' &&
steps.app-cache.outputs.cache-hit != 'true'
+ env:
+ LOAD_PLUGINS: ${{ (matrix.target == 'plugins' || matrix.target == 'chat') && '1' || '0' }}
run: |
bin/rake parallel:create
script/silence_successful_output bin/rake parallel:migrate
@@ -227,7 +232,7 @@ jobs:
directories="$(script/list_bundled_plugins | xargs -I{} find {} -type d -path '*/app/models' -maxdepth 3)"
fi
- bin/annotate --models --model-dir $(echo "${directories}" | tr '\n' ',')
+ bin/annotaterb models --model-dir $(echo "${directories}" | tr '\n' ',')
if [ ! -z "$(git status --porcelain ${directories})" ]; then
echo "Core annotations are not up to date. To resolve, run:"
diff --git a/Gemfile b/Gemfile
index dac33b674f2..4304dc07975 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,13 +8,13 @@ source "https://rubygems.org"
gem "bootsnap", require: false, platform: :mri
-gem "actionmailer", "~> 7.2.0"
-gem "actionpack", "~> 7.2.0"
-gem "actionview", "~> 7.2.0"
-gem "activemodel", "~> 7.2.0"
-gem "activerecord", "~> 7.2.0"
-gem "activesupport", "~> 7.2.0"
-gem "railties", "~> 7.2.0"
+gem "actionmailer", "~> 8.0.0"
+gem "actionpack", "~> 8.0.0"
+gem "actionview", "~> 8.0.0"
+gem "activemodel", "~> 8.0.0"
+gem "activerecord", "~> 8.0.0"
+gem "activesupport", "~> 8.0.0"
+gem "railties", "~> 8.0.0"
gem "propshaft"
@@ -144,7 +144,7 @@ group :test, :development do
gem "rswag-specs"
- gem "annotate"
+ gem "annotaterb"
gem "syntax_tree"
diff --git a/Gemfile.lock b/Gemfile.lock
index b2b3ddfd875..35ee6b865c5 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,26 +1,25 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (7.2.2.1)
- actionpack (= 7.2.2.1)
- actionview (= 7.2.2.1)
- activejob (= 7.2.2.1)
- activesupport (= 7.2.2.1)
+ actionmailer (8.0.2)
+ actionpack (= 8.0.2)
+ actionview (= 8.0.2)
+ activejob (= 8.0.2)
+ activesupport (= 8.0.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
- actionpack (7.2.2.1)
- actionview (= 7.2.2.1)
- activesupport (= 7.2.2.1)
+ actionpack (8.0.2)
+ actionview (= 8.0.2)
+ activesupport (= 8.0.2)
nokogiri (>= 1.8.5)
- racc
- rack (>= 2.2.4, < 3.2)
+ rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
- actionview (7.2.2.1)
- activesupport (= 7.2.2.1)
+ actionview (8.0.2)
+ activesupport (= 8.0.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
@@ -29,16 +28,16 @@ GEM
actionview (>= 6.0.a)
active_model_serializers (0.8.4)
activemodel (>= 3.0)
- activejob (7.2.2.1)
- activesupport (= 7.2.2.1)
+ activejob (8.0.2)
+ activesupport (= 8.0.2)
globalid (>= 0.3.6)
- activemodel (7.2.2.1)
- activesupport (= 7.2.2.1)
- activerecord (7.2.2.1)
- activemodel (= 7.2.2.1)
- activesupport (= 7.2.2.1)
+ activemodel (8.0.2)
+ activesupport (= 8.0.2)
+ activerecord (8.0.2)
+ activemodel (= 8.0.2)
+ activesupport (= 8.0.2)
timeout (>= 0.4.0)
- activesupport (7.2.2.1)
+ activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
@@ -50,11 +49,12 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
+ uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
- annotate (3.2.0)
- activerecord (>= 3.2, < 8.0)
- rake (>= 10.4, < 14.0)
+ annotaterb (4.16.0)
+ activerecord (>= 6.0.0)
+ activesupport (>= 6.0.0)
ast (2.4.3)
aws-eventstream (1.4.0)
aws-partitions (1.1117.0)
@@ -433,9 +433,9 @@ GEM
rails_multisite (6.1.0)
activerecord (>= 6.0)
railties (>= 6.0)
- railties (7.2.2.1)
- actionpack (= 7.2.2.1)
- activesupport (= 7.2.2.1)
+ railties (8.0.2)
+ actionpack (= 8.0.2)
+ activesupport (= 8.0.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
@@ -670,16 +670,16 @@ PLATFORMS
x86_64-linux-musl
DEPENDENCIES
- actionmailer (~> 7.2.0)
- actionpack (~> 7.2.0)
- actionview (~> 7.2.0)
+ actionmailer (~> 8.0.0)
+ actionpack (~> 8.0.0)
+ actionview (~> 8.0.0)
actionview_precompiler
active_model_serializers (~> 0.8.3)
- activemodel (~> 7.2.0)
- activerecord (~> 7.2.0)
- activesupport (~> 7.2.0)
+ activemodel (~> 8.0.0)
+ activerecord (~> 8.0.0)
+ activesupport (~> 8.0.0)
addressable
- annotate
+ annotaterb
aws-sdk-s3
aws-sdk-sns
better_errors
@@ -772,7 +772,7 @@ DEPENDENCIES
rails-dom-testing
rails_failover
rails_multisite
- railties (~> 7.2.0)
+ railties (~> 8.0.0)
rake
rb-fsevent
rbtrace
@@ -820,17 +820,17 @@ DEPENDENCIES
zendesk_api (= 1.38.0.rc1)
CHECKSUMS
- actionmailer (7.2.2.1) sha256=b02ae523c32c8ad762d4db941e76f3c108c106030132247ee7a7b8c86bc7b21f
- actionpack (7.2.2.1) sha256=17b2160a7bcbd5a569d06b1ae54a4bb5ccc7ba0815d73ff5768100a79dc1f734
- actionview (7.2.2.1) sha256=69fc880cf3d8b1baf21b048cf7bb68f1eef08760ff8104d7d60a6a1be8b359a5
+ actionmailer (8.0.2) sha256=b0c968b38576ec56a3dc2795931818e0aaae6a18cc9801f53f175c12d4b277d0
+ actionpack (8.0.2) sha256=93e703064f3815295ccf820f57acbca719aec836749597da9262781c9b2f4b78
+ actionview (8.0.2) sha256=e038e1405cdfc18f04f17243da4fb8eeda3a4992f63a6d70a7281d255cf7cebb
actionview_precompiler (0.4.0) sha256=33b6bd6ec4c1b856e02fdf5f6512c9eb4a92ac1c0545e941b3e354b7d540ed1c
active_model_serializers (0.8.4) sha256=7350e3d3b6a5946bbec033241d908013cc85ff4d584230e6aa074225547c754c
- activejob (7.2.2.1) sha256=f2f95a8573b394aa4f7c24843f0c4a6065c073a5c64d6f15ecd98d98c2c23e5b
- activemodel (7.2.2.1) sha256=8398861f9ee2c4671a8357ab39e9b38a045fd656f6685a3dd5890c2419dbfdaf
- activerecord (7.2.2.1) sha256=79a31f71c32d5138717c2104e0ff105f5d82922247c85bdca144f2720e67fab9
- activesupport (7.2.2.1) sha256=842bcbf8a92977f80fb4750661a237cf5dd4fdd442066b3c35e88afb488647f5
+ activejob (8.0.2) sha256=b0228b45e36b1ef3a081c684e81494147e094a6baf729018756ccf125b1853ca
+ activemodel (8.0.2) sha256=0ae1fb7fa1fae0699ba041a9e97702df42ea3b13f2d39f2d0fde51fca5f0656c
+ activerecord (8.0.2) sha256=793470b92c44e4198d0262ac60086b7822f0ea585079ad67e32a6e4c86f2d90a
+ activesupport (8.0.2) sha256=8565cddba31b900cdc17682fd66ecd020441e3eef320a9930285394e8c07a45e
addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232
- annotate (3.2.0) sha256=9a61baa1fb13880aa3a8d9f62553889bb2a3b7970f88bbc66d3ac75a567780d3
+ annotaterb (4.16.0) sha256=3ed087a925b306036139e4191b38044390bcfc4561adece8f779f9d5ee87ca3c
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
aws-eventstream (1.4.0) sha256=116bf85c436200d1060811e6f5d2d40c88f65448f2125bc77ffce5121e6e183b
aws-partitions (1.1117.0) sha256=fe6469ff7426b449c0c6d0aa43e45f387a4b26992bf48f6897c0b730b205a8a3
@@ -1027,7 +1027,7 @@ CHECKSUMS
rails-html-sanitizer (1.6.2) sha256=35fce2ca8242da8775c83b6ba9c1bcaad6751d9eb73c1abaa8403475ab89a560
rails_failover (2.3.0) sha256=eed6ea0674fd6f9f6b070ad297ad2ead121ecf9202920f6068b6a4f29d9491c9
rails_multisite (6.1.0) sha256=7bd7b83b89e292375d595cc7714ae061e3056e7f295295af8c4575b6271186aa
- railties (7.2.2.1) sha256=e3f11bf116dd6d0d874522843ccc70ec0f89fbfed3e9c2ee48a4778cd042fe1f
+ railties (8.0.2) sha256=0d7c3f40c49ba74980f1bac1d4bb153a9331c5ee8a9631d89c7bf79db82e5cf9
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
raindrops (0.20.1) sha256=aa0eb9ff6834f2d9e232ba688bd49cb30be893bc5a3452e74722c94c1fab4730
rake (13.3.0) sha256=96f5092d786ff412c62fde76f793cc0541bd84d2eb579caa529aa8a059934493
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index d6b4cfb632b..356114ebef1 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -594,7 +594,8 @@ class CategoriesController < ApplicationController
require_reply_approval
require_topic_approval
],
- custom_fields: [custom_field_params],
+ custom_fields: {
+ },
permissions: [*p.try(:keys)],
allowed_tags: [],
allowed_tag_groups: [],
@@ -610,13 +611,6 @@ class CategoriesController < ApplicationController
end
end
- def custom_field_params
- keys = params[:custom_fields].try(:keys)
- return if keys.blank?
-
- keys.map { |key| params[:custom_fields][key].is_a?(Array) ? { key => [] } : key }
- end
-
def fetch_category
@category = Category.find_by_slug(params[:id]) || Category.find_by(id: params[:id].to_i)
raise Discourse::NotFound if @category.blank?
diff --git a/app/models/directory_item.rb b/app/models/directory_item.rb
index 470275996ac..f8e4b14ad36 100644
--- a/app/models/directory_item.rb
+++ b/app/models/directory_item.rb
@@ -179,17 +179,17 @@ end
# Table name: directory_items
#
# id :integer not null, primary key
-# period_type :integer not null
-# user_id :integer not null
-# likes_received :integer not null
+# days_visited :integer default(0), not null
# likes_given :integer not null
-# topics_entered :integer not null
-# topic_count :integer not null
+# likes_received :integer not null
+# period_type :integer not null
# post_count :integer not null
+# posts_read :integer default(0), not null
+# topic_count :integer not null
+# topics_entered :integer not null
# created_at :datetime
# updated_at :datetime
-# days_visited :integer default(0), not null
-# posts_read :integer default(0), not null
+# user_id :integer not null
#
# Indexes
#
diff --git a/app/models/incoming_email.rb b/app/models/incoming_email.rb
index bd77ed8bee5..12bf4abf547 100644
--- a/app/models/incoming_email.rb
+++ b/app/models/incoming_email.rb
@@ -74,27 +74,27 @@ end
# Table name: incoming_emails
#
# id :integer not null, primary key
-# user_id :integer
-# topic_id :integer
-# post_id :integer
-# raw :text
+# cc_addresses :text
+# created_via :integer default(0), not null
# error :text
-# message_id :text
# from_address :text
-# to_addresses :text
-# cc_addresses :text
+# imap_missing :boolean default(FALSE), not null
+# imap_sync :boolean
+# imap_uid :integer
+# imap_uid_validity :integer
+# is_auto_generated :boolean default(FALSE)
+# is_bounce :boolean default(FALSE), not null
+# raw :text
+# rejection_message :text
# subject :text
+# to_addresses :text
# created_at :datetime not null
# updated_at :datetime not null
-# rejection_message :text
-# is_auto_generated :boolean default(FALSE)
-# is_bounce :boolean default(FALSE), not null
-# imap_uid_validity :integer
-# imap_uid :integer
-# imap_sync :boolean
# imap_group_id :bigint
-# imap_missing :boolean default(FALSE), not null
-# created_via :integer default(0), not null
+# message_id :text
+# post_id :integer
+# topic_id :integer
+# user_id :integer
#
# Indexes
#
diff --git a/app/models/javascript_cache.rb b/app/models/javascript_cache.rb
index 876b14752c6..9163022ae00 100644
--- a/app/models/javascript_cache.rb
+++ b/app/models/javascript_cache.rb
@@ -38,19 +38,19 @@ end
# Table name: javascript_caches
#
# id :bigint not null, primary key
-# theme_field_id :bigint
-# digest :string
# content :text not null
+# digest :string
+# name :string
+# source_map :text
# created_at :datetime not null
# updated_at :datetime not null
+# theme_field_id :bigint
# theme_id :bigint
-# source_map :text
-# name :string
#
# Indexes
#
# index_javascript_caches_on_digest (digest)
-# index_javascript_caches_on_theme_field_id_and_name (theme_field_id,name) UNIQUE WHERE (theme_field_id IS NOT NULL)
+# index_javascript_caches_on_theme_field_id_and_name (theme_field_id,name) UNIQUE NULLS NOT DISTINCT WHERE (theme_field_id IS NOT NULL)
# index_javascript_caches_on_theme_id (theme_id) UNIQUE
#
# Foreign Keys
diff --git a/app/models/post_custom_field.rb b/app/models/post_custom_field.rb
index 91384800b96..945cdbea222 100644
--- a/app/models/post_custom_field.rb
+++ b/app/models/post_custom_field.rb
@@ -11,11 +11,11 @@ end
# Table name: post_custom_fields
#
# id :integer not null, primary key
-# post_id :integer not null
# name :string(256) not null
# value :text
# created_at :datetime not null
# updated_at :datetime not null
+# post_id :integer not null
#
# Indexes
#
diff --git a/app/models/post_revision.rb b/app/models/post_revision.rb
index 62e35f604e9..921267d3a08 100644
--- a/app/models/post_revision.rb
+++ b/app/models/post_revision.rb
@@ -63,16 +63,17 @@ end
# Table name: post_revisions
#
# id :integer not null, primary key
-# user_id :integer
-# post_id :integer
+# hidden :boolean default(FALSE), not null
# modifications :text
# number :integer
# created_at :datetime not null
# updated_at :datetime not null
-# hidden :boolean default(FALSE), not null
+# post_id :integer
+# user_id :integer
#
# Indexes
#
# index_post_revisions_on_post_id (post_id)
# index_post_revisions_on_post_id_and_number (post_id,number)
# index_post_revisions_on_user_id (user_id)
+#
diff --git a/app/models/topic_custom_field.rb b/app/models/topic_custom_field.rb
index 6a8a799bad3..a5d17a93167 100644
--- a/app/models/topic_custom_field.rb
+++ b/app/models/topic_custom_field.rb
@@ -11,11 +11,11 @@ end
# Table name: topic_custom_fields
#
# id :integer not null, primary key
-# topic_id :integer not null
# name :string(256) not null
# value :text
# created_at :datetime not null
# updated_at :datetime not null
+# topic_id :integer not null
#
# Indexes
#
diff --git a/app/models/user_custom_field.rb b/app/models/user_custom_field.rb
index 7c0abdf066d..178bcd90159 100644
--- a/app/models/user_custom_field.rb
+++ b/app/models/user_custom_field.rb
@@ -21,11 +21,11 @@ end
# Table name: user_custom_fields
#
# id :integer not null, primary key
-# user_id :integer not null
# name :string(256) not null
# value :text
# created_at :datetime not null
# updated_at :datetime not null
+# user_id :integer not null
#
# Indexes
#
diff --git a/app/models/user_option.rb b/app/models/user_option.rb
index 53a1c17b121..0d057c6045d 100644
--- a/app/models/user_option.rb
+++ b/app/models/user_option.rb
@@ -244,51 +244,51 @@ end
#
# Table name: user_options
#
-# user_id :integer not null, primary key
-# mailing_list_mode :boolean default(FALSE), not null
-# email_digests :boolean
-# external_links_in_new_tab :boolean default(FALSE), not null
-# enable_quoting :boolean default(TRUE), not null
-# dynamic_favicon :boolean default(FALSE), not null
+# allow_private_messages :boolean default(TRUE), not null
+# auto_track_topics_after_msecs :integer
# automatically_unpin_topics :boolean default(TRUE), not null
+# bookmark_auto_delete_preference :integer default(3), not null
+# default_calendar :integer default("none_selected"), not null
# digest_after_minutes :integer
-# auto_track_topics_after_msecs :integer
-# new_topic_duration_minutes :integer
-# last_redirected_to_top_at :datetime
-# email_previous_replies :integer default(2), not null
+# dynamic_favicon :boolean default(FALSE), not null
+# email_digests :boolean
# email_in_reply_to :boolean default(TRUE), not null
-# like_notification_frequency :integer default(1), not null
-# mailing_list_mode_frequency :integer default(1), not null
-# include_tl0_in_digests :boolean default(FALSE)
-# notification_level_when_replying :integer
-# theme_key_seq :integer default(0), not null
-# allow_private_messages :boolean default(TRUE), not null
-# homepage_id :integer
-# theme_ids :integer default([]), not null, is an Array
-# hide_profile_and_presence :boolean default(FALSE), not null
-# text_size_key :integer default(0), not null
-# text_size_seq :integer default(0), not null
# email_level :integer default(1), not null
# email_messages_level :integer default(0), not null
-# title_count_mode_key :integer default(0), not null
-# enable_defer :boolean default(FALSE), not null
-# timezone :string
+# email_previous_replies :integer default(2), not null
# enable_allowed_pm_users :boolean default(FALSE), not null
-# dark_scheme_id :integer
-# skip_new_user_tips :boolean default(FALSE), not null
-# color_scheme_id :integer
-# default_calendar :integer default("none_selected"), not null
-# oldest_search_log_date :datetime
-# bookmark_auto_delete_preference :integer default(3), not null
+# enable_defer :boolean default(FALSE), not null
# enable_experimental_sidebar :boolean default(FALSE)
+# enable_quoting :boolean default(TRUE), not null
+# enable_smart_lists :boolean default(TRUE), not null
+# external_links_in_new_tab :boolean default(FALSE), not null
+# hide_presence :boolean default(FALSE), not null
+# hide_profile :boolean default(FALSE), not null
+# hide_profile_and_presence :boolean default(FALSE), not null
+# include_tl0_in_digests :boolean default(FALSE)
+# last_redirected_to_top_at :datetime
+# like_notification_frequency :integer default(1), not null
+# mailing_list_mode :boolean default(FALSE), not null
+# mailing_list_mode_frequency :integer default(1), not null
+# new_topic_duration_minutes :integer
+# notification_level_when_replying :integer
+# oldest_search_log_date :datetime
# seen_popups :integer is an Array
# sidebar_link_to_filtered_list :boolean default(FALSE), not null
# sidebar_show_count_of_new_items :boolean default(FALSE), not null
-# watched_precedence_over_muted :boolean
+# skip_new_user_tips :boolean default(FALSE), not null
+# text_size_key :integer default(0), not null
+# text_size_seq :integer default(0), not null
+# theme_ids :integer default([]), not null, is an Array
+# theme_key_seq :integer default(0), not null
+# timezone :string
+# title_count_mode_key :integer default(0), not null
# topics_unread_when_closed :boolean default(TRUE), not null
-# enable_smart_lists :boolean default(TRUE), not null
-# hide_profile :boolean default(FALSE), not null
-# hide_presence :boolean default(FALSE), not null
+# watched_precedence_over_muted :boolean
+# color_scheme_id :integer
+# dark_scheme_id :integer
+# homepage_id :integer
+# user_id :integer not null, primary key
#
# Indexes
#
diff --git a/bin/annotate b/bin/annotaterb
similarity index 55%
rename from bin/annotate
rename to bin/annotaterb
index bfae06c94be..e6adc886e06 100755
--- a/bin/annotate
+++ b/bin/annotaterb
@@ -4,18 +4,16 @@
#
# This file was generated by Bundler.
#
-# The application 'annotate' is installed as part of a gem, and
+# The application 'annotaterb' is installed as part of a gem, and
# this file is here to facilitate running it.
#
-require "pathname"
-ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
- Pathname.new(__FILE__).realpath)
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
-bundle_binstub = File.expand_path("../bundle", __FILE__)
+bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub)
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
@@ -26,4 +24,4 @@ end
require "rubygems"
require "bundler/setup"
-load Gem.bin_path("annotate", "annotate")
+load Gem.bin_path("annotaterb", "annotaterb")
diff --git a/config/application.rb b/config/application.rb
index 7a8fe47a3ba..16fc852ee7f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -78,7 +78,7 @@ module Discourse
# tiny file needed by site settings
require "highlight_js"
- config.load_defaults 7.2
+ config.load_defaults 8.0
config.yjit = GlobalSetting.yjit_enabled
config.active_record.cache_versioning = false # our custom cache class doesn’t support this
config.action_controller.forgery_protection_origin_check = false
diff --git a/config/routes.rb b/config/routes.rb
index e1ae12947aa..1ad1698545e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -497,7 +497,7 @@ Discourse::Application.routes.draw do
format: :js,
}
- resources :session, id: RouteFormat.username, only: %i[create destroy become] do
+ resources :session, id: RouteFormat.username, only: %i[create destroy] do
get "become" if !Rails.env.production?
collection { post "forgot_password" }
diff --git a/lib/freedom_patches/fast_pluck.rb b/lib/freedom_patches/fast_pluck.rb
deleted file mode 100644
index b33e7a2723d..00000000000
--- a/lib/freedom_patches/fast_pluck.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# frozen_string_literal: true
-
-# Speeds up #pluck so its about 2.2x faster, importantly makes pluck avoid creation of a slew
-# of AR objects
-#
-#
-class ActiveRecord::Relation
- # Note: In discourse, the following code is included in lib/sql_builder.rb
- #
- # class RailsDateTimeDecoder < PG::SimpleDecoder
- # def decode(string, tuple=nil, field=nil)
- # if Rails.version >= "4.2.0"
- # @caster ||= ActiveRecord::Type::DateTime.new
- # @caster.type_cast_from_database(string)
- # else
- # ActiveRecord::ConnectionAdapters::Column.string_to_time string
- # end
- # end
- # end
- #
- # class ActiveRecordTypeMap < PG::BasicTypeMapForResults
- # def initialize(connection)
- # super(connection)
- # rm_coder 0, 1114
- # add_coder RailsDateTimeDecoder.new(name: "timestamp", oid: 1114, format: 0)
- # # we don't need deprecations
- # self.default_type_map = PG::TypeMapInRuby.new
- # end
- # end
- #
- # def self.pg_type_map
- # conn = ActiveRecord::Base.connection.raw_connection
- # @typemap ||= ActiveRecordTypeMap.new(conn)
- # end
-
- class ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- def select_raw(arel, name = nil, binds = [], &block)
- arel = arel_from_relation(arel)
- sql, binds = to_sql_and_binds(arel, binds)
- execute_and_clear(sql, name, binds, &block)
- end
- end
-
- def pluck(*column_names)
- if loaded? &&
- (column_names.map(&:to_s) - @klass.attribute_names - @klass.attribute_aliases.keys).empty?
- return records.pluck(*column_names)
- end
-
- if has_include?(column_names.first)
- relation = apply_join_dependency
- relation.pluck(*column_names)
- else
- relation = spawn
-
- relation.select_values = column_names
-
- klass
- .connection
- .select_raw(relation.arel) do |result, _|
- result.type_map = DB.type_map
- result.nfields == 1 ? result.column_values(0) : result.values
- end
- end
- end
-end
-
-# require 'benchmark/ips'
-#
-# ENV['RAILS_ENV'] = 'production'
-# require File.expand_path("../../config/environment", __FILE__)
-#
-# Benchmark.ips do |x|
-# x.report("fast_pluck") do
-# Post.where(topic_id: 48464).fast_pluck(:id)
-# end
-#
-# x.report("pluck") do
-# Post.where(topic_id: 48464).pluck(:id)
-# end
-# end
-#
-# % ruby tmp/fast_pluck.rb
-# Calculating -------------------------------------
-# fast_pluck 165.000 i/100ms
-# pluck 80.000 i/100ms
-# -------------------------------------------------
-# fast_pluck 1.720k (± 8.8%) i/s - 8.580k
-# pluck 807.913 (± 4.0%) i/s - 4.080k
-#
diff --git a/lib/sidekiq_migration.rb b/lib/sidekiq_migration.rb
index 12df82fd273..832563bf808 100644
--- a/lib/sidekiq_migration.rb
+++ b/lib/sidekiq_migration.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true
# TODO: Remove this after the Discourse 3.5 release
+
+require "sidekiq/api"
+
class SidekiqMigration
delegate :old_pool, to: :Sidekiq
diff --git a/lib/tasks/annotate.rake b/lib/tasks/annotate.rake
index 7a45699d34d..f0b07b540f2 100644
--- a/lib/tasks/annotate.rake
+++ b/lib/tasks/annotate.rake
@@ -2,14 +2,14 @@
desc "ensure the asynchronously-created post_search_data index is present"
task "annotate" => :environment do |task, args|
- system("bin/annotate --models", exception: true)
+ system("bin/annotaterb models", exception: true)
STDERR.puts "Annotate executed successfully"
non_core_plugins =
Dir["plugins/*"].filter { |plugin_path| `git check-ignore #{plugin_path}`.present? }
if non_core_plugins.length > 0
STDERR.puts "Warning: you have non-core plugins installed which may affect the annotations"
- STDERR.puts "For core annotations, consider running `bin/rake annotate:clean`"
+ STDERR.puts "For core annotations, consider running `bin/rails annotate:clean`"
end
end
@@ -27,10 +27,10 @@ task "annotate:clean" => :environment do |task, args|
db = TemporaryDb.new
db.start
db.with_env do
- system("RAILS_ENV=test LOAD_PLUGINS=0 bin/rake db:migrate", exception: true)
- system("RAILS_ENV=test LOAD_PLUGINS=0 bin/rake annotate:ensure_all_indexes", exception: true)
+ system("RAILS_ENV=test LOAD_PLUGINS=0 bin/rails db:migrate", exception: true)
+ system("RAILS_ENV=test LOAD_PLUGINS=0 bin/rails annotate:ensure_all_indexes", exception: true)
system(
- "RAILS_ENV=test LOAD_PLUGINS=0 bin/annotate --models --model-dir app/models",
+ "RAILS_ENV=test LOAD_PLUGINS=0 bin/annotaterb models --model-dir app/models",
exception: true,
)
end
@@ -47,10 +47,10 @@ task "annotate:clean:plugins", [:plugin] => :environment do |task, args|
db = TemporaryDb.new
db.start
db.with_env do
- system("RAILS_ENV=test LOAD_PLUGINS=1 bin/rake db:migrate", exception: true)
- system("RAILS_ENV=test LOAD_PLUGINS=1 bin/rake annotate:ensure_all_indexes", exception: true)
+ system("RAILS_ENV=test LOAD_PLUGINS=1 bin/rails db:migrate", exception: true)
+ system("RAILS_ENV=test LOAD_PLUGINS=1 bin/rails annotate:ensure_all_indexes", exception: true)
system(
- "RAILS_ENV=test LOAD_PLUGINS=1 bin/annotate --models #{specific_plugin}",
+ "RAILS_ENV=test LOAD_PLUGINS=1 bin/annotaterb models #{specific_plugin}",
exception: true,
)
end
diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake
new file mode 100644
index 00000000000..7ce18a50e5a
--- /dev/null
+++ b/lib/tasks/annotate_rb.rake
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+# This rake task was added by annotate_rb gem.
+
+# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this
+if Rails.env.development? && ENV["ANNOTATERB_SKIP_ON_DB_TASKS"].nil?
+ require "annotate_rb"
+
+ AnnotateRb::Core.load_rake_tasks
+end
diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake
deleted file mode 100644
index cbc1840ad2a..00000000000
--- a/lib/tasks/auto_annotate_models.rake
+++ /dev/null
@@ -1,38 +0,0 @@
-# frozen_string_literal: true
-
-# NOTE: only doing this in development as some production environments (Heroku)
-# NOTE: are sensitive to local FS writes, and besides -- it's just not proper
-# NOTE: to have a dev-mode tool do its thing in production.
-if (Rails.env.development? || Rails.env.test?)
- task :set_annotation_options do
- # You can override any of these by setting an environment variable of the
- # same name.
- Annotate.set_defaults(
- "position_in_routes" => "before",
- "position_in_class" => "after",
- "position_in_test" => "before",
- "position_in_fixture" => "before",
- "position_in_factory" => "before",
- "show_indexes" => "true",
- "simple_indexes" => "false",
- "model_dir" => ["app/models"] + Dir.glob("plugins/*/app/models"),
- "include_version" => "false",
- "require" => "",
- "exclude_tests" => "true",
- "exclude_fixtures" => "true",
- "exclude_helpers" => "true",
- "exclude_factories" => "true",
- "exclude_serializers" => "true",
- "exclude_controllers" => "true",
- "ignore_model_sub_dir" => "false",
- "skip_on_db_migrate" => "true",
- "format_bare" => "true",
- "format_rdoc" => "false",
- "format_markdown" => "false",
- "sort" => "false",
- "force" => "false",
- "trace" => "false",
- "show_foreign_keys" => "true",
- )
- end
-end
diff --git a/spec/requests/application_controller_spec.rb b/spec/requests/application_controller_spec.rb
index 80617fd5956..bdd66b65d05 100644
--- a/spec/requests/application_controller_spec.rb
+++ b/spec/requests/application_controller_spec.rb
@@ -335,7 +335,7 @@ RSpec.describe ApplicationController do
expect(response.status).to eq(400)
expect(response.parsed_body["errors"].first).to include(
- "param is missing or the value is empty: term",
+ "param is missing or the value is empty or invalid: term",
)
end
end
diff --git a/spec/requests/list_controller_spec.rb b/spec/requests/list_controller_spec.rb
index ebdc1f89548..2410ebf86ec 100644
--- a/spec/requests/list_controller_spec.rb
+++ b/spec/requests/list_controller_spec.rb
@@ -1613,7 +1613,7 @@ RSpec.describe ListController do
fab!(:topic_in_private_category) { Fabricate(:topic, category: private_category) }
it "does not return topics that are unlisted when `q` query param is `status:unlisted` for a user that cannot view unlisted topics" do
- Topic.update_all(deleted_at: true)
+ Topic.update_all(deleted_at: Time.current)
topic.update!(visible: false)
sign_in(user)
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index 2b7a5349722..045f8e3c549 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -1934,7 +1934,7 @@ RSpec.describe UsersController do
username: "dude",
password: "P4ssw0rd$$",
user_fields: {
- [tennis_field.id] => "Nadal",
+ tennis_field.id => "Nadal",
},
)
@@ -6473,7 +6473,7 @@ RSpec.describe UsersController do
expect(response.status).to eq(400)
expect(response.parsed_body["errors"][0]).to eq(
- "param is missing or the value is empty: name",
+ "param is missing or the value is empty or invalid: name",
)
end