mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
Compare commits
16 commits
e9ecfc7f42
...
795354f68c
Author | SHA1 | Date | |
---|---|---|---|
|
795354f68c | ||
|
a50c8e951f | ||
|
17f29dee5f | ||
|
724f87cdcc | ||
|
078abefda6 | ||
|
a78128b826 | ||
|
6a0cd08674 | ||
|
ed1f244a4e | ||
|
3f2bc347b9 | ||
|
2393a5b8db | ||
|
051b02a88c | ||
|
c66a7d3e78 | ||
|
dd6d932f19 | ||
|
25cb8c3a99 | ||
|
392657f545 | ||
|
2c1e75727d |
16 changed files with 220 additions and 165 deletions
7
Gemfile
7
Gemfile
|
@ -6,7 +6,7 @@ ruby '>= 3.1.0'
|
|||
gem 'propshaft'
|
||||
gem 'puma', '~> 6.3'
|
||||
gem 'rack', '~> 2.2.7'
|
||||
gem 'rails', '~> 7.1.1'
|
||||
gem 'rails', '7.2.0.beta3'
|
||||
gem 'thor', '~> 1.2'
|
||||
|
||||
gem 'dotenv'
|
||||
|
@ -63,6 +63,7 @@ gem 'kaminari', '~> 1.2'
|
|||
gem 'link_header', '~> 0.0'
|
||||
gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock'
|
||||
gem 'mime-types', '~> 3.5.0', require: 'mime/types/columnar'
|
||||
gem 'mutex_m'
|
||||
gem 'nokogiri', '~> 1.15'
|
||||
gem 'nsa'
|
||||
gem 'oj', '~> 3.14'
|
||||
|
@ -141,7 +142,7 @@ group :test do
|
|||
gem 'selenium-webdriver'
|
||||
|
||||
# Used to reset the database between system tests
|
||||
gem 'database_cleaner-active_record'
|
||||
gem 'database_cleaner-active_record', github: 'DatabaseCleaner/database_cleaner-active_record' # TODO: Release version?
|
||||
|
||||
# Used to mock environment variables
|
||||
gem 'climate_control'
|
||||
|
@ -208,7 +209,7 @@ group :development, :test do
|
|||
gem 'memory_profiler', require: false
|
||||
gem 'ruby-prof', require: false
|
||||
gem 'stackprof', require: false
|
||||
gem 'test-prof'
|
||||
gem 'test-prof', github: 'test-prof/test-prof'
|
||||
|
||||
# RSpec runner for rails
|
||||
gem 'rspec-rails', '~> 6.0'
|
||||
|
|
151
Gemfile.lock
151
Gemfile.lock
|
@ -7,38 +7,46 @@ GIT
|
|||
hkdf (~> 0.2)
|
||||
jwt (~> 2.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/DatabaseCleaner/database_cleaner-active_record.git
|
||||
revision: 79b08760d66369f43c40c49cc845a68ea9727e6e
|
||||
specs:
|
||||
database_cleaner-active_record (2.1.0)
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/test-prof/test-prof.git
|
||||
revision: 065ca2465118769a1a809dac66ff57f07562691d
|
||||
specs:
|
||||
test-prof (1.4.0.rc.4)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actioncable (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (>= 2.7.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailer (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailbox (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
activejob (= 7.2.0.beta3)
|
||||
activerecord (= 7.2.0.beta3)
|
||||
activestorage (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
actionview (= 7.2.0.beta3)
|
||||
activejob (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actionpack (7.2.0.beta3)
|
||||
actionview (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
nokogiri (>= 1.8.5)
|
||||
racc
|
||||
rack (>= 2.2.4)
|
||||
|
@ -46,15 +54,16 @@ GEM
|
|||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
actiontext (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
useragent (~> 0.16)
|
||||
actiontext (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
activerecord (= 7.2.0.beta3)
|
||||
activestorage (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
actionview (7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
|
@ -64,31 +73,31 @@ GEM
|
|||
activemodel (>= 4.1)
|
||||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
activejob (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activejob (7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activerecord (7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activemodel (7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
activerecord (7.2.0.beta3)
|
||||
activemodel (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
activestorage (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
activejob (= 7.2.0.beta3)
|
||||
activerecord (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.1.3.4)
|
||||
activesupport (7.2.0.beta3)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
logger (>= 1.4.2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
aes_key_wrap (1.1.0)
|
||||
|
@ -180,9 +189,6 @@ GEM
|
|||
css_parser (1.17.1)
|
||||
addressable
|
||||
csv (3.3.0)
|
||||
database_cleaner-active_record (2.2.0)
|
||||
activerecord (>= 5.a)
|
||||
database_cleaner-core (~> 2.0.0)
|
||||
database_cleaner-core (2.0.1)
|
||||
date (3.3.4)
|
||||
debug (1.9.2)
|
||||
|
@ -638,20 +644,20 @@ GEM
|
|||
rackup (1.0.0)
|
||||
rack (< 3)
|
||||
webrick
|
||||
rails (7.1.3.4)
|
||||
actioncable (= 7.1.3.4)
|
||||
actionmailbox (= 7.1.3.4)
|
||||
actionmailer (= 7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
actiontext (= 7.1.3.4)
|
||||
actionview (= 7.1.3.4)
|
||||
activejob (= 7.1.3.4)
|
||||
activemodel (= 7.1.3.4)
|
||||
activerecord (= 7.1.3.4)
|
||||
activestorage (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
rails (7.2.0.beta3)
|
||||
actioncable (= 7.2.0.beta3)
|
||||
actionmailbox (= 7.2.0.beta3)
|
||||
actionmailer (= 7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
actiontext (= 7.2.0.beta3)
|
||||
actionview (= 7.2.0.beta3)
|
||||
activejob (= 7.2.0.beta3)
|
||||
activemodel (= 7.2.0.beta3)
|
||||
activerecord (= 7.2.0.beta3)
|
||||
activestorage (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.1.3.4)
|
||||
railties (= 7.2.0.beta3)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
|
@ -666,10 +672,10 @@ GEM
|
|||
rails-i18n (7.0.9)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 6.0.0, < 8)
|
||||
railties (7.1.3.4)
|
||||
actionpack (= 7.1.3.4)
|
||||
activesupport (= 7.1.3.4)
|
||||
irb
|
||||
railties (7.2.0.beta3)
|
||||
actionpack (= 7.2.0.beta3)
|
||||
activesupport (= 7.2.0.beta3)
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
|
@ -836,7 +842,6 @@ GEM
|
|||
unicode-display_width (>= 1.1.1, < 3)
|
||||
terrapin (1.0.1)
|
||||
climate_control
|
||||
test-prof (1.3.3.1)
|
||||
thor (1.3.1)
|
||||
tilt (2.3.0)
|
||||
timeout (0.4.1)
|
||||
|
@ -866,6 +871,7 @@ GEM
|
|||
unf_ext (0.0.9.1)
|
||||
unicode-display_width (2.5.0)
|
||||
uri (0.13.0)
|
||||
useragent (0.16.10)
|
||||
validate_email (0.1.6)
|
||||
activemodel (>= 3.0)
|
||||
mail (>= 2.2.5)
|
||||
|
@ -930,7 +936,7 @@ DEPENDENCIES
|
|||
concurrent-ruby
|
||||
connection_pool
|
||||
csv (~> 3.2)
|
||||
database_cleaner-active_record
|
||||
database_cleaner-active_record!
|
||||
debug (~> 1.8)
|
||||
devise (~> 4.9)
|
||||
devise-two-factor
|
||||
|
@ -975,6 +981,7 @@ DEPENDENCIES
|
|||
md-paperclip-azure (~> 2.2)
|
||||
memory_profiler
|
||||
mime-types (~> 3.5.0)
|
||||
mutex_m
|
||||
net-http (~> 0.4.0)
|
||||
net-ldap (~> 0.18)
|
||||
nokogiri (~> 1.15)
|
||||
|
@ -1014,7 +1021,7 @@ DEPENDENCIES
|
|||
rack-attack (~> 6.6)
|
||||
rack-cors (~> 2.0)
|
||||
rack-test (~> 2.1)
|
||||
rails (~> 7.1.1)
|
||||
rails (= 7.2.0.beta3)
|
||||
rails-controller-testing (~> 1.0)
|
||||
rails-i18n (~> 7.0)
|
||||
rdf-normalize (~> 0.5)
|
||||
|
@ -1049,7 +1056,7 @@ DEPENDENCIES
|
|||
stackprof
|
||||
stoplight (~> 4.1)
|
||||
strong_migrations
|
||||
test-prof
|
||||
test-prof!
|
||||
thor (~> 1.2)
|
||||
tty-prompt (~> 0.23)
|
||||
twitter-text (~> 3.1.0)
|
||||
|
|
|
@ -60,7 +60,7 @@ export interface BaseNotificationGroupJSON {
|
|||
|
||||
interface NotificationGroupWithStatusJSON extends BaseNotificationGroupJSON {
|
||||
type: NotificationWithStatusType;
|
||||
status: ApiStatusJSON;
|
||||
status_id: string;
|
||||
}
|
||||
|
||||
interface NotificationWithStatusJSON extends BaseNotificationJSON {
|
||||
|
|
|
@ -49,21 +49,14 @@ export const FilteredNotificationsBanner: React.FC = () => {
|
|||
<span>
|
||||
<FormattedMessage
|
||||
id='filtered_notifications_banner.pending_requests'
|
||||
defaultMessage='Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know'
|
||||
defaultMessage='From {count, plural, =0 {no one} one {one person} other {# people}} you may know'
|
||||
values={{ count: policy.summary.pending_requests_count }}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className='filtered-notifications-banner__badge'>
|
||||
<div className='filtered-notifications-banner__badge__badge'>
|
||||
{toCappedNumber(policy.summary.pending_notifications_count)}
|
||||
</div>
|
||||
<FormattedMessage
|
||||
id='filtered_notifications_banner.mentions'
|
||||
defaultMessage='{count, plural, one {mention} other {mentions}}'
|
||||
values={{ count: policy.summary.pending_notifications_count }}
|
||||
/>
|
||||
{toCappedNumber(policy.summary.pending_notifications_count)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
|
|
@ -300,8 +300,7 @@
|
|||
"filter_modal.select_filter.subtitle": "Use an existing category or create a new one",
|
||||
"filter_modal.select_filter.title": "Filter this post",
|
||||
"filter_modal.title.status": "Filter a post",
|
||||
"filtered_notifications_banner.mentions": "{count, plural, one {mention} other {mentions}}",
|
||||
"filtered_notifications_banner.pending_requests": "Notifications from {count, plural, =0 {no one} one {one person} other {# people}} you may know",
|
||||
"filtered_notifications_banner.pending_requests": "From {count, plural, =0 {no one} one {one person} other {# people}} you may know",
|
||||
"filtered_notifications_banner.title": "Filtered notifications",
|
||||
"firehose.all": "All",
|
||||
"firehose.local": "This server",
|
||||
|
|
|
@ -124,9 +124,9 @@ export function createNotificationGroupFromJSON(
|
|||
case 'mention':
|
||||
case 'poll':
|
||||
case 'update': {
|
||||
const { status, ...groupWithoutStatus } = group;
|
||||
const { status_id: statusId, ...groupWithoutStatus } = group;
|
||||
return {
|
||||
statusId: status.id,
|
||||
statusId,
|
||||
sampleAccountIds,
|
||||
...groupWithoutStatus,
|
||||
};
|
||||
|
|
|
@ -10171,25 +10171,10 @@ noscript {
|
|||
}
|
||||
|
||||
&__badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 999px;
|
||||
background: var(--background-border-color);
|
||||
color: $darker-text-color;
|
||||
padding: 4px;
|
||||
padding-inline-end: 8px;
|
||||
gap: 6px;
|
||||
font-weight: 500;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
word-break: keep-all;
|
||||
|
||||
&__badge {
|
||||
background: $ui-button-background-color;
|
||||
color: $white;
|
||||
border-radius: 100px;
|
||||
padding: 2px 8px;
|
||||
}
|
||||
background: $ui-button-background-color;
|
||||
color: $white;
|
||||
border-radius: 100px;
|
||||
padding: 2px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class Admin::SystemCheck::DatabaseSchemaCheck < Admin::SystemCheck::BaseCheck
|
|||
end
|
||||
|
||||
def pass?
|
||||
!ActiveRecord::Base.connection.migration_context.needs_migration?
|
||||
!ActiveRecord::Base.connection_pool.migration_context.needs_migration?
|
||||
end
|
||||
|
||||
def message
|
||||
|
|
|
@ -15,7 +15,9 @@ module Status::SafeReblogInsert
|
|||
#
|
||||
# The code is kept similar to ActiveRecord::Persistence code and calls it
|
||||
# directly when we are not handling a reblog.
|
||||
def _insert_record(values, returning)
|
||||
#
|
||||
# https://github.com/rails/rails/blob/7-2-stable/activerecord/lib/active_record/persistence.rb#L238-L263
|
||||
def _insert_record(connection, values, returning)
|
||||
return super unless values.is_a?(Hash) && values['reblog_of_id']&.value.present?
|
||||
|
||||
primary_key = self.primary_key
|
||||
|
@ -34,10 +36,15 @@ module Status::SafeReblogInsert
|
|||
# Instead, we use a custom builder when a reblog is happening:
|
||||
im = _compile_reblog_insert(values)
|
||||
|
||||
connection.insert(im, "#{self} Create", primary_key || false, primary_key_value, returning: returning).tap do |result|
|
||||
# Since we are using SELECT instead of VALUES, a non-error `nil` return is possible.
|
||||
# For our purposes, it's equivalent to a foreign key constraint violation
|
||||
raise ActiveRecord::InvalidForeignKey, "(reblog_of_id)=(#{values['reblog_of_id'].value}) is not present in table \"statuses\"" if result.nil?
|
||||
with_connection do |_c|
|
||||
connection.insert(
|
||||
im, "#{self} Create", primary_key || false, primary_key_value,
|
||||
returning: returning
|
||||
).tap do |result|
|
||||
# Since we are using SELECT instead of VALUES, a non-error `nil` return is possible.
|
||||
# For our purposes, it's equivalent to a foreign key constraint violation
|
||||
raise ActiveRecord::InvalidForeignKey, "(reblog_of_id)=(#{values['reblog_of_id'].value}) is not present in table \"statuses\"" if result.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -61,10 +61,7 @@ Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true'
|
|||
module Mastodon
|
||||
class Application < Rails::Application
|
||||
# Initialize configuration defaults for originally generated Rails version.
|
||||
config.load_defaults 7.1
|
||||
|
||||
# Explicitly set the cache format version to align with Rails version
|
||||
config.active_support.cache_format_version = 7.1
|
||||
config.load_defaults 7.2
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
|
|
|
@ -16,7 +16,7 @@ Rails.application.configure do
|
|||
# Show full error reports.
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable server timing
|
||||
# Enable server timing.
|
||||
config.server_timing = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
|
@ -37,11 +37,6 @@ Rails.application.configure do
|
|||
|
||||
config.action_controller.forgery_protection_origin_check = ENV['DISABLE_FORGERY_REQUEST_PROTECTION'].nil?
|
||||
|
||||
ActiveSupport::Logger.new($stdout).tap do |logger|
|
||||
logger.formatter = config.log_formatter
|
||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
||||
end
|
||||
|
||||
# Generate random VAPID keys
|
||||
Webpush.generate_key.tap do |vapid_key|
|
||||
config.x.vapid_private_key = vapid_key.private_key
|
||||
|
@ -53,6 +48,8 @@ Rails.application.configure do
|
|||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
config.action_mailer.default_options = { from: 'notifications@localhost' }
|
||||
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
|
@ -75,12 +72,7 @@ Rails.application.configure do
|
|||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
|
||||
config.action_mailer.default_options = { from: 'notifications@localhost' }
|
||||
config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# If using a Heroku, Vagrant or generic remote development environment,
|
||||
# use letter_opener_web, accessible at /letter_opener.
|
||||
|
@ -90,8 +82,11 @@ Rails.application.configure do
|
|||
# TODO: Remove once devise-two-factor data migration complete
|
||||
config.x.otp_secret = ENV.fetch('OTP_SECRET', '1fc2b87989afa6351912abeebe31ffc5c476ead9bf8b3d74cbc4a302c7b69a45b40b1bbef3506ddad73e942e15ed5ca4b402bf9a66423626051104f4b5f05109')
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
|
||||
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||
end
|
||||
|
||||
Redis.raise_deprecations = true
|
||||
|
|
|
@ -15,22 +15,18 @@ Rails.application.configure do
|
|||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on.
|
||||
config.consider_all_requests_local = false
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
config.action_controller.asset_host = ENV['CDN_HOST'] if ENV['CDN_HOST'].present?
|
||||
|
||||
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
||||
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
||||
# config.require_master_key = true
|
||||
|
||||
# Compress CSS using a preprocessor.
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||
config.assets.compile = false
|
||||
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
||||
# config.public_file_server.enabled = false
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.asset_host = "http://assets.example.com"
|
||||
config.asset_host = ENV['CDN_HOST'] if ENV['CDN_HOST'].present?
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
config.action_dispatch.x_sendfile_header = ENV['SENDFILE_HEADER'] if ENV['SENDFILE_HEADER'].present?
|
||||
|
@ -40,27 +36,37 @@ Rails.application.configure do
|
|||
# Allow to specify public IP of reverse proxy if it's needed
|
||||
config.action_dispatch.trusted_proxies = ENV['TRUSTED_PROXY_IP'].split(/(?:\s*,\s*|\s+)/).map { |item| IPAddr.new(item) } if ENV['TRUSTED_PROXY_IP'].present?
|
||||
|
||||
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
||||
# config.assume_ssl = true
|
||||
|
||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||
config.force_ssl = true
|
||||
# Skip http-to-https redirect for the default health check endpoint.
|
||||
config.ssl_options = {
|
||||
redirect: {
|
||||
exclude: ->(request) { request.path.start_with?('/health') || request.headers['Host'].end_with?('.onion') || request.headers['Host'].end_with?('.i2p') },
|
||||
},
|
||||
}
|
||||
|
||||
# Info include generic and useful information about system operation, but avoids logging too much
|
||||
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
||||
# want to log everything, set the level to "debug".
|
||||
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym
|
||||
# Log to STDOUT by default
|
||||
config.logger = ActiveSupport::Logger.new($stdout)
|
||||
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
config.log_tags = [:request_id]
|
||||
|
||||
# "info" includes generic and useful information about system operation, but avoids logging too much
|
||||
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
||||
# want to log everything, set the level to "debug".
|
||||
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
|
||||
|
||||
# Use a different cache store in production.
|
||||
config.cache_store = :redis_cache_store, REDIS_CACHE_PARAMS
|
||||
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "mastodon_production"
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
@ -70,9 +76,8 @@ Rails.application.configure do
|
|||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# English when a translation cannot be found).
|
||||
# This setting would typically be `true` to use the `I18n.default_locale`.
|
||||
# Some locales are missing translation entries and would have errors:
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
# Default value is `true`, but some locales have missing data and would have errors
|
||||
# https://github.com/mastodon/mastodon/pull/24727
|
||||
config.i18n.fallbacks = [:en]
|
||||
|
||||
|
@ -89,18 +94,8 @@ Rails.application.configure do
|
|||
{ key: controller.signature_key_id } if controller.respond_to?(:signed_request?) && controller.signed_request?
|
||||
end
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
# require "syslog/logger"
|
||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
||||
|
||||
# Log to STDOUT by default
|
||||
config.logger = ActiveSupport::Logger.new($stdout)
|
||||
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
||||
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# E-mails
|
||||
|
|
|
@ -19,14 +19,15 @@ Rails.application.configure do
|
|||
# loading is working properly before deploying your code.
|
||||
config.eager_load = ENV['CI'].present?
|
||||
|
||||
config.assets_digest = false
|
||||
# Configure public file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" }
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
config.consider_all_requests_local = true
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
config.cache_store = :memory_store
|
||||
|
||||
# Raise exceptions instead of rendering exception templates.
|
||||
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
||||
config.action_dispatch.show_exceptions = :rescuable
|
||||
|
||||
# Disable request forgery protection in test environment.
|
||||
|
@ -41,6 +42,10 @@ Rails.application.configure do
|
|||
# ActionMailer::Base.deliveries array.
|
||||
config.action_mailer.delivery_method = :test
|
||||
|
||||
# Unlike controllers, the mailer instance doesn't have any context about the
|
||||
# incoming request so you'll need to provide the :host parameter yourself.
|
||||
config.action_mailer.default_url_options = { host: 'www.example.com' }
|
||||
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
|
@ -58,7 +63,6 @@ Rails.application.configure do
|
|||
# Raise exceptions for disallowed deprecations.
|
||||
config.active_support.disallowed_deprecation = :raise
|
||||
|
||||
config.i18n.default_locale = :en
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Tell Active Support which deprecation messages to disallow.
|
||||
|
@ -70,7 +74,7 @@ Rails.application.configure do
|
|||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Raise error when a before_action's only/except options reference missing actions
|
||||
# Raise error when a before_action's only/except options reference missing actions.
|
||||
config.action_controller.raise_on_missing_callback_actions = true
|
||||
end
|
||||
|
||||
|
|
72
config/initializers/new_framework_defaults_7_2.rb
Normal file
72
config/initializers/new_framework_defaults_7_2.rb
Normal file
|
@ -0,0 +1,72 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
#
|
||||
# This file eases your Rails 7.2 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.2`.
|
||||
#
|
||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||
|
||||
###
|
||||
# Controls whether Active Job's `#perform_later` and similar methods automatically defer
|
||||
# the job queuing to after the current Active Record transaction is committed.
|
||||
#
|
||||
# Example:
|
||||
# Topic.transaction do
|
||||
# topic = Topic.create(...)
|
||||
# NewTopicNotificationJob.perform_later(topic)
|
||||
# end
|
||||
#
|
||||
# In this example, if the configuration is set to `:never`, the job will
|
||||
# be enqueued immediately, even though the `Topic` hasn't been committed yet.
|
||||
# Because of this, if the job is picked up almost immediately, or if the
|
||||
# transaction doesn't succeed for some reason, the job will fail to find this
|
||||
# topic in the database.
|
||||
#
|
||||
# If `enqueue_after_transaction_commit` is set to `:default`, the queue adapter
|
||||
# will define the behaviour.
|
||||
#
|
||||
# Note: Active Job backends can disable this feature. This is generally done by
|
||||
# backends that use the same database as Active Record as a queue, hence they
|
||||
# don't need this feature.
|
||||
#++
|
||||
# Rails.application.config.active_job.enqueue_after_transaction_commit = :default
|
||||
|
||||
###
|
||||
# Adds image/webp to the list of content types Active Storage considers as an image
|
||||
# Prevents automatic conversion to a fallback PNG, and assumes clients support WebP, as they support gif, jpeg, and png.
|
||||
# This is possible due to broad browser support for WebP, but older browsers and email clients may still not support
|
||||
# WebP. Requires imagemagick/libvips built with WebP support.
|
||||
#++
|
||||
# Rails.application.config.active_storage.web_image_content_types = %w[image/png image/jpeg image/gif image/webp]
|
||||
|
||||
###
|
||||
# Enable validation of migration timestamps. When set, an ActiveRecord::InvalidMigrationTimestampError
|
||||
# will be raised if the timestamp prefix for a migration is more than a day ahead of the timestamp
|
||||
# associated with the current time. This is done to prevent forward-dating of migration files, which can
|
||||
# impact migration generation and other migration commands.
|
||||
#
|
||||
# Applications with existing timestamped migrations that do not adhere to the
|
||||
# expected format can disable validation by setting this config to `false`.
|
||||
#++
|
||||
# Rails.application.config.active_record.validate_migration_timestamps = true
|
||||
|
||||
###
|
||||
# Controls whether the PostgresqlAdapter should decode dates automatically with manual queries.
|
||||
#
|
||||
# Example:
|
||||
# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.select_value("select '2024-01-01'::date") #=> Date
|
||||
#
|
||||
# This query used to return a `String`.
|
||||
#++
|
||||
# Rails.application.config.active_record.postgresql_adapter_decode_dates = true
|
||||
|
||||
###
|
||||
# Enables YJIT as of Ruby 3.3, to bring sizeable performance improvements. If you are
|
||||
# deploying to a memory constrained environment you may want to set this to `false`.
|
||||
#++
|
||||
# Rails.application.config.yjit = true
|
|
@ -11,7 +11,7 @@ namespace :tests do
|
|||
'3_3_0' => 2020_12_18_054746,
|
||||
}.each do |release, version|
|
||||
ActiveRecord::Tasks::DatabaseTasks
|
||||
.migration_connection
|
||||
.migration_connection_pool
|
||||
.migration_context
|
||||
.migrate(version)
|
||||
Rake::Task["tests:migrations:populate_v#{release}"]
|
||||
|
|
|
@ -13,7 +13,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
|||
context 'when database needs migration' do
|
||||
before do
|
||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: true)
|
||||
allow(ActiveRecord::Base.connection).to receive(:migration_context).and_return(context)
|
||||
allow(ActiveRecord::Base.connection_pool).to receive(:migration_context).and_return(context)
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
|
@ -24,7 +24,7 @@ describe Admin::SystemCheck::DatabaseSchemaCheck do
|
|||
context 'when database does not need migration' do
|
||||
before do
|
||||
context = instance_double(ActiveRecord::MigrationContext, needs_migration?: false)
|
||||
allow(ActiveRecord::Base.connection).to receive(:migration_context).and_return(context)
|
||||
allow(ActiveRecord::Base.connection_pool).to receive(:migration_context).and_return(context)
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
|
|
Loading…
Reference in a new issue