DEV: Upgrade Rails to 6.1.3.1 (#12688)

Rails 6.1.3.1 deprecates a few API and has some internal changes that break our tests suite, so this commit fixes all the deprecations and errors and now Discourse should be fully compatible with Rails 6.1.3.1. We also have a new release of the rails_failover gem that's compatible with Rails 6.1.3.1.
This commit is contained in:
Osama Sayegh
2021-04-21 12:36:32 +03:00
committed by GitHub
parent 838fa12f14
commit 45ccadeeeb
25 changed files with 116 additions and 95 deletions

View File

@@ -72,7 +72,7 @@ class Admin::BackupsController < Admin::AdminController
def show
if !EmailBackupToken.compare(current_user.id, params.fetch(:token))
@error = I18n.t('download_backup_mailer.no_token')
return render template: 'admin/backups/show.html.erb', layout: 'no_ember', status: 422
return render layout: 'no_ember', status: 422, formats: [:html]
end
store = BackupRestore::BackupStore.create

View File

@@ -11,7 +11,7 @@ class MetadataController < ApplicationController
def opensearch
expires_in 1.minutes
render template: "metadata/opensearch.xml"
render template: "metadata/opensearch", formats: [:xml]
end
def app_association_android

View File

@@ -29,7 +29,7 @@ class StaticController < ApplicationController
if map.has_key?(@page)
site_setting_key = map[@page][:redirect]
url = SiteSetting.get(site_setting_key)
return redirect_to(url) unless url.blank?
return redirect_to(url) if url.present?
end
# The /guidelines route ALWAYS shows our FAQ, ignoring the faq_url site setting.
@@ -70,12 +70,8 @@ class StaticController < ApplicationController
cookies[:email] = { value: params[:email], expires: 1.day.from_now }
end
file = "static/#{@page}.#{I18n.locale}"
file = "static/#{@page}.en" if lookup_context.find_all("#{file}.html").empty?
file = "static/#{@page}" if lookup_context.find_all("#{file}.html").empty?
if lookup_context.find_all("#{file}.html").any?
render file, layout: !request.xhr?, formats: [:html]
if lookup_context.find_all("static/#{@page}").any?
render "static/#{@page}", layout: !request.xhr?, formats: [:html]
return
end