Update Rails to version 5.1.1 (#3121)

* Update rails to version 5.1.1

* Run `rails app:update`

* Remove the override of polymorphic activity relationship

* Silence warning about otp_secret attribute being unknown to rails

* We will only introduce form_with where we want to use remote data
rebase/4.0.0rc2
Matt Jankowski 2017-06-01 14:53:37 -04:00 committed by Eugen Rochko
parent e1fdac3e9a
commit 2212dc4aaa
7 changed files with 51 additions and 76 deletions

View File

@ -1,40 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.3)
actionpack (= 5.0.3)
nio4r (>= 1.2, < 3.0)
actioncable (5.1.1)
actionpack (= 5.1.1)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
actionmailer (5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.3)
actionview (= 5.0.3)
activesupport (= 5.0.3)
actionpack (5.1.1)
actionview (= 5.1.1)
activesupport (= 5.1.1)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.3)
activesupport (= 5.0.3)
actionview (5.1.1)
activesupport (= 5.1.1)
builder (~> 3.1)
erubis (~> 2.7.0)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_record_query_trace (1.5.4)
activejob (5.0.3)
activesupport (= 5.0.3)
activejob (5.1.1)
activesupport (= 5.1.1)
globalid (>= 0.3.6)
activemodel (5.0.3)
activesupport (= 5.0.3)
activerecord (5.0.3)
activemodel (= 5.0.3)
activesupport (= 5.0.3)
arel (~> 7.0)
activesupport (5.0.3)
activemodel (5.1.1)
activesupport (= 5.1.1)
activerecord (5.1.1)
activemodel (= 5.1.1)
activesupport (= 5.1.1)
arel (~> 8.0)
activesupport (5.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
@ -46,7 +46,7 @@ GEM
annotate (2.7.1)
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 12.0)
arel (7.1.4)
arel (8.0.0)
ast (2.3.0)
attr_encrypted (3.0.3)
encryptor (~> 3.0.0)
@ -141,6 +141,7 @@ GEM
thread
thread_safe
encryptor (3.0.0)
erubi (1.6.0)
erubis (2.7.0)
et-orbi (1.0.4)
tzinfo
@ -296,17 +297,17 @@ GEM
rack-test (0.6.3)
rack (>= 1.0)
rack-timeout (0.4.2)
rails (5.0.3)
actioncable (= 5.0.3)
actionmailer (= 5.0.3)
actionpack (= 5.0.3)
actionview (= 5.0.3)
activejob (= 5.0.3)
activemodel (= 5.0.3)
activerecord (= 5.0.3)
activesupport (= 5.0.3)
rails (5.1.1)
actioncable (= 5.1.1)
actionmailer (= 5.1.1)
actionpack (= 5.1.1)
actionview (= 5.1.1)
activejob (= 5.1.1)
activemodel (= 5.1.1)
activerecord (= 5.1.1)
activesupport (= 5.1.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.3)
railties (= 5.1.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1)
@ -322,9 +323,9 @@ GEM
railties (~> 5.0)
rails-settings-cached (0.6.5)
rails (>= 4.2.0)
railties (5.0.3)
actionpack (= 5.0.3)
activesupport (= 5.0.3)
railties (5.1.1)
actionpack (= 5.1.1)
activesupport (= 5.1.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)

View File

@ -48,10 +48,6 @@ class Notification < ApplicationRecord
cache_associated :from_account, status: STATUS_INCLUDES, mention: [status: STATUS_INCLUDES], favourite: [:account, status: STATUS_INCLUDES], follow: :account
def activity(eager_loaded = true)
eager_loaded ? send(activity_type.underscore) : super()
end
def type
@type ||= TYPE_CLASS_MAP.invert[activity_type].to_sym
end
@ -96,9 +92,9 @@ class Notification < ApplicationRecord
case activity_type
when 'Status', 'Follow', 'Favourite', 'FollowRequest'
self.from_account_id = activity(false)&.account_id
self.from_account_id = activity&.account_id
when 'Mention'
self.from_account_id = activity(false)&.status&.account_id
self.from_account_id = activity&.status&.account_id
end
end
end

View File

@ -58,6 +58,11 @@ class User < ApplicationRecord
before_validation :sanitize_languages
# This avoids a deprecation warning from Rails 5.1
# It seems possible that a future release of devise-two-factor will
# handle this itself, and this can be removed from our User class.
attribute :otp_secret
def confirmed?
confirmed_at.present?
end

View File

@ -16,8 +16,9 @@ Rails.application.configure do
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800',
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
}
else
config.action_controller.perform_caching = false
@ -32,6 +33,7 @@ Rails.application.configure do
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.

View File

@ -40,22 +40,16 @@ Rails.application.configure do
# Allow to specify public IP of reverse proxy if it's needed
config.action_dispatch.trusted_proxies = [IPAddr.new(ENV['TRUSTED_PROXY_IP'])] unless ENV['TRUSTED_PROXY_IP'].blank?
# By default, use the lowest log level to ensure availability of diagnostic information
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
config.cache_store = :redis_store, ENV['REDIS_URL'], REDIS_CACHE_PARAMS
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false

View File

@ -12,10 +12,10 @@ Rails.application.configure do
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
config.assets.digest = false
@ -28,12 +28,12 @@ Rails.application.configure do
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.perform_caching = false
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

View File

@ -1,23 +0,0 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = false
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true