Skip to content

Commit

Permalink
Merge branch 'release/0.38.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Aug 5, 2020
2 parents 6b3422c + c0acc73 commit 9d8ebcc
Show file tree
Hide file tree
Showing 37 changed files with 6,882 additions and 224 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin_public_body_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def new
end
if @change_request
@change_request_user_response = render_to_string(:template => "admin_public_body_change_requests/add_accepted",
:formats => [:txt])
:formats => [:text])
@public_body.name = @change_request.public_body_name
@public_body.request_email = @change_request.public_body_email
@public_body.last_edit_comment = @change_request.comment_for_public_body
Expand Down Expand Up @@ -82,7 +82,7 @@ def edit
@change_request_user_response =
render_to_string(
template: 'admin_public_body_change_requests/update_accepted',
formats: [:txt])
formats: [:text])
@public_body.request_email = @change_request.public_body_email
@public_body.last_edit_comment = @change_request.comment_for_public_body
else
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def body_request_events


if feed_type == "atom"
render :template => "api/request_events", :formats => ['atom'], :layout => false
render :template => "api/request_events", :formats => [:atom], :layout => false
elsif feed_type == "json"
@event_data = []
@events.each do |event|
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ def show_as_html
formats: [:html]
),
body_prefix: render_to_string(
partial: 'request/view_html_prefix'
partial: 'request/view_html_prefix',
formats: [:html]
)
}
)

html = @incoming_message.apply_masks(html, response.content_type)
html = if rails_upgrade?
@incoming_message.apply_masks(html, response.media_type)
else
@incoming_message.apply_masks(html, response.content_type)
end

render html: html.html_safe
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/track_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def atom_feed_internal
end
) } }
format.any { render :template => 'track/atom_feed',
:formats => ['atom'],
:formats => [:atom],
:layout => false,
:content_type => 'application/atom+xml' }
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def cache_if_caching_fragments(*args, &block)

def render_flash(flash)
flash = { :plain => flash } if flash.is_a?(String)
render flash.with_indifferent_access
render flash.deep_symbolize_keys
end

# We only want to cache request lists that have a reasonable chance of not expiring
Expand Down
5 changes: 3 additions & 2 deletions app/models/dataset/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Dataset::Value < ApplicationRecord

validates :value_set, :key, presence: true
validates :value,
format: { with: -> (value) { value.key&.format_regexp } },
allow_blank: true
format: { with: -> (value) { value.key.format_regexp } },
allow_blank: true,
if: -> (value) { value.key }
end
4 changes: 2 additions & 2 deletions app/models/public_body.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def calculated_home_page
def self.internal_admin_body
matching_pbs = AlaveteliLocalization.
with_locale(AlaveteliLocalization.default_locale) do
PublicBody.where(url_name: 'internal_admin_authority')
default_scoped.where(url_name: 'internal_admin_authority')
end

if matching_pbs.empty?
Expand All @@ -403,7 +403,7 @@ def self.internal_admin_body
else
AlaveteliLocalization.
with_locale(AlaveteliLocalization.default_locale) do
PublicBody.
default_scoped.
create!(:name => 'Internal admin authority',
:short_name => "",
:request_email => AlaveteliConfiguration.contact_email,
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Application < Rails::Application
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
I18n.config.enforce_available_locales = true
config.i18n.enforce_available_locales = true

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
Expand Down
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
config.i18n.enforce_available_locales = false

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/alaveteli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
load "util.rb"

# Application version
ALAVETELI_VERSION = '0.38.0.0'
ALAVETELI_VERSION = '0.38.1.0'

# Add new inflection rules using the following format
# (all these examples are active by default):
Expand Down
2 changes: 0 additions & 2 deletions config/initializers/new_framework_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.

Rails.application.config.action_controller.raise_on_unfiltered_parameters = true

# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false

Expand Down
9 changes: 9 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 0.38.1.0

## Highlighted Features

* Fixes i18n string loading for locales with country specific subtags (Graeme
Porteous)

# 0.38.0.0

## Highlighted Features
Expand Down Expand Up @@ -30,6 +37,8 @@
before upgrading Alaveteli. See: https://www.postgresql.org/docs/9.6/release-9-6.html
* **NOTE:** This release will be the last to support Ruby 2.3 and 2.4. Please
consider upgrading to either 2.6. See: https://www.ruby-lang.org/en/news/2020/03/31/ruby-2-6-6-released/
* CoffeeScript support has been dropped. You may find issues when pre-compiling
assets. If so please delete `./tmp/cache/assets` and try again.
* Run `bundle exec rake temp:identify_broken_binary_censor_rules` to generate
a list of requests which should be manually checked to ensure censor rules are
applied correctly.
Expand Down
11 changes: 9 additions & 2 deletions lib/alaveteli_localization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ def set_locales(available_locales, default_locale)
split(/ /).map { |locale| canonicalize(locale) }
FastGettext.
default_available_locales = available_locales.map { |x| x.to_sym }
I18n.available_locales = available_locales.map do |locale_name|
to_hyphen(locale_name)

all_locales = available_locales.each_with_object([]) do |locale, memo|
memo.concat(self_and_parents(to_hyphen(locale)))
end
I18n.available_locales = all_locales.uniq

I18n.locale = I18n.default_locale = to_hyphen(default_locale)
FastGettext.default_locale = canonicalize(default_locale)
RoutingFilter::Conditionallyprependlocale.locales = available_locales
Expand Down Expand Up @@ -73,5 +76,9 @@ def canonicalize(locale)
def to_hyphen(locale)
locale.to_s.gsub('_', '-')
end

def self_and_parents(locale)
I18n::Locale::Tag::Simple.new(locale).self_and_parents.map(&:to_s)
end
end
end
6 changes: 5 additions & 1 deletion lib/user_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def self.list_user_domains(params={})
end
sql = "#{sql} LIMIT #{params[:limit]}" if params[:limit]

User.connection.select_all(sql).to_hash
if rails_upgrade?
User.connection.select_all(sql).to_a
else
User.connection.select_all(sql).to_hash
end
end

# Returns the number of domant users for the given domain
Expand Down
Loading

0 comments on commit 9d8ebcc

Please sign in to comment.