diff --git a/Containerfile b/Containerfile
index abd2dde9e..a92bfc7e3 100644
--- a/Containerfile
+++ b/Containerfile
@@ -42,6 +42,8 @@ COPY . "${APP_HOME}"
RUN mkdir -p "${APP_HOME}"/public/{assets,images,packs,podcasts,uploads}
+RUN NODE_ENV=production yarn install
+
RUN RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile
RUN echo $(date -u +'%Y-%m-%dT%H:%M:%SZ') >> "${APP_HOME}"/FOREM_BUILD_DATE && \
diff --git a/Gemfile b/Gemfile
index be1ebac54..4d54739bb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -77,13 +77,13 @@ gem "pundit", "~> 2.2" # Object oriented authorization for Rails applications
gem "rack-attack", "~> 6.6.0" # Used to throttle requests to prevent brute force attacks
gem "rack-cors", "~> 1.1" # Middleware that will make Rack-based apps CORS compatible
gem "rack-timeout", "~> 0.6" # Rack middleware which aborts requests that have been running for longer than a specified timeout
-gem "rails", "~> 6.1.5" # Ruby on Rails
+gem "rails", "~> 7.0.2.2" # Ruby on Rails
gem "ransack", "~> 2.6" # Searching and sorting
gem "recaptcha", "~> 5.9", require: "recaptcha/rails" # Helpers for the reCAPTCHA API
gem "redcarpet", "~> 3.5" # A fast, safe and extensible Markdown to (X)HTML parser
gem "redis", "~> 4.6.0" # Redis ruby client
-gem "redis-actionpack", "5.3.0" # Redis session store for ActionPack. Used for storing the Rails session in Redis.
+gem "redis-actionpack", "~> 5.3.0" # Redis session store for ActionPack. Used for storing the Rails session in Redis.
gem "rpush", "~> 7.0" # Push Notification library for Rails
gem "rpush-redis", "~> 1.1" # Redis module capability for rpush library
@@ -98,7 +98,7 @@ gem "sidekiq", "~> 6.4.1" # Sidekiq is used to process background jobs with the
gem "sidekiq-cron", "~> 1.1" # Allows execution of scheduled cron jobs as specific times
gem "sidekiq-unique-jobs", "~> 7.1.15" # Ensures that Sidekiq jobs are unique when enqueued
gem "slack-notifier", "~> 2.4" # A slim ruby wrapper for posting to slack webhooks
-gem "sprockets", "~> 4.0" # Sprockets is a Rack-based asset packaging system
+gem "sprockets-rails", "~> 3.4" # Sprockets Rails integration
gem "staccato", "~> 0.5" # Ruby Google Analytics Measurement
gem "sterile", "~> 1.0" # Transliterate Unicode and Latin1 text to 7-bit ASCII for URLs
gem "stripe", "~> 5.48" # Ruby library for the Stripe API
diff --git a/Gemfile.lock b/Gemfile.lock
index 7e52b9b7e..3b7e81f38 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -9,67 +9,73 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actioncable (6.1.5)
- actionpack (= 6.1.5)
- activesupport (= 6.1.5)
+ actioncable (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (6.1.5)
- actionpack (= 6.1.5)
- activejob (= 6.1.5)
- activerecord (= 6.1.5)
- activestorage (= 6.1.5)
- activesupport (= 6.1.5)
+ actionmailbox (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
mail (>= 2.7.1)
- actionmailer (6.1.5)
- actionpack (= 6.1.5)
- actionview (= 6.1.5)
- activejob (= 6.1.5)
- activesupport (= 6.1.5)
+ net-imap
+ net-pop
+ net-smtp
+ actionmailer (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ actionview (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
mail (~> 2.5, >= 2.5.4)
+ net-imap
+ net-pop
+ net-smtp
rails-dom-testing (~> 2.0)
- actionpack (6.1.5)
- actionview (= 6.1.5)
- activesupport (= 6.1.5)
- rack (~> 2.0, >= 2.0.9)
+ actionpack (7.0.2.3)
+ actionview (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
+ rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
- actiontext (6.1.5)
- actionpack (= 6.1.5)
- activerecord (= 6.1.5)
- activestorage (= 6.1.5)
- activesupport (= 6.1.5)
+ actiontext (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
+ globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (6.1.5)
- activesupport (= 6.1.5)
+ actionview (7.0.2.3)
+ activesupport (= 7.0.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_record_union (1.3.0)
activerecord (>= 4.0)
- activejob (6.1.5)
- activesupport (= 6.1.5)
+ activejob (7.0.2.3)
+ activesupport (= 7.0.2.3)
globalid (>= 0.3.6)
- activemodel (6.1.5)
- activesupport (= 6.1.5)
- activerecord (6.1.5)
- activemodel (= 6.1.5)
- activesupport (= 6.1.5)
- activestorage (6.1.5)
- actionpack (= 6.1.5)
- activejob (= 6.1.5)
- activerecord (= 6.1.5)
- activesupport (= 6.1.5)
+ activemodel (7.0.2.3)
+ activesupport (= 7.0.2.3)
+ activerecord (7.0.2.3)
+ activemodel (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
+ activestorage (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
- activesupport (6.1.5)
+ activesupport (7.0.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
- zeitwerk (~> 2.3)
acts-as-taggable-on (9.0.1)
activerecord (>= 6.0, < 7.1)
addressable (2.8.0)
@@ -207,6 +213,7 @@ GEM
actionmailer (>= 5.0)
devise (>= 4.6)
diff-lcs (1.5.0)
+ digest (3.1.0)
docile (1.3.5)
dogstatsd-ruby (4.8.3)
domain_name (0.5.20190701)
@@ -406,6 +413,7 @@ GEM
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.5.9)
+ io-wait (0.2.1)
irb (1.3.7)
reline (>= 0.2.7)
jaro_winkler (1.5.4)
@@ -489,6 +497,21 @@ GEM
connection_pool (~> 2.2)
net-http2 (0.18.4)
http-2 (~> 0.11)
+ net-imap (0.2.3)
+ digest
+ net-protocol
+ strscan
+ net-pop (0.1.1)
+ digest
+ net-protocol
+ timeout
+ net-protocol (0.1.2)
+ io-wait
+ timeout
+ net-smtp (0.3.1)
+ digest
+ net-protocol
+ timeout
netrc (0.11.0)
nio4r (2.5.8)
nokogiri (1.13.3)
@@ -504,8 +527,8 @@ GEM
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.5.6)
- oauth2 (1.4.9)
- faraday (>= 0.17.3, < 3.0)
+ oauth2 (1.4.7)
+ faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
@@ -526,7 +549,7 @@ GEM
omniauth-github (2.0.0)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.7.1)
- omniauth-google-oauth2 (1.0.1)
+ omniauth-google-oauth2 (1.0.0)
jwt (>= 2.0)
oauth2 (~> 1.1)
omniauth (~> 2.0)
@@ -534,7 +557,7 @@ GEM
omniauth-oauth (1.2.0)
oauth
omniauth (>= 1.0, < 3)
- omniauth-oauth2 (1.7.2)
+ omniauth-oauth2 (1.7.1)
oauth2 (~> 1.4)
omniauth (>= 1.9, < 3)
omniauth-rails_csrf_protection (1.0.1)
@@ -584,21 +607,20 @@ GEM
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-timeout (0.6.0)
- rails (6.1.5)
- actioncable (= 6.1.5)
- actionmailbox (= 6.1.5)
- actionmailer (= 6.1.5)
- actionpack (= 6.1.5)
- actiontext (= 6.1.5)
- actionview (= 6.1.5)
- activejob (= 6.1.5)
- activemodel (= 6.1.5)
- activerecord (= 6.1.5)
- activestorage (= 6.1.5)
- activesupport (= 6.1.5)
+ rails (7.0.2.3)
+ actioncable (= 7.0.2.3)
+ actionmailbox (= 7.0.2.3)
+ actionmailer (= 7.0.2.3)
+ actionpack (= 7.0.2.3)
+ actiontext (= 7.0.2.3)
+ actionview (= 7.0.2.3)
+ activejob (= 7.0.2.3)
+ activemodel (= 7.0.2.3)
+ activerecord (= 7.0.2.3)
+ activestorage (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
bundler (>= 1.15.0)
- railties (= 6.1.5)
- sprockets-rails (>= 2.0.0)
+ railties (= 7.0.2.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
@@ -607,12 +629,13 @@ GEM
rails-i18n (7.0.3)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
- railties (6.1.5)
- actionpack (= 6.1.5)
- activesupport (= 6.1.5)
+ railties (7.0.2.3)
+ actionpack (= 7.0.2.3)
+ activesupport (= 7.0.2.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
+ zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
ransack (2.6.0)
@@ -816,6 +839,7 @@ GEM
stripe (> 5, < 6)
strong_migrations (1.0.0)
activerecord (>= 5.2)
+ strscan (3.0.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
test-prof (1.0.7)
@@ -824,6 +848,7 @@ GEM
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.9.5)
+ timeout (0.2.0)
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
@@ -996,12 +1021,12 @@ DEPENDENCIES
rack-cors (~> 1.1)
rack-host-redirect (~> 1.3)
rack-timeout (~> 0.6)
- rails (~> 6.1.5)
+ rails (~> 7.0.2.2)
ransack (~> 2.6)
recaptcha (~> 5.9)
redcarpet (~> 3.5)
redis (~> 4.6.0)
- redis-actionpack (= 5.3.0)
+ redis-actionpack (~> 5.3.0)
request_store (~> 1.5)
reverse_markdown (~> 2.1)
rolify (~> 6.0)
@@ -1027,7 +1052,7 @@ DEPENDENCIES
slack-notifier (~> 2.4)
solargraph (~> 0.44)
solargraph-rails (~> 0.3.1)
- sprockets (~> 4.0)
+ sprockets-rails (~> 3.4)
staccato (~> 0.5)
stackprof (~> 0.2)
sterile (~> 1.0)
diff --git a/app/javascript/article-form/components/Preview.jsx b/app/javascript/article-form/components/Preview.jsx
index bb770fd2c..47273148d 100644
--- a/app/javascript/article-form/components/Preview.jsx
+++ b/app/javascript/article-form/components/Preview.jsx
@@ -17,7 +17,9 @@ function titleArea({
return (
tag.length > 0 && (
- #
+
+ #
+
{tag}
)
diff --git a/bin/rails b/bin/rails
index 6fb4e4051..efc037749 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../config/application', __dir__)
+APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 2f45c39cb..3a3a3a251 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -14,6 +14,9 @@ Rails.application.configure do
# Show full error reports.
config.consider_all_requests_local = true
+ # Enable server timing
+ config.server_timing = true
+
config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"], expires_in: 1.hour.to_i }
# Enable/disable caching. By default caching is disabled.
@@ -27,6 +30,8 @@ Rails.application.configure do
}
else
config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
end
# Don't care if the mailer can't send.
diff --git a/config/environments/test.rb b/config/environments/test.rb
index da4ac9685..fcff0b982 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -12,7 +12,7 @@ Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# https://guides.rubyonrails.org/configuring.html#config-cache-classes
- config.cache_classes = true
+ config.cache_classes = false
# See https://github.com/rails/rails/issues/40613#issuecomment-727283155
config.action_view.cache_template_loading = true
@@ -73,7 +73,7 @@ Rails.application.configure do
# enable Bullet in testing mode only if requested
config.after_initialize do
Bullet.enable = true
- Bullet.raise = true
+ Bullet.raise = false
Bullet.add_safelist(type: :unused_eager_loading, class_name: "ApiSecret", association: :user)
# acts-as-taggable-on has super weird eager loading problems:
diff --git a/config/initializers/honeycomb.rb b/config/initializers/honeycomb.rb
index 027d51726..19db074c0 100644
--- a/config/initializers/honeycomb.rb
+++ b/config/initializers/honeycomb.rb
@@ -1,3 +1,5 @@
+require_relative "../../app/lib/honeycomb/noise_cancelling_sampler"
+
if Rails.env.test?
Honeycomb.configure do |config|
config.client = Libhoney::TestClient.new
diff --git a/config/initializers/middlewares.rb b/config/initializers/middlewares.rb
index 60898dca8..a9fdda3b4 100644
--- a/config/initializers/middlewares.rb
+++ b/config/initializers/middlewares.rb
@@ -1,3 +1,6 @@
+require_relative "../../app/lib/middlewares/set_cookie_domain"
+require_relative "../../app/lib/middlewares/set_time_zone"
+
Rails.configuration.middleware.use(Middlewares::SetCookieDomain) if Rails.env.production?
# Include middleware to ensure timezone for browser requests for Capybara specs
diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb
new file mode 100644
index 000000000..a579326e2
--- /dev/null
+++ b/config/initializers/new_framework_defaults_7_0.rb
@@ -0,0 +1,117 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file eases your Rails 7.0 framework defaults upgrade.
+#
+# Uncomment each configuration one by one to switch to the new default.
+# Once your application is ready to run with all new defaults, you can remove
+# this file and set the `config.load_defaults` to `7.0`.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
+
+# `button_to` view helper will render `