-<%= render partial: 'admin_censor_rule/show',
+<%= render partial: 'admin_censor_rule/list',
locals: { censor_rules: @admin_user.censor_rules,
user: @admin_user } %>
From 1f3d9ba37609d8ec5147b4d27d0c64650f27aef6 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Thu, 5 Jan 2023 10:03:05 +0000
Subject: [PATCH 005/289] Add inline help around censor rule ordering
It's not obvious that censor rules are applied in order, and each
applies to the text after it's been modified by the previous rule, so
some combinations of rules can do unexpected things.
For example, we often want to redact "firstname lastname" and
"firstname". If the rule for "firstname" is applied first, then the
"firstname lastname" rule will not apply, because the text cannot be
matched due to the "firstname" redaction.
Fixes https://github.com/mysociety/alaveteli/issues/7495.
---
app/views/admin_censor_rule/_list.html.erb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/views/admin_censor_rule/_list.html.erb b/app/views/admin_censor_rule/_list.html.erb
index 98ae703cdf..cd3c31fe4a 100644
--- a/app/views/admin_censor_rule/_list.html.erb
+++ b/app/views/admin_censor_rule/_list.html.erb
@@ -1,3 +1,13 @@
+
+
+
+ Each rule applies sequentially to the text after having been modified by
+ the previous rule, so the order may matter depending on what you are
+ trying to redact.
+
+
+
+
<% if censor_rules.size > 0 %>
From 37fde3321a281bcd8519ffee87e9e89380ea8058 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 11:46:00 +0000
Subject: [PATCH 006/289] Update Docker readme
Point users to installation guide on alaveteli.org
---
docker/README.md | 35 ++---------------------------------
1 file changed, 2 insertions(+), 33 deletions(-)
diff --git a/docker/README.md b/docker/README.md
index b7f9af2831..3d028e270b 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,33 +1,2 @@
-Tips and tricks for using the Alaveteli Docker setup.
-
-Run the development app server:
-
-```
-docker/server
-```
-
-Run the rails console:
-
-```
-dc run --rm app bin/rails c
-```
-
-Run other rails commands:
-
-```
-dc run --rm app bin/rails routes
-dc run --rm app bin/rails runner "puts 1"
-# etc…
-```
-
-Run a command with an environment variable set:
-
-```
-dc run -e RAILS_ENV=test --rm app bin/rails db:migrate
-```
-
-Use `-T` to pipe local files to scripts run in the app container.
-
-```
-cat spec/fixtures/files/incoming-request-plain.email | dc run --rm -T app script/mailin
-```
+See https://alaveteli.org/docs/installing/docker/ for a guide to installing
+Alaveteli via Docker.
From bfff6a2ecbfd31e6c248841bae069046152e26f8 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 11:46:46 +0000
Subject: [PATCH 007/289] Update Docker setup
Show progress install Gems. This take a while and causes users to think
nothing is happening.
---
docker/setup | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/setup b/docker/setup
index c1da52a129..d4836fd262 100755
--- a/docker/setup
+++ b/docker/setup
@@ -15,7 +15,7 @@ notice_msg() { printf "\033[33m%s\033[0m " "$*"; }
success_msg() { printf "\033[32m%s\033[0m\n" "$*"; }
notice_msg 'Installing Ruby gems...'
-bundle install >/dev/null
+bundle install
success_msg 'done'
if [ -L config/general.yml ]; then
From afe787fbad29a06ff87e20dad4e527a8831b2905 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 11:59:03 +0000
Subject: [PATCH 008/289] Update Docker reset script
Call `docker/setup` after this script in order to complete the reset so
the user ends up with a working Docker environment.
---
docker/reset | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docker/reset b/docker/reset
index 17bc124478..b78c27255c 100755
--- a/docker/reset
+++ b/docker/reset
@@ -18,4 +18,4 @@ docker compose down
docker volume rm "$(basename $(pwd))_postgres"
docker compose build --pull
-./docker/bootstrap
+./docker/setup
From 914c043fb0558444e772d1a283154bb8600b31d1 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 11:47:53 +0000
Subject: [PATCH 009/289] Update Docker reset script
Allow user to choose if development database gets reset or not. Now if
they choose "No" the Docker volume is kept, the script continues but
skips the data steps (migration, loading sample, and rebuilding the
Xapian index).
---
docker/reset | 30 ++++++++++++++++++------------
docker/setup | 26 +++++++++++++++-----------
2 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/docker/reset b/docker/reset
index b78c27255c..956184e68d 100755
--- a/docker/reset
+++ b/docker/reset
@@ -4,18 +4,24 @@ set -e
cd "$(dirname "$0")/.."
-while true
-do
- read -r -p 'This will remove your development database. Do you want to continue? ' choice
- case "$choice" in
- n|N) exit;;
- y|Y) break;;
- *) echo 'Response not valid';;
- esac
-done
-
docker compose down
-docker volume rm "$(basename $(pwd))_postgres"
+
+db_volume="$(basename $(pwd))_postgres"
+if docker volume ls | grep $db_volume >/dev/null; then
+ while true
+ do
+ read -r -p 'Do you also want to reset your development database? ' choice
+ case "$choice" in
+ n|N) break;;
+ y|Y)
+ docker volume rm $db_volume >/dev/null
+ data_reset=true
+ break;;
+ *) echo 'Response not valid';;
+ esac
+ done
+fi
+
docker compose build --pull
-./docker/setup
+./docker/setup $data_reset
diff --git a/docker/setup b/docker/setup
index d4836fd262..ba25badd1d 100755
--- a/docker/setup
+++ b/docker/setup
@@ -6,7 +6,7 @@ cd "$(dirname "$0")/.."
if [ -z "$DOCKER" ]; then
./docker/bootstrap
- docker compose run --rm app ./docker/setup
+ docker compose run --rm app ./docker/setup "$@"
exit
fi
@@ -14,6 +14,8 @@ error_msg() { printf "\033[31m%s\033[0m\n" "$*"; }
notice_msg() { printf "\033[33m%s\033[0m " "$*"; }
success_msg() { printf "\033[32m%s\033[0m\n" "$*"; }
+data_reset="${1:-false}"
+
notice_msg 'Installing Ruby gems...'
bundle install
success_msg 'done'
@@ -26,17 +28,19 @@ if [ -L config/general.yml ]; then
success_msg 'done'
fi
-notice_msg 'Migrating development and test databases...'
-bin/rails db:migrate db:seed >/dev/null
-bin/rails db:migrate RAILS_ENV=test >/dev/null
-success_msg 'done'
+if $data_reset; then
+ notice_msg 'Migrating development and test databases...'
+ bin/rails db:migrate db:seed >/dev/null
+ bin/rails db:migrate RAILS_ENV=test >/dev/null
+ success_msg 'done'
-notice_msg 'Loading sample data...'
-bundle exec script/load-sample-data > /dev/null
-success_msg 'done'
+ notice_msg 'Loading sample data...'
+ bundle exec script/load-sample-data > /dev/null
+ success_msg 'done'
-notice_msg 'Rebuilding Xapian index...'
-bundle exec script/destroy-and-rebuild-xapian-index > /dev/null
-success_msg 'done'
+ notice_msg 'Rebuilding Xapian index...'
+ bundle exec script/destroy-and-rebuild-xapian-index > /dev/null
+ success_msg 'done'
+fi
success_msg 'Setup finished'
From 434de39d8d3ec60f1f9100949a66901271dc3989 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 4 Jan 2023 09:59:10 +0000
Subject: [PATCH 010/289] Add general/frontpage_extra overrideable
Adds a blank, overrideable template to add theme content below the
body and request lists.
---
app/views/general/_frontpage_extra.html.erb | 1 +
app/views/general/frontpage.html.erb | 2 ++
2 files changed, 3 insertions(+)
create mode 100644 app/views/general/_frontpage_extra.html.erb
diff --git a/app/views/general/_frontpage_extra.html.erb b/app/views/general/_frontpage_extra.html.erb
new file mode 100644
index 0000000000..0e9a333033
--- /dev/null
+++ b/app/views/general/_frontpage_extra.html.erb
@@ -0,0 +1 @@
+<%# Placeholder to be overridden by theme %>
diff --git a/app/views/general/frontpage.html.erb b/app/views/general/frontpage.html.erb
index 4e9b32d734..19c92e7cf5 100644
--- a/app/views/general/frontpage.html.erb
+++ b/app/views/general/frontpage.html.erb
@@ -5,4 +5,6 @@
<%= render partial: 'frontpage_bodies_list' %>
<%= render partial: 'frontpage_requests_list' %>
+
+ <%= render partial: 'frontpage_extra' %>
<% end %>
From 07ea8f98b9dc3617db95de1978bc41a1ed1091a0 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 21 Dec 2022 11:06:18 +0000
Subject: [PATCH 011/289] Update method calls for keyword args change
In Ruby 3 positional and keyword arguments were separated meaning we
have to add double splat when passing in a hash as an argument if we
want to the value pairs to be treated as arguments.
See: https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
---
.../alaveteli_pro/base_controller.rb | 2 +-
app/controllers/application_controller.rb | 2 +-
.../projects/classifications_controller.rb | 2 +-
.../projects/extracts_controller.rb | 2 +-
app/controllers/refusal_advice_controller.rb | 10 +++++++---
app/helpers/notes_helper.rb | 2 +-
app/models/ability.rb | 4 ++--
lib/tasks/config_files.rake | 12 ++++++------
.../concerns/translatable_params_spec.rb | 19 +++++++++++--------
.../users/sessions_controller_spec.rb | 6 ++----
10 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/app/controllers/alaveteli_pro/base_controller.rb b/app/controllers/alaveteli_pro/base_controller.rb
index 65f47cb652..ae8ae22b7a 100644
--- a/app/controllers/alaveteli_pro/base_controller.rb
+++ b/app/controllers/alaveteli_pro/base_controller.rb
@@ -21,7 +21,7 @@ def pro_user_authenticated?(reason_params = nil)
}
end
if !authenticated?
- ask_to_login(reason_params)
+ ask_to_login(**reason_params)
else
unless current_user.is_pro?
redirect_to(
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2548c0dca1..ea80e6a4c2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -231,7 +231,7 @@ def set_in_pro_area
# Override the Rails method to only set the CSRF form token if there is a
# logged in user
- def form_authenticity_token(*args)
+ def form_authenticity_token(**args)
super if authenticated?
end
diff --git a/app/controllers/projects/classifications_controller.rb b/app/controllers/projects/classifications_controller.rb
index 3dc3112ea4..a70ded220d 100644
--- a/app/controllers/projects/classifications_controller.rb
+++ b/app/controllers/projects/classifications_controller.rb
@@ -7,7 +7,7 @@ class Projects::ClassificationsController < Projects::BaseController
include Classifiable
def create
- @project.submissions.create(submission_params)
+ @project.submissions.create(**submission_params)
flash[:notice] = _('Thank you for updating this request!')
redirect_to project_classify_path(@project)
diff --git a/app/controllers/projects/extracts_controller.rb b/app/controllers/projects/extracts_controller.rb
index 3b3bd24d1e..9cc041ab24 100644
--- a/app/controllers/projects/extracts_controller.rb
+++ b/app/controllers/projects/extracts_controller.rb
@@ -37,7 +37,7 @@ def create
authorize! :read, @project
@value_set = Dataset::ValueSet.new(extract_params)
- submission = @project.submissions.new(submission_params)
+ submission = @project.submissions.new(**submission_params)
if submission.save
redirect_to project_extract_path
diff --git a/app/controllers/refusal_advice_controller.rb b/app/controllers/refusal_advice_controller.rb
index fcd74bec8c..0d28b2333c 100644
--- a/app/controllers/refusal_advice_controller.rb
+++ b/app/controllers/refusal_advice_controller.rb
@@ -29,7 +29,7 @@ def log_event
info_request.log_event(
'refusal_advice',
- parsed_refusal_advice_params.merge(user_id: current_user.id).to_h
+ **parsed_refusal_advice_params.merge(user_id: current_user.id)
)
end
@@ -84,11 +84,15 @@ def refusal_advice_params
end
def parsed_refusal_advice_params
- refusal_advice_params.merge(
+ parsed_params = refusal_advice_params.merge(
actions: refusal_advice_params.fetch(:actions).
each_pair do |_, suggestions|
suggestions.transform_values! { |v| v == 'true' }
end
- )
+ ).to_h
+
+ return parsed_params.deep_symbolize_keys if RUBY_VERSION < '3.0'
+
+ parsed_params
end
end
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 46bb6af3d0..0ae51ccd91 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -4,7 +4,7 @@ def render_notes(notes, batch: false, **options)
allowed_tags = batch ? batch_notes_allowed_tags : notes_allowed_tags
- tag.aside options.merge(id: 'notes') do
+ tag.aside(**options.merge(id: 'notes')) do
notes.each do |note|
note_classes = ['note']
note_classes << "tag-#{note.notable_tag}" if note.notable_tag
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 8ffd05d8fc..0f3f18bd7e 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -4,8 +4,8 @@ class Ability
attr_reader :user, :project, :public_token
- def self.guest(*args)
- new(nil, *args)
+ def self.guest(**args)
+ new(nil, **args)
end
def initialize(user, project: nil, public_token: false)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index b7af371d3b..17daa13dec 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -20,8 +20,8 @@ namespace :config_files do
end
end
- def convert_erb(file, replacements)
- ExampleERBRenderer.new(file, replacements).lines
+ def convert_erb(file, **replacements)
+ ExampleERBRenderer.new(file, **replacements).lines
end
def daemons(only_active = false)
@@ -67,7 +67,7 @@ namespace :config_files do
}
# Generate the template for potential further processing
- convert_erb(ENV['SCRIPT_FILE'], replacements).each do |line|
+ convert_erb(ENV['SCRIPT_FILE'], **replacements).each do |line|
puts line
end
end
@@ -102,7 +102,7 @@ namespace :config_files do
replacements.update(:daemon_name => "#{ replacements[:site] }-#{ daemon_name }")
# Generate the template for potential further processing
- converted = convert_erb(ENV['SCRIPT_FILE'], replacements)
+ converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
# uncomment RAILS_ENV in to the generated template if its not set by the
# hard coded config file
@@ -143,7 +143,7 @@ namespace :config_files do
}
lines = []
- convert_erb(ENV['CRONTAB'], replacements).each do |line|
+ convert_erb(ENV['CRONTAB'], **replacements).each do |line|
lines << line
end
@@ -167,7 +167,7 @@ namespace :config_files do
}
# Generate the template for potential further processing
- converted = convert_erb(ENV['SCRIPT_FILE'], replacements)
+ converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
# uncomment RAILS_ENV in to the generated template if its not set by the
# hard coded config file
diff --git a/spec/controllers/concerns/translatable_params_spec.rb b/spec/controllers/concerns/translatable_params_spec.rb
index a6cdc47ef9..1646e37251 100644
--- a/spec/controllers/concerns/translatable_params_spec.rb
+++ b/spec/controllers/concerns/translatable_params_spec.rb
@@ -25,14 +25,14 @@
:name => 'Other name' } } }
params = ActionController::Parameters.new(params)
- expect(translatable_params(params, keys)).
+ expect(translatable_params(params, **keys)).
to eq(ActionController::Parameters.new(expected).permit!)
end
context 'when there are no params' do
it 'returns an empty hash' do
- expect(translatable_params(nil, keys)).to eq({})
+ expect(translatable_params(nil, **keys)).to eq({})
end
end
@@ -56,8 +56,9 @@
:status => 'good' }
params = ActionController::Parameters.new(params)
- expect(TranslatableParams::WhitelistedParams.new(keys).whitelist(params)).
- to eq(ActionController::Parameters.new(expected).permit!)
+ expect(
+ TranslatableParams::WhitelistedParams.new(**keys).whitelist(params)
+ ).to eq(ActionController::Parameters.new(expected).permit!)
end
it 'allows id in the translation params' do
@@ -69,8 +70,9 @@
expected = ActionController::Parameters.new(params).permit!
params = params = ActionController::Parameters.new(params)
- expect(TranslatableParams::WhitelistedParams.new(keys).whitelist(params.dup)).
- to eq(expected)
+ expect(
+ TranslatableParams::WhitelistedParams.new(**keys).whitelist(params.dup)
+ ).to eq(expected)
end
it 'removes a non-whitelisted translation param' do
@@ -85,8 +87,9 @@
:name => 'Other name' } } }
params = ActionController::Parameters.new(params)
- expect(TranslatableParams::WhitelistedParams.new(keys).whitelist(params)).
- to eq(ActionController::Parameters.new(expected).permit!)
+ expect(
+ TranslatableParams::WhitelistedParams.new(**keys).whitelist(params)
+ ).to eq(ActionController::Parameters.new(expected).permit!)
end
end
diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb
index 0a9169cf29..eefd565b0d 100644
--- a/spec/controllers/users/sessions_controller_spec.rb
+++ b/spec/controllers/users/sessions_controller_spec.rb
@@ -247,10 +247,8 @@ def do_signin(email, password)
end
def do_signin(email, password)
- post :create, {
- params: {
- :user_signin => { :email => email, :password => password }
- }
+ post :create, params: {
+ user_signin: { email: email, password: password }
}
end
From 2543b1c6149cf25963a43b2d9035b4d80d3e9b6a Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 21 Dec 2022 11:06:30 +0000
Subject: [PATCH 012/289] Fix class variable override error in locale routes
Instead of resetting `@@locals_pattern` to nil override the reader
method to dynamically generate the regular expression.
---
lib/routing_filters.rb | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb
index 75b30c5e36..a875166de9 100644
--- a/lib/routing_filters.rb
+++ b/lib/routing_filters.rb
@@ -1,11 +1,5 @@
module RoutingFilter
class Conditionallyprependlocale < RoutingFilter::Locale
- # We need to be able to override this class attribute so from Rails 4.0
- # onwards we're going to need write access. It looks as though we don't
- # use the equivalent instance variables so we can opt out of creating
- # accessors for them
- cattr_accessor :locales, instance_accessor: false
-
# Override core Locale filter not to prepend locale path segment
# when there's only one locale
def prepend_locale?(locale)
@@ -40,12 +34,7 @@ def default_locale?(locale)
# Reset the locale pattern when the locales are set.
class << self
def locales_pattern
- super
- end
-
- def locales=(locales)
- @@locales_pattern = nil
- @@locales = locales.map(&:to_sym)
+ %r(^/(#{locales.map { |l| Regexp.escape(l.to_s) }.join('|')})(?=/|$))
end
end
end
From c868add54a1a8b2bcbabd3e4678dd2485c8529a9 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 21 Dec 2022 10:46:55 +0000
Subject: [PATCH 013/289] Update stripe mock gem
This is needed for Ruby 3 compatibility.
Upstream also contained updated webhook fixtures which don't match our
current Stripe API version so I have taken the fixtures from the current
version of the gem which we current expect and test against.
---
Gemfile | 4 +-
Gemfile.lock | 6 +-
Gemfile.rails_next.lock | 6 +-
.../alaveteli_pro/subscription_collection.rb | 3 +-
.../customer.subscription.deleted.json | 65 ++++++++++
.../invoice.payment_failed.json | 105 ++++++++++++++++
.../invoice.payment_succeeded.json | 112 ++++++++++++++++++
7 files changed, 292 insertions(+), 9 deletions(-)
create mode 100644 spec/fixtures/stripe_webhooks/customer.subscription.deleted.json
create mode 100644 spec/fixtures/stripe_webhooks/invoice.payment_failed.json
create mode 100644 spec/fixtures/stripe_webhooks/invoice.payment_succeeded.json
diff --git a/Gemfile b/Gemfile
index d05e770287..6bfdde4a6c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -183,8 +183,8 @@ group :test do
gem 'simplecov-lcov', '~> 0.7.0'
gem 'capybara', '~> 3.38.0'
gem 'stripe-ruby-mock', git: 'https://github.com/stripe-ruby-mock/stripe-ruby-mock',
- ref: '2c925fd'
- gem('rails-controller-testing')
+ ref: '6ceea96'
+ gem 'rails-controller-testing'
end
group :test, :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 7e3cde430e..88dc9ab842 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -17,10 +17,10 @@ GIT
GIT
remote: https://github.com/stripe-ruby-mock/stripe-ruby-mock
- revision: 2c925fd8cb568e3d0cfebffbe1babb490793f150
- ref: 2c925fd
+ revision: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
+ ref: 6ceea96
specs:
- stripe-ruby-mock (3.0.1)
+ stripe-ruby-mock (3.1.0.rc3)
dante (>= 0.2.0)
multi_json (~> 1.0)
stripe (> 5, < 6)
diff --git a/Gemfile.rails_next.lock b/Gemfile.rails_next.lock
index b9733b85dd..9b63000d1f 100644
--- a/Gemfile.rails_next.lock
+++ b/Gemfile.rails_next.lock
@@ -17,10 +17,10 @@ GIT
GIT
remote: https://github.com/stripe-ruby-mock/stripe-ruby-mock
- revision: 2c925fd8cb568e3d0cfebffbe1babb490793f150
- ref: 2c925fd
+ revision: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
+ ref: 6ceea96
specs:
- stripe-ruby-mock (3.0.1)
+ stripe-ruby-mock (3.1.0.rc3)
dante (>= 0.2.0)
multi_json (~> 1.0)
stripe (> 5, < 6)
diff --git a/app/models/alaveteli_pro/subscription_collection.rb b/app/models/alaveteli_pro/subscription_collection.rb
index e21ad89b0d..011037b58a 100644
--- a/app/models/alaveteli_pro/subscription_collection.rb
+++ b/app/models/alaveteli_pro/subscription_collection.rb
@@ -18,7 +18,8 @@ def initialize(customer)
def build
AlaveteliPro::Subscription.new(
Stripe::Subscription.new.tap do |subscription|
- subscription.update_attributes(customer: @customer)
+ params = { customer: @customer }
+ subscription.update_attributes(params)
end
)
end
diff --git a/spec/fixtures/stripe_webhooks/customer.subscription.deleted.json b/spec/fixtures/stripe_webhooks/customer.subscription.deleted.json
new file mode 100644
index 0000000000..c9c3ebee2c
--- /dev/null
+++ b/spec/fixtures/stripe_webhooks/customer.subscription.deleted.json
@@ -0,0 +1,65 @@
+{
+ "created": 1326853478,
+ "livemode": false,
+ "id": "evt_00000000000000",
+ "type": "customer.subscription.deleted",
+ "object": "event",
+ "data": {
+ "object": {
+ "id": "su_00000000000000",
+ "items": {
+ "object": "list",
+ "data": [{
+ "id": "si_00000000000000",
+ "object": "subscription_item",
+ "created": 1497881783,
+ "plan": {
+ "interval": "month",
+ "product": "pr_00000000000000",
+ "amount": 100,
+ "currency": "usd",
+ "id": "fkx0AFo_00000000000000",
+ "object": "plan",
+ "livemode": false,
+ "interval_count": 1,
+ "trial_period_days": null,
+ "metadata": {}
+ },
+ "quantity": 1
+ },
+ {
+ "id": "si_00000000000001",
+ "object": "subscription_item",
+ "created": 1497881788,
+ "plan": {
+ "interval": "month",
+ "product": "pr_00000000000001",
+ "amount": 200,
+ "currency": "eur",
+ "id": "fkx0AFo_00000000000001",
+ "object": "plan",
+ "livemode": false,
+ "interval_count": 1,
+ "trial_period_days": null,
+ "metadata": {}
+ },
+ "quantity": 5
+ }
+ ]
+ },
+ "object": "subscription",
+ "start": 1381080564,
+ "status": "canceled",
+ "customer": "cus_00000000000000",
+ "cancel_at_period_end": false,
+ "current_period_start": 1381080564,
+ "current_period_end": 1383758964,
+ "ended_at": 1381021514,
+ "trial_start": null,
+ "trial_end": null,
+ "canceled_at": null,
+ "quantity": 1,
+ "application_fee_percent": null
+ }
+ }
+}
diff --git a/spec/fixtures/stripe_webhooks/invoice.payment_failed.json b/spec/fixtures/stripe_webhooks/invoice.payment_failed.json
new file mode 100644
index 0000000000..294270e46d
--- /dev/null
+++ b/spec/fixtures/stripe_webhooks/invoice.payment_failed.json
@@ -0,0 +1,105 @@
+{
+ "created": 1326853478,
+ "livemode": false,
+ "id": "evt_00000000000000",
+ "type": "invoice.payment_failed",
+ "object": "event",
+ "data": {
+ "object": {
+ "date": 1380674206,
+ "id": "in_00000000000000",
+ "period_start": 1378082075,
+ "period_end": 1380674075,
+ "lines": {
+ "object": "list",
+ "count": 3,
+ "url": "/v1/invoices/in_00000000000000/lines",
+ "data": [
+ {
+ "id": "ii_00000000000000",
+ "object": "line_item",
+ "type": "invoiceitem",
+ "livemode": false,
+ "amount": 19000,
+ "currency": "usd",
+ "proration": true,
+ "period": {
+ "start": 1393765661,
+ "end": 1393765661
+ },
+ "quantity": null,
+ "plan": null,
+ "description": "Remaining time on Platinum after 02 Mar 2014",
+ "metadata": {}
+ },
+ {
+ "id": "ii_00000000000001",
+ "object": "line_item",
+ "type": "invoiceitem",
+ "livemode": false,
+ "amount": -9000,
+ "currency": "usd",
+ "proration": true,
+ "period": {
+ "start": 1393765661,
+ "end": 1393765661
+ },
+ "quantity": null,
+ "plan": null,
+ "description": "Unused time on Gold after 05 Mar 2014",
+ "metadata": {}
+ },
+ {
+ "id": "su_00000000000000",
+ "object": "line_item",
+ "type": "subscription",
+ "livemode": false,
+ "amount": 20000,
+ "currency": "usd",
+ "proration": false,
+ "period": {
+ "start": 1383759053,
+ "end": 1386351053
+ },
+ "quantity": 1,
+ "plan": {
+ "interval": "month",
+ "product": "pr_00000000000000",
+ "created": 1300000000,
+ "amount": 20000,
+ "currency": "usd",
+ "id": "platinum",
+ "object": "plan",
+ "livemode": false,
+ "interval_count": 1,
+ "trial_period_days": null,
+ "metadata": {}
+ },
+ "description": null,
+ "metadata": null
+ }
+ ]
+ },
+ "subtotal": 30000,
+ "total": 30000,
+ "customer": "cus_00000000000000",
+ "object": "invoice",
+ "attempted": true,
+ "closed": false,
+ "paid": false,
+ "livemode": false,
+ "attempt_count": 1,
+ "amount_due": 30000,
+ "currency": "usd",
+ "starting_balance": 0,
+ "ending_balance": 0,
+ "next_payment_attempt": 1380760475,
+ "charge": "ch_00000000000000",
+ "discount": null,
+ "application_fee": null,
+ "subscription": "su_00000000000000",
+ "metadata": {},
+ "description": null
+ }
+ }
+}
diff --git a/spec/fixtures/stripe_webhooks/invoice.payment_succeeded.json b/spec/fixtures/stripe_webhooks/invoice.payment_succeeded.json
new file mode 100644
index 0000000000..9be30439cb
--- /dev/null
+++ b/spec/fixtures/stripe_webhooks/invoice.payment_succeeded.json
@@ -0,0 +1,112 @@
+{
+ "created": 1326853478,
+ "livemode": false,
+ "id": "evt_00000000000000",
+ "type": "invoice.payment_succeeded",
+ "object": "event",
+ "data": {
+ "object": {
+ "id": "in_00000000000000",
+ "object": "invoice",
+ "amount_due": 999,
+ "application_fee": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "charge": "ch_18EcOcLrgDIZ7iq8TaNlErVv",
+ "closed": true,
+ "currency": "eur",
+ "customer": "cus_00000000000000",
+ "created": 1464084258,
+ "description": null,
+ "discount": null,
+ "ending_balance": 0,
+ "forgiven": false,
+ "lines": {
+ "data": [{
+ "id": "sub_00000000000000",
+ "object": "line_item",
+ "amount": 50,
+ "currency": "eur",
+ "description": null,
+ "discountable": true,
+ "livemode": true,
+ "metadata": {},
+ "period": {
+ "start": 1500637196,
+ "end": 1532173196
+ },
+ "plan": {
+ "id": "platinum",
+ "object": "plan",
+ "amount": 500,
+ "created": 1499943145,
+ "currency": "eur",
+ "interval": "month",
+ "interval_count": 1,
+ "livemode": false,
+ "metadata": {},
+ "name": "New Plan Test",
+ "statement_descriptor": null,
+ "trial_period_days": null
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "subscription_item": "si_18ZfWyLrgDIZ7iq8fSlSNGIV",
+ "type": "subscription"
+ },
+ {
+ "id": "sub_00000000000000",
+ "object": "line_item",
+ "amount": 50,
+ "currency": "eur",
+ "description": null,
+ "discountable": true,
+ "livemode": true,
+ "metadata": {},
+ "period": {
+ "start": 1500637196,
+ "end": 1532173196
+ },
+ "plan": {
+ "id": "gold",
+ "object": "plan",
+ "amount": 300,
+ "created": 1499943155,
+ "currency": "eur",
+ "interval": "month",
+ "interval_count": 1,
+ "livemode": false,
+ "metadata": {},
+ "name": "New gold Plan Test",
+ "statement_descriptor": null,
+ "trial_period_days": null
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "subscription_item": "si_18ZfWyLrgDIZ7iq8fSlSNGIV",
+ "type": "subscription"
+ }],
+ "total_count": 1,
+ "object": "list",
+ "url": "/v1/invoices/in_18EcOcLrgDIZ7iq8zsDkunZ0/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "paid": true,
+ "period_end": 1464084258,
+ "period_start": 1464084258,
+ "receipt_number": null,
+ "starting_balance": 0,
+ "statement_descriptor": null,
+ "subscription": "sub_00000000000000",
+ "subtotal": 999,
+ "tax": null,
+ "tax_percent": null,
+ "total": 999,
+ "webhooks_delivered_at": 1464084258
+ }
+ }
+}
From 1428868d205e00967873a3cbb3038dc66e962ffe Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 20 Dec 2022 20:47:10 +0000
Subject: [PATCH 014/289] Add Ruby 3 support
- Use forked version of `ActsAsVersioned` which has
- Remove pry-byebug which isn't compiling on Ruby 3 (although Ruby 3.1
works).
---
Gemfile | 4 ++--
Gemfile.lock | 29 ++++++++++++++++-------------
Gemfile.rails_next.lock | 29 ++++++++++++++++-------------
3 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/Gemfile b/Gemfile
index 6bfdde4a6c..1bb99a031a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -93,7 +93,8 @@ end
gem 'pg', '~> 1.4.4'
# New gem releases aren't being done. master is newer and supports Rails > 3.0
-gem 'acts_as_versioned', :git => 'https://github.com/technoweenie/acts_as_versioned.git', :ref => '63b1fc8529d028'
+gem 'acts_as_versioned', git: 'https://github.com/mysociety/acts_as_versioned.git',
+ ref: '13e928b'
gem 'active_model_otp'
gem 'bcrypt', '~> 3.1.18'
gem 'cancancan', '~> 3.4.0'
@@ -194,7 +195,6 @@ group :test, :development do
gem 'rspec-activemodel-mocks', '~> 1.1.0'
gem 'rspec-rails', '~> 6.0.0'
gem 'pry', '~> 0.14.1'
- gem 'pry-byebug', '~> 3.10.1'
end
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index 88dc9ab842..739c5c2561 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,11 @@
+GIT
+ remote: https://github.com/mysociety/acts_as_versioned.git
+ revision: 13e928b8227349461205c2fa22d0bc3dbe2f1135
+ ref: 13e928b
+ specs:
+ acts_as_versioned (0.6.0)
+ activerecord (>= 3.0.9)
+
GIT
remote: https://github.com/mysociety/ruby-msg.git
revision: fae72e547299ab1f8b23239a79f5a1d353426b40
@@ -25,14 +33,6 @@ GIT
multi_json (~> 1.0)
stripe (> 5, < 6)
-GIT
- remote: https://github.com/technoweenie/acts_as_versioned.git
- revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
- ref: 63b1fc8529d028
- specs:
- acts_as_versioned (0.6.0)
- activerecord (>= 3.0.9)
-
PATH
remote: gems/alaveteli_features
specs:
@@ -146,7 +146,6 @@ GEM
bullet (7.0.4)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
- byebug (11.1.3)
cancancan (3.4.0)
capistrano (2.15.9)
highline
@@ -276,6 +275,8 @@ GEM
addressable (~> 2.3)
libv8-node (16.10.0.0)
libv8-node (16.10.0.0-aarch64-linux)
+ libv8-node (16.10.0.0-arm64-darwin)
+ libv8-node (16.10.0.0-x86_64-darwin)
libv8-node (16.10.0.0-x86_64-linux)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
@@ -316,6 +317,10 @@ GEM
racc (~> 1.4)
nokogiri (1.13.10-aarch64-linux)
racc (~> 1.4)
+ nokogiri (1.13.10-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.13.10-x86_64-darwin)
+ racc (~> 1.4)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
oink (0.10.1)
@@ -333,9 +338,6 @@ GEM
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
- pry-byebug (3.10.1)
- byebug (~> 11.0)
- pry (>= 0.13, < 0.15)
public_suffix (5.0.0)
racc (1.6.2)
rack (2.2.4)
@@ -513,7 +515,9 @@ GEM
PLATFORMS
aarch64-linux
+ arm64-darwin
ruby
+ x86_64-darwin
x86_64-linux
DEPENDENCIES
@@ -567,7 +571,6 @@ DEPENDENCIES
open4 (~> 1.3.0)
pg (~> 1.4.4)
pry (~> 0.14.1)
- pry-byebug (~> 3.10.1)
rack (~> 2.2.4)
rack-utf8_sanitizer (~> 1.7.0)
rails (~> 6.1.7)
diff --git a/Gemfile.rails_next.lock b/Gemfile.rails_next.lock
index 9b63000d1f..ed20ef99ca 100644
--- a/Gemfile.rails_next.lock
+++ b/Gemfile.rails_next.lock
@@ -1,3 +1,11 @@
+GIT
+ remote: https://github.com/mysociety/acts_as_versioned.git
+ revision: 13e928b8227349461205c2fa22d0bc3dbe2f1135
+ ref: 13e928b
+ specs:
+ acts_as_versioned (0.6.0)
+ activerecord (>= 3.0.9)
+
GIT
remote: https://github.com/mysociety/ruby-msg.git
revision: fae72e547299ab1f8b23239a79f5a1d353426b40
@@ -25,14 +33,6 @@ GIT
multi_json (~> 1.0)
stripe (> 5, < 6)
-GIT
- remote: https://github.com/technoweenie/acts_as_versioned.git
- revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
- ref: 63b1fc8529d028
- specs:
- acts_as_versioned (0.6.0)
- activerecord (>= 3.0.9)
-
PATH
remote: gems/alaveteli_features
specs:
@@ -152,7 +152,6 @@ GEM
bullet (7.0.4)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
- byebug (11.1.3)
cancancan (3.4.0)
capistrano (2.15.9)
highline
@@ -283,6 +282,8 @@ GEM
addressable (~> 2.3)
libv8-node (16.10.0.0)
libv8-node (16.10.0.0-aarch64-linux)
+ libv8-node (16.10.0.0-arm64-darwin)
+ libv8-node (16.10.0.0-x86_64-darwin)
libv8-node (16.10.0.0-x86_64-linux)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
@@ -340,6 +341,10 @@ GEM
racc (~> 1.4)
nokogiri (1.13.10-aarch64-linux)
racc (~> 1.4)
+ nokogiri (1.13.10-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.13.10-x86_64-darwin)
+ racc (~> 1.4)
nokogiri (1.13.10-x86_64-linux)
racc (~> 1.4)
oink (0.10.1)
@@ -357,9 +362,6 @@ GEM
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
- pry-byebug (3.10.1)
- byebug (~> 11.0)
- pry (>= 0.13, < 0.15)
public_suffix (5.0.0)
racc (1.6.2)
rack (2.2.4)
@@ -540,7 +542,9 @@ GEM
PLATFORMS
aarch64-linux
+ arm64-darwin
ruby
+ x86_64-darwin
x86_64-linux
DEPENDENCIES
@@ -595,7 +599,6 @@ DEPENDENCIES
open4 (~> 1.3.0)
pg (~> 1.4.4)
pry (~> 0.14.1)
- pry-byebug (~> 3.10.1)
rack (~> 2.2.4)
rack-utf8_sanitizer (~> 1.7.0)
rails (~> 7.0.4)
From bae6ff7384acb21ed967d1ca0739203a43e31268 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 19 Dec 2022 14:57:26 +0000
Subject: [PATCH 015/289] Add Ruby 3 to CI build matrix
Removes testing Rails 7 on Ruby 2.7 as we'll be upgrading Ruby first.
Update the Gemfile to remove some default gems which come with Ruby
which were added in #6703. These won't needed we're not support running
Alaveteli on Rails 7 and Ruby 2.7.
---
.github/workflows/ci.yml | 3 ++-
Gemfile | 5 -----
Gemfile.rails_next.lock | 6 ------
README.md | 1 +
4 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 51486cb02c..d412b6ac90 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,7 +25,8 @@ jobs:
matrix:
include:
- { ruby: 2.7, postgres: 13.5 }
- - { ruby: 2.7, postgres: 13.5, gemfile: 'Gemfile.rails_next' }
+ - { ruby: '3.0', postgres: 13.5 }
+ - { ruby: '3.0', postgres: 13.5, gemfile: 'Gemfile.rails_next' }
services:
postgres:
diff --git a/Gemfile b/Gemfile
index 1bb99a031a..fa2171ac62 100644
--- a/Gemfile
+++ b/Gemfile
@@ -172,11 +172,6 @@ gem 'aws-sdk-s3', require: false
gem 'azure-storage', require: false
gem 'google-cloud-storage', '~> 1.43', require: false
-if rails_upgrade? && RUBY_VERSION < '3.1'
- gem 'net-http', '0.1.1'
- gem 'uri', '0.10.0'
-end
-
group :test do
gem 'fivemat', '~> 1.3.7'
gem 'webmock', '~> 3.18.1'
diff --git a/Gemfile.rails_next.lock b/Gemfile.rails_next.lock
index ed20ef99ca..b105705b73 100644
--- a/Gemfile.rails_next.lock
+++ b/Gemfile.rails_next.lock
@@ -311,9 +311,6 @@ GEM
i18n (>= 0.6.4, <= 2)
multi_json (1.15.0)
multipart-post (2.2.3)
- net-http (0.1.1)
- net-protocol
- uri
net-imap (0.2.3)
digest
net-protocol
@@ -516,7 +513,6 @@ GEM
unicode-display_width (2.3.0)
unidecoder (1.1.2)
uniform_notifier (1.16.0)
- uri (0.10.0)
vpim (13.11.11)
web-console (4.2.0)
actionview (>= 6.0.0)
@@ -591,7 +587,6 @@ DEPENDENCIES
mini_magick (~> 4.11.0)
mini_racer (~> 0.6.3)
money (~> 6.16.0)
- net-http (= 0.1.1)
net-ssh (~> 7.0.1)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
nokogiri (~> 1.13.10)
@@ -628,7 +623,6 @@ DEPENDENCIES
uglifier (~> 4.2.0)
unicode (~> 0.4.4)
unidecoder (~> 1.1.0)
- uri (= 0.10.0)
vpim (~> 13.11.11)
web-console (>= 3.3.0)
webmock (~> 3.18.1)
diff --git a/README.md b/README.md
index b66a287c39..dd22d15634 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ see [the project website](http://alaveteli.org) for instructions on installing A
Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platforms](https://github.com/mysociety/alaveteli/blob/develop/.github/workflows/ci.yml#L15)
* ruby-2.7
+* ruby-3.0
If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 2.7.4), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.
From cb471ed02485b825e0864dc1aeab323f9498787e Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 12:06:05 +0000
Subject: [PATCH 016/289] Switch to using Ruby 3 by default
---
.github/workflows/rubocop.yml | 2 +-
.ruby-style.yml | 2 +-
.ruby-version.example | 2 +-
README.md | 2 +-
docker/Dockerfile | 2 +-
lib/tasks/config_files.rake | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml
index 3a3757a775..4707f2017e 100644
--- a/.github/workflows/rubocop.yml
+++ b/.github/workflows/rubocop.yml
@@ -14,7 +14,7 @@ jobs:
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
- ruby-version: 2.7
+ ruby-version: 3.0
- name: Run RuboCop linter
uses: reviewdog/action-rubocop@v1
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 598c65f829..31f8ed39e2 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -4,7 +4,7 @@ require:
- rubocop-rails
AllCops:
- TargetRubyVersion: 2.7
+ TargetRubyVersion: 3.0
RubyInterpreters:
- ruby
- rake
diff --git a/.ruby-version.example b/.ruby-version.example
index a4dd9dba4f..b0f2dcb32f 100644
--- a/.ruby-version.example
+++ b/.ruby-version.example
@@ -1 +1 @@
-2.7.4
+3.0.4
diff --git a/README.md b/README.md
index dd22d15634..ea6db2d1da 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platfo
* ruby-2.7
* ruby-3.0
-If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 2.7.4), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.
+If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 3.0.4), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.
## How to contribute
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 875fbe51b8..e08d9c4d41 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM ruby:2.7-bullseye
+FROM ruby:3.0-bullseye
ENV DOCKER 1
ENV DEBIAN_FRONTEND noninteractive
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 17daa13dec..e9b41368b1 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -80,7 +80,7 @@ namespace :config_files do
'VCSPATH=alaveteli ' \
'SITE=alaveteli ' \
'SCRIPT_FILE=config/alert-tracks-debian.example ' \
- 'RUBY_VERSION=2.7.4 ' \
+ 'RUBY_VERSION=3.0.4 ' \
'USE_RBENV=false '
check_for_env_vars(['DEPLOY_USER',
'VHOST_DIR',
@@ -125,7 +125,7 @@ namespace :config_files do
'VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli ' \
'SITE=alaveteli CRONTAB=config/crontab-example ' \
'MAILTO=cron-alaveteli@example.org ' \
- 'RUBY_VERSION=2.7.4 '
+ 'RUBY_VERSION=3.0.4 '
'USE_RBENV=false '
check_for_env_vars(['DEPLOY_USER',
'VHOST_DIR',
From 418e2a5101c8bb36ed84be51d8afff6cd2cad515 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 12:20:02 +0000
Subject: [PATCH 017/289] Drop support for Ruby 2.7
---
.github/workflows/ci.yml | 1 -
README.md | 1 -
2 files changed, 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d412b6ac90..237db10108 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,7 +24,6 @@ jobs:
fail-fast: false
matrix:
include:
- - { ruby: 2.7, postgres: 13.5 }
- { ruby: '3.0', postgres: 13.5 }
- { ruby: '3.0', postgres: 13.5, gemfile: 'Gemfile.rails_next' }
diff --git a/README.md b/README.md
index ea6db2d1da..44da287907 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,6 @@ see [the project website](http://alaveteli.org) for instructions on installing A
Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platforms](https://github.com/mysociety/alaveteli/blob/develop/.github/workflows/ci.yml#L15)
-* ruby-2.7
* ruby-3.0
If you use a ruby version management tool (such as RVM or .rbenv) and want to use the default development version used by the Alaveteli team (currently 3.0.4), you can create a `.ruby-version` symlink with a target of `.ruby-version.example` to switch to that automatically in the project directory.
From f2a3a0225968726f155fe545186674fed7f56ff3 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 12:07:44 +0000
Subject: [PATCH 018/289] Update changelog
---
doc/CHANGES.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 5de41d6074..0207f93eab 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -1,3 +1,16 @@
+# develop
+
+## Highlighted Features
+
+* Add support for Ruby 3 (Graeme Porteous)
+* Drop support for Ruby 2.7 (Graeme Porteous)
+
+## Upgrade Notes
+
+* To upgrade the Ruby version in your development Docker container please run:
+
+ docker/reset
+
# 0.42.0.0
## Highlighted Features
From 530ffa253e5f711eb0fd45b1e33ad293550a8e2d Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 10:03:37 +0000
Subject: [PATCH 019/289] Upgrade to Rails 7
---
Gemfile | 2 +-
Gemfile.lock | 161 ++++++++++--------
Gemfile.rails_next.lock | 2 +-
config/application.rb | 2 +-
.../alaveteli_features.gemspec | 4 +-
5 files changed, 94 insertions(+), 77 deletions(-)
diff --git a/Gemfile b/Gemfile
index fa2171ac62..9081e8727a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -81,7 +81,7 @@ source 'https://rubygems.org'
# See instructions in Gemfile.rails_next
def rails_upgrade?
- %w[1 true].include?(ENV['RAILS_UPGRADE'])
+ true
end
if rails_upgrade?
diff --git a/Gemfile.lock b/Gemfile.lock
index 739c5c2561..5e3625f3bc 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -17,11 +17,11 @@ GIT
GIT
remote: https://github.com/mysociety/strip_attributes.git
- revision: 62a5e1ee26501ad4c111b855cd73a5653091300b
- branch: globalize3-rails5.2
+ revision: 842a889258a897692296dff8445bb9dc12e676f8
+ branch: globalize3-rails7
specs:
- strip_attributes (1.11.0)
- activemodel (>= 3.0, < 7.0)
+ strip_attributes (1.12.0)
+ activemodel (>= 3.0, < 8.0)
GIT
remote: https://github.com/stripe-ruby-mock/stripe-ruby-mock
@@ -40,45 +40,52 @@ PATH
flipper (~> 0.10)
flipper-active_record (~> 0.10)
mime-types (< 3.0.0)
- rails (~> 6.1.4)
+ rails (~> 7.0.4)
GEM
remote: https://rubygems.org/
specs:
- actioncable (6.1.7)
- actionpack (= 6.1.7)
- activesupport (= 6.1.7)
+ actioncable (7.0.4)
+ actionpack (= 7.0.4)
+ activesupport (= 7.0.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (6.1.7)
- actionpack (= 6.1.7)
- activejob (= 6.1.7)
- activerecord (= 6.1.7)
- activestorage (= 6.1.7)
- activesupport (= 6.1.7)
+ actionmailbox (7.0.4)
+ actionpack (= 7.0.4)
+ activejob (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
mail (>= 2.7.1)
- actionmailer (6.1.7)
- actionpack (= 6.1.7)
- actionview (= 6.1.7)
- activejob (= 6.1.7)
- activesupport (= 6.1.7)
+ net-imap
+ net-pop
+ net-smtp
+ actionmailer (7.0.4)
+ actionpack (= 7.0.4)
+ actionview (= 7.0.4)
+ activejob (= 7.0.4)
+ activesupport (= 7.0.4)
mail (~> 2.5, >= 2.5.4)
+ net-imap
+ net-pop
+ net-smtp
rails-dom-testing (~> 2.0)
- actionpack (6.1.7)
- actionview (= 6.1.7)
- activesupport (= 6.1.7)
- rack (~> 2.0, >= 2.0.9)
+ actionpack (7.0.4)
+ actionview (= 7.0.4)
+ activesupport (= 7.0.4)
+ 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.7)
- actionpack (= 6.1.7)
- activerecord (= 6.1.7)
- activestorage (= 6.1.7)
- activesupport (= 6.1.7)
+ actiontext (7.0.4)
+ actionpack (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
+ globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (6.1.7)
- activesupport (= 6.1.7)
+ actionview (7.0.4)
+ activesupport (= 7.0.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@@ -86,27 +93,26 @@ GEM
active_model_otp (2.3.1)
activemodel
rotp (~> 6.2.0)
- activejob (6.1.7)
- activesupport (= 6.1.7)
+ activejob (7.0.4)
+ activesupport (= 7.0.4)
globalid (>= 0.3.6)
- activemodel (6.1.7)
- activesupport (= 6.1.7)
- activerecord (6.1.7)
- activemodel (= 6.1.7)
- activesupport (= 6.1.7)
- activestorage (6.1.7)
- actionpack (= 6.1.7)
- activejob (= 6.1.7)
- activerecord (= 6.1.7)
- activesupport (= 6.1.7)
+ activemodel (7.0.4)
+ activesupport (= 7.0.4)
+ activerecord (7.0.4)
+ activemodel (= 7.0.4)
+ activesupport (= 7.0.4)
+ activestorage (7.0.4)
+ actionpack (= 7.0.4)
+ activejob (= 7.0.4)
+ activerecord (= 7.0.4)
+ activesupport (= 7.0.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
- activesupport (6.1.7)
+ activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
- zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
annotate (3.2.0)
@@ -171,12 +177,13 @@ GEM
daemons (1.4.0)
dalli (3.2.3)
dante (0.2.0)
+ date (3.3.3)
declarative (0.0.20)
diff-lcs (1.5.0)
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
docile (1.3.5)
- erubi (1.11.0)
+ erubi (1.12.0)
eventmachine (1.2.7)
exception_notification (4.5.0)
actionmailer (>= 5.2, < 8)
@@ -196,10 +203,10 @@ GEM
fast_gettext (2.2.0)
ffi (1.15.5)
fivemat (1.3.7)
- flipper (0.22.1)
- flipper-active_record (0.22.1)
- activerecord (>= 4.2, < 7)
- flipper (~> 0.22.1)
+ flipper (0.24.1)
+ flipper-active_record (0.24.1)
+ activerecord (>= 4.2, < 8)
+ flipper (~> 0.24.1)
forwardable (1.3.2)
gender_detector (2.0.0)
gettext (3.4.3)
@@ -269,7 +276,7 @@ GEM
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
- json (2.6.2)
+ json (2.6.3)
jwt (2.5.0)
launchy (2.4.3)
addressable (~> 2.3)
@@ -299,15 +306,24 @@ GEM
mini_portile2 (2.8.1)
mini_racer (0.6.3)
libv8-node (~> 16.10.0.0)
- minitest (5.16.3)
+ minitest (5.17.0)
money (6.16.0)
i18n (>= 0.6.4, <= 2)
multi_json (1.15.0)
multipart-post (2.2.3)
+ net-imap (0.3.4)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.1)
+ timeout
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
+ net-smtp (0.3.3)
+ net-protocol
net-ssh (7.0.1)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
@@ -329,7 +345,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.1.2.1)
+ parser (3.1.3.0)
ast (~> 2.4.1)
pg (1.4.4)
prime (0.1.2)
@@ -340,26 +356,25 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.0)
racc (1.6.2)
- rack (2.2.4)
+ rack (2.2.5)
rack-test (2.0.2)
rack (>= 1.3)
rack-utf8_sanitizer (1.7.0)
rack (>= 1.0, < 3.0)
- rails (6.1.7)
- actioncable (= 6.1.7)
- actionmailbox (= 6.1.7)
- actionmailer (= 6.1.7)
- actionpack (= 6.1.7)
- actiontext (= 6.1.7)
- actionview (= 6.1.7)
- activejob (= 6.1.7)
- activemodel (= 6.1.7)
- activerecord (= 6.1.7)
- activestorage (= 6.1.7)
- activesupport (= 6.1.7)
+ rails (7.0.4)
+ actioncable (= 7.0.4)
+ actionmailbox (= 7.0.4)
+ actionmailer (= 7.0.4)
+ actionpack (= 7.0.4)
+ actiontext (= 7.0.4)
+ actionview (= 7.0.4)
+ activejob (= 7.0.4)
+ activemodel (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
bundler (>= 1.15.0)
- railties (= 6.1.7)
- sprockets-rails (>= 2.0.0)
+ railties (= 7.0.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -372,12 +387,13 @@ GEM
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
- railties (6.1.7)
- actionpack (= 6.1.7)
- activesupport (= 6.1.7)
+ railties (7.0.4)
+ actionpack (= 7.0.4)
+ activesupport (= 7.0.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
+ zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rb-fsevent (0.11.0)
@@ -430,7 +446,7 @@ GEM
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.23.0)
+ rubocop-ast (1.24.0)
parser (>= 3.1.1.0)
rubocop-performance (1.15.1)
rubocop (>= 1.7.0, < 2.0)
@@ -480,6 +496,7 @@ GEM
rack (>= 1, < 3)
thor (1.2.1)
tilt (2.0.10)
+ timeout (0.3.1)
trailblazer-option (0.1.2)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
@@ -573,7 +590,7 @@ DEPENDENCIES
pry (~> 0.14.1)
rack (~> 2.2.4)
rack-utf8_sanitizer (~> 1.7.0)
- rails (~> 6.1.7)
+ rails (~> 7.0.4)
rails-controller-testing
rails-i18n (~> 7.0.5)
recaptcha (~> 5.12.3)
diff --git a/Gemfile.rails_next.lock b/Gemfile.rails_next.lock
index b105705b73..9f5f4467aa 100644
--- a/Gemfile.rails_next.lock
+++ b/Gemfile.rails_next.lock
@@ -40,7 +40,7 @@ PATH
flipper (~> 0.10)
flipper-active_record (~> 0.10)
mime-types (< 3.0.0)
- rails (~> 7.0.2)
+ rails (~> 7.0.4)
GEM
remote: https://rubygems.org/
diff --git a/config/application.rb b/config/application.rb
index 88995704d2..7fe9fd31b7 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -23,7 +23,7 @@
Bundler.require(*Rails.groups)
def rails_upgrade?
- %w[1 true].include?(ENV['RAILS_UPGRADE'])
+ true
end
module Alaveteli
diff --git a/gems/alaveteli_features/alaveteli_features.gemspec b/gems/alaveteli_features/alaveteli_features.gemspec
index f1e643ced0..9b7dd7ce32 100644
--- a/gems/alaveteli_features/alaveteli_features.gemspec
+++ b/gems/alaveteli_features/alaveteli_features.gemspec
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'alaveteli_features/version'
def rails_upgrade?
- %w[1 true].include?(ENV['RAILS_UPGRADE'])
+ true
end
Gem::Specification.new do |spec|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
- spec.add_dependency "rails", rails_upgrade? ? "~> 7.0.2" : "~> 6.1.4"
+ spec.add_dependency "rails", rails_upgrade? ? "~> 7.0.4" : "~> 6.1.4"
spec.add_dependency "flipper", "~> 0.10"
spec.add_dependency "flipper-active_record", "~> 0.10"
# Mime types 3 needs Ruby 2.0.0 or greater, but we need to support 1.9.3 so
From 9bf0c864ba32e7c7c258d0d44fb4d992941def6e Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 5 Jan 2023 10:04:24 +0000
Subject: [PATCH 020/289] Remove rails_upgrade conditionals
Rails 6.1 is no more so we can drop the old implementation.
Leave conditionals methods in Gemfiles for when we prep for Rails edge.
---
Gemfile | 12 +-
app/views/admin_public_body/show.html.erb | 6 +-
config/application.rb | 9 +-
.../alaveteli_features.gemspec | 2 +-
spec/factories/mail_server_log_dones.rb | 6 +-
.../fixtures/files/yaml_compatibility_4_2.yml | 259 ------------------
spec/lib/yaml_compatability_spec.rb | 8 -
7 files changed, 8 insertions(+), 294 deletions(-)
delete mode 100644 spec/fixtures/files/yaml_compatibility_4_2.yml
diff --git a/Gemfile b/Gemfile
index 9081e8727a..c78ea73569 100644
--- a/Gemfile
+++ b/Gemfile
@@ -84,11 +84,7 @@ def rails_upgrade?
true
end
-if rails_upgrade?
- gem 'rails', '~> 7.0.4'
-else
- gem 'rails', '~> 6.1.7'
-end
+gem 'rails', '~> 7.0.4'
gem 'pg', '~> 1.4.4'
@@ -124,11 +120,7 @@ gem 'ruby-msg', '~> 1.5.0', :git => 'https://github.com/mysociety/ruby-msg.git',
gem 'rubyzip', '~> 2.3.2'
gem 'secure_headers', '~> 6.4.0'
gem 'statistics2', '~> 0.54'
-if rails_upgrade?
- gem 'strip_attributes', :git => 'https://github.com/mysociety/strip_attributes.git', :branch => 'globalize3-rails7'
-else
- gem 'strip_attributes', :git => 'https://github.com/mysociety/strip_attributes.git', :branch => 'globalize3-rails5.2'
-end
+gem 'strip_attributes', :git => 'https://github.com/mysociety/strip_attributes.git', :branch => 'globalize3-rails7'
gem 'stripe', '~> 5.55.0'
gem 'syck', '~> 1.4.1', require: false
gem 'syslog_protocol', '~> 0.9.0'
diff --git a/app/views/admin_public_body/show.html.erb b/app/views/admin_public_body/show.html.erb
index a577a679d9..5f693afd3e 100644
--- a/app/views/admin_public_body/show.html.erb
+++ b/app/views/admin_public_body/show.html.erb
@@ -78,11 +78,7 @@
diff --git a/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb b/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb
new file mode 100644
index 0000000000..8793b2115f
--- /dev/null
+++ b/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb
@@ -0,0 +1,5 @@
+class RemoveInfoRequestEventParamsYaml < ActiveRecord::Migration[7.0]
+ def change
+ remove_column :info_request_events, :params_yaml, :text
+ end
+end
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake
index c5989df626..06790d7616 100644
--- a/lib/tasks/temp.rake
+++ b/lib/tasks/temp.rake
@@ -1,84 +1,4 @@
namespace :temp do
- desc 'Convert old Syck YAML to Psych YAML'
- task convert_syck_to_psych_yaml: :environment do
- require 'syck'
-
- # requiring Syck redefines the YAML constant, we need to reset this back to
- # Psych otherwise we can't load the InfoRequestEvent instances.
- Object.send(:remove_const, :YAML)
- YAML = Psych
-
- scope = InfoRequestEvent.where(params: nil)
- count = scope.count
-
- scope.find_each.with_index do |event, index|
- begin
- Psych.parse(event.params_yaml)
- rescue Psych::SyntaxError
- yaml = Syck.load(event.params_yaml)
-
- event.no_xapian_reindex = true
- event.update(params_yaml: Psych.dump(yaml))
- end
-
- erase_line
- print "Converted InfoRequestEvent#param_yaml #{index + 1}/#{count}"
- end
-
- erase_line
- puts "Converted InfoRequestEvent#params_yaml completed."
- end
-
- desc "Fix old objects stored in YAML which can't be decoded"
- task fix_old_objects_in_yaml: :environment do
- scope = InfoRequestEvent.where(params: nil)
- count = scope.count
-
- scope.find_each.with_index do |event, index|
- yaml = Psych.dump(
- event.params.inject({}) do |params, (key, value)|
- begin
- # each param value needs to be able to converted into YAML but this
- # can blow up for old Ruby objects previously stored as newer Rails
- # can't correctly decode values generated older versions
- value.to_yaml if value.is_a?(ApplicationRecord)
- rescue NoMethodError
- # reload object from DB store YAML value doesn't need to be decoded
- value = value.reload
- end
- params[key] = value
- params
- end
- )
-
- event.no_xapian_reindex = true
- event.update(params_yaml: yaml)
-
- erase_line
- print "Fixed InfoRequestEvent#param_yaml #{index + 1}/#{count}"
- end
-
- erase_line
- puts "Fixed InfoRequestEvent#params_yaml completed."
- end
-
- desc 'Sanitise and populate events params json column from yaml'
- task sanitise_and_populate_events_params_json: :environment do
- scope = InfoRequestEvent.where(params: nil)
- count = scope.count
-
- scope.find_each.with_index do |event, index|
- event.no_xapian_reindex = true
- event.update(params: event.params)
-
- erase_line
- print "Populated InfoRequestEvent#param #{index + 1}/#{count}"
- end
-
- erase_line
- puts "Populated InfoRequestEvent#params completed."
- end
-
desc 'Migrate PublicBody notes into Note model'
task migrate_public_body_notes: :environment do
scope = PublicBody.where.not(notes: nil)
diff --git a/lib/yaml_compatibility.rb b/lib/yaml_compatibility.rb
deleted file mode 100644
index 07096a3424..0000000000
--- a/lib/yaml_compatibility.rb
+++ /dev/null
@@ -1,102 +0,0 @@
-##
-# Class to load YAML which includes legacy marshalled Ruby objects.
-#
-class YAMLCompatibility
- def self.load(yaml, aliases: false, filename: nil, fallback: nil,
- symbolize_names: false)
- result = if Gem::Version.new(YAML::VERSION) >= Gem::Version.new('3.1.0')
- YAML.parse(yaml, filename: filename)
- else
- YAML.parse(yaml, filename)
- end
- return fallback unless result
-
- result = visitor.accept(result)
- symbolize_names!(result) if symbolize_names
- result
- end
-
- def self.visitor
- class_loader = LegacyMapClassLoader.new
- scanner = YAML::ScalarScanner.new(class_loader)
- YAML::Visitors::ToRuby.new(scanner, class_loader)
- end
-
- # :nodoc:
- class LazyAttributeHash < ActiveModel::LazyAttributeHash
- def key?(key)
- delegate_hash.key?(key) ||
- (values && values.key?(key)) ||
- (types && types.key?(key))
- end
- end
-
- # :nodoc:
- class TimeZoneConverter
- def init_with(_coder); end
- end
-
- # :nodoc:
- LegacyObject = Class.new
-
- # :nodoc:
- class LegacyMapClassLoader < YAML::ClassLoader
- private
-
- MAPPINGS = {
- 'ActiveModel::LazyAttributeHash' =>
- 'YAMLCompatibility::LazyAttributeHash',
- 'ActiveRecord::LazyAttributeHash' =>
- 'YAMLCompatibility::LazyAttributeHash',
-
- # Rails <5
- 'ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter' =>
- 'YAMLCompatibility::TimeZoneConverter',
- 'ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer' =>
- 'ActiveModel::Type::Integer',
-
- # Rails 5.0
- 'ActiveModel::Type::Text' =>
- 'ActiveRecord::Type::Text',
-
- # Legacy classes
- 'PublicBodyTag' =>
- 'YAMLCompatibility::LegacyObject',
-
- 'TMail::AddressHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::Config' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ContentDispositionHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ContentTransferEncodingHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ContentTypeHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::DateTimeHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::Mail' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::MessageIdHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::MimeVersionHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ReceivedHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ReferencesHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::ReturnPathHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::SingleAddressHeader' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::StringPort' =>
- 'YAMLCompatibility::LegacyObject',
- 'TMail::UnstructuredHeader' =>
- 'YAMLCompatibility::LegacyObject'
- }
-
- def resolve(klassname)
- super(MAPPINGS[klassname] || klassname)
- end
- end
-end
diff --git a/script/load-sample-data b/script/load-sample-data
index 0301522731..1fb8a51ee2 100755
--- a/script/load-sample-data
+++ b/script/load-sample-data
@@ -42,7 +42,7 @@ fixture_files = ["public_bodies",
# append everything else that isn't order critical
Dir["#{fixtures_dir}/**/*.yml"].map{ |f| f[(fixtures_dir.size + 1)..-5] }.each do |fixture|
- next if fixture =~ /yaml_compatibility|refusal_advice/
+ next if fixture =~ /refusal_advice/
fixture_files << fixture unless fixture_files.include?(fixture)
end
diff --git a/spec/factories/info_request_events.rb b/spec/factories/info_request_events.rb
index e2b91825e7..0f194d7e5e 100644
--- a/spec/factories/info_request_events.rb
+++ b/spec/factories/info_request_events.rb
@@ -1,12 +1,11 @@
# == Schema Information
-# Schema version: 20220408125559
+# Schema version: 20230127132719
#
# Table name: info_request_events
#
# id :integer not null, primary key
# info_request_id :integer not null
# event_type :text not null
-# params_yaml :text not null
# created_at :datetime not null
# described_state :string
# calculated_state :string
diff --git a/spec/fixtures/files/yaml_compatibility_5_0.yml b/spec/fixtures/files/yaml_compatibility_5_0.yml
deleted file mode 100644
index 939190a94d..0000000000
--- a/spec/fixtures/files/yaml_compatibility_5_0.yml
+++ /dev/null
@@ -1,223 +0,0 @@
----
-:user: !ruby/object:User
- raw_attributes:
- name: Annie All Roles
- ban_text: ''
- closed_at:
- email: annie@localhost
- id: 8
- hashed_password: 6b7cd45a5f35fd83febc0452a799530398bfb6e8
- salt: "-6116981980.392287733335677"
- created_at: '2007-10-31 10:39:15.491593'
- updated_at: '2007-10-31 10:39:15.491593'
- email_confirmed: true
- url_name: annie_admin
- last_daily_track_email: '2000-01-01 00:00:00'
- about_me: All the roles
- locale: en
- email_bounced_at:
- email_bounce_message: ''
- no_limit: false
- receive_email_alerts: true
- can_make_batch_requests: false
- otp_enabled: false
- otp_secret_key:
- otp_counter: 1
- confirmed_not_spam: false
- comments_count: 0
- info_requests_count: 1
- track_things_count: 0
- request_classifications_count: 0
- public_body_change_requests_count: 0
- info_request_batches_count: 0
- daily_summary_hour:
- daily_summary_minute:
- attributes: !ruby/object:ActiveRecord::AttributeSet
- attributes: !ruby/object:ActiveRecord::LazyAttributeHash
- delegate_hash:
- name: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: name
- value_before_type_cast: Annie All Roles
- type: &1 !ruby/object:ActiveModel::Type::String
- precision:
- scale:
- limit:
- original_attribute:
- value: Annie All Roles
- ban_text: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: ban_text
- value_before_type_cast: ''
- type: &3 !ruby/object:ActiveModel::Type::Text
- precision:
- scale:
- limit:
- original_attribute:
- value: ''
- closed_at: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: closed_at
- value_before_type_cast:
- type: !ruby/object:ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- delegate_dc_obj: &2 !ruby/object:ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateTime
- precision:
- scale:
- limit:
- original_attribute:
- value:
- email: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email
- value_before_type_cast: annie@localhost
- type: *1
- original_attribute:
- value: annie@localhost
- id: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: id
- value_before_type_cast: 8
- type: &5 !ruby/object:ActiveModel::Type::Integer
- precision:
- scale:
- limit:
- range: !ruby/range
- begin: -2147483648
- end: 2147483648
- excl: true
- original_attribute:
- value: 8
- hashed_password: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: hashed_password
- value_before_type_cast: 6b7cd45a5f35fd83febc0452a799530398bfb6e8
- type: *1
- original_attribute:
- salt: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: salt
- value_before_type_cast: "-6116981980.392287733335677"
- type: *1
- original_attribute:
- created_at: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: created_at
- value_before_type_cast: '2007-10-31 10:39:15.491593'
- type: !ruby/object:ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- delegate_dc_obj: *2
- original_attribute:
- updated_at: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: updated_at
- value_before_type_cast: '2007-10-31 10:39:15.491593'
- type: !ruby/object:ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- delegate_dc_obj: *2
- original_attribute:
- email_confirmed: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_confirmed
- value_before_type_cast: true
- type: &4 !ruby/object:ActiveModel::Type::Boolean
- precision:
- scale:
- limit:
- original_attribute:
- url_name: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: url_name
- value_before_type_cast: annie_admin
- type: *3
- original_attribute:
- last_daily_track_email: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: last_daily_track_email
- value_before_type_cast: '2000-01-01 00:00:00'
- type: !ruby/object:ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- delegate_dc_obj: *2
- original_attribute:
- about_me: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: about_me
- value_before_type_cast: All the roles
- type: *3
- original_attribute:
- locale: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: locale
- value_before_type_cast: en
- type: *1
- original_attribute:
- email_bounced_at: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_bounced_at
- value_before_type_cast:
- type: !ruby/object:ActiveRecord::AttributeMethods::TimeZoneConversion::TimeZoneConverter
- delegate_dc_obj: *2
- original_attribute:
- email_bounce_message: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_bounce_message
- value_before_type_cast: ''
- type: *3
- original_attribute:
- no_limit: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: no_limit
- value_before_type_cast: false
- type: *4
- original_attribute:
- receive_email_alerts: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: receive_email_alerts
- value_before_type_cast: true
- type: *4
- original_attribute:
- can_make_batch_requests: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: can_make_batch_requests
- value_before_type_cast: false
- type: *4
- original_attribute:
- otp_enabled: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_enabled
- value_before_type_cast: false
- type: *4
- original_attribute:
- otp_secret_key: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_secret_key
- value_before_type_cast:
- type: *1
- original_attribute:
- otp_counter: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_counter
- value_before_type_cast: 1
- type: *5
- original_attribute:
- confirmed_not_spam: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: confirmed_not_spam
- value_before_type_cast: false
- type: *4
- original_attribute:
- comments_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: comments_count
- value_before_type_cast: 0
- type: *5
- original_attribute:
- info_requests_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: info_requests_count
- value_before_type_cast: 1
- type: *5
- original_attribute:
- track_things_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: track_things_count
- value_before_type_cast: 0
- type: *5
- original_attribute:
- request_classifications_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: request_classifications_count
- value_before_type_cast: 0
- type: *5
- original_attribute:
- public_body_change_requests_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: public_body_change_requests_count
- value_before_type_cast: 0
- type: *5
- original_attribute:
- info_request_batches_count: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: info_request_batches_count
- value_before_type_cast: 0
- type: *5
- original_attribute:
- daily_summary_hour: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: daily_summary_hour
- value_before_type_cast:
- type: *5
- original_attribute:
- daily_summary_minute: !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: daily_summary_minute
- value_before_type_cast:
- type: *5
- original_attribute:
- new_record: false
- active_record_yaml_version: 1
diff --git a/spec/fixtures/files/yaml_compatibility_5_1.yml b/spec/fixtures/files/yaml_compatibility_5_1.yml
deleted file mode 100644
index b54cb5d2e1..0000000000
--- a/spec/fixtures/files/yaml_compatibility_5_1.yml
+++ /dev/null
@@ -1,93 +0,0 @@
----
-:user: !ruby/object:User
- concise_attributes:
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: name
- value_before_type_cast: Annie All Roles
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: ban_text
- value_before_type_cast: ''
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: closed_at
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email
- value_before_type_cast: annie@localhost
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: id
- value_before_type_cast: 8
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: hashed_password
- value_before_type_cast: 6b7cd45a5f35fd83febc0452a799530398bfb6e8
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: salt
- value_before_type_cast: "-6116981980.392287733335677"
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: created_at
- value_before_type_cast: '2007-10-31 10:39:15.491593'
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: updated_at
- value_before_type_cast: '2007-10-31 10:39:15.491593'
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_confirmed
- value_before_type_cast: true
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: url_name
- value_before_type_cast: annie_admin
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: last_daily_track_email
- value_before_type_cast: '2000-01-01 00:00:00'
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: about_me
- value_before_type_cast: All the roles
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: locale
- value_before_type_cast: en
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_bounced_at
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: email_bounce_message
- value_before_type_cast: ''
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: no_limit
- value_before_type_cast: false
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: receive_email_alerts
- value_before_type_cast: true
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: can_make_batch_requests
- value_before_type_cast: false
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_enabled
- value_before_type_cast: false
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_secret_key
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: otp_counter
- value_before_type_cast: 1
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: confirmed_not_spam
- value_before_type_cast: false
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: comments_count
- value_before_type_cast: 0
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: info_requests_count
- value_before_type_cast: 1
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: track_things_count
- value_before_type_cast: 0
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: request_classifications_count
- value_before_type_cast: 0
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: public_body_change_requests_count
- value_before_type_cast: 0
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: info_request_batches_count
- value_before_type_cast: 0
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: daily_summary_hour
- - !ruby/object:ActiveRecord::Attribute::FromDatabase
- name: daily_summary_minute
- new_record: false
- active_record_yaml_version: 2
diff --git a/spec/fixtures/files/yaml_compatibility_public_body_tag.yml b/spec/fixtures/files/yaml_compatibility_public_body_tag.yml
deleted file mode 100644
index 29112db217..0000000000
--- a/spec/fixtures/files/yaml_compatibility_public_body_tag.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-public_body_tags:
-- !ruby/object:PublicBodyTag
- attributes:
- name: police
- public_body_id: "1"
- id: "2"
- attributes_cache: {}
diff --git a/spec/fixtures/files/yaml_compatibility_tmail.yml b/spec/fixtures/files/yaml_compatibility_tmail.yml
deleted file mode 100644
index a0e7078a19..0000000000
--- a/spec/fixtures/files/yaml_compatibility_tmail.yml
+++ /dev/null
@@ -1,62 +0,0 @@
----
-email: !ruby/object:TMail::Mail
- port: !ruby/object:TMail::StringPort
- buffer: ! "From: \"FOI Person\" \nTo: \"Bob Smith\" \nDate:
- Tue, 13 Nov 2007 11:39:55 +0000\nBcc: \nSubject: Geraldine FOI Code AZXB421\nReply-To:
- \nIn-Reply-To: <471f1eae5d1cb_7347..fdbe67386163@cat.tmail>\n\nNo way! I'm not
- going to tell you that in a month of Thursdays.\n\nThe Geraldine Quango\n\nOn
- Wed, Oct 24, 2007 at 11:30:06AM +0100, Bob Smith wrote:\n> Why do you have such
- a fancy dog?\n\n"
- config: &70134848947220 !ruby/object:TMail::Config
- strict_parse: false
- strict_base64decode: false
- header:
- from: !ruby/object:TMail::AddressHeader
- body: ! '"FOI Person"
-
- '
- config: *70134848947220
- illegal: false
- parsed: false
- to: !ruby/object:TMail::AddressHeader
- body: ! '"Bob Smith"
-
- '
- config: *70134848947220
- illegal: false
- parsed: false
- date: !ruby/object:TMail::DateTimeHeader
- body: ! 'Tue, 13 Nov 2007 11:39:55 +0000
-
- '
- config: *70134848947220
- illegal: false
- parsed: false
- bcc: !ruby/object:TMail::AddressHeader
- body: ''
- config: *70134848947220
- illegal: false
- parsed: false
- subject: !ruby/object:TMail::UnstructuredHeader
- body: ! 'Geraldine FOI Code AZXB421
-
- '
- config: *70134848947220
- illegal: false
- parsed: false
- reply-to: !ruby/object:TMail::AddressHeader
- body: ''
- config: *70134848947220
- illegal: false
- parsed: false
- in-reply-to: !ruby/object:TMail::ReferencesHeader
- body: ! '<471f1eae5d1cb_7347..fdbe67386163@cat.tmail>
-
- '
- config: *70134848947220
- illegal: false
- parsed: false
- body_port:
- body_parsed: false
- epilogue: ''
- parts: []
diff --git a/spec/fixtures/info_request_events.yml b/spec/fixtures/info_request_events.yml
index 177d4a97f7..8eb1cece3a 100644
--- a/spec/fixtures/info_request_events.yml
+++ b/spec/fixtures/info_request_events.yml
@@ -1,12 +1,11 @@
# == Schema Information
-# Schema version: 20220408125559
+# Schema version: 20230127132719
#
# Table name: info_request_events
#
# id :integer not null, primary key
# info_request_id :integer not null
# event_type :text not null
-# params_yaml :text not null
# created_at :datetime not null
# described_state :string
# calculated_state :string
@@ -20,8 +19,6 @@
useless_outgoing_message_event:
id: 900
- params_yaml: "--- \n\
- :outgoing_message_id: 1\n"
params:
outgoing_message_id: 1
info_request_id: 101
@@ -31,8 +28,6 @@ useless_outgoing_message_event:
outgoing_message_id: 1
silly_outgoing_message_event:
id: 901
- params_yaml: "--- \n\
- :outgoing_message_id: 2\n"
params:
outgoing_message_id: 2
info_request_id: 103
@@ -44,8 +39,6 @@ silly_outgoing_message_event:
last_described_at: 2007-10-14 10:41:12.686264
useless_incoming_message_event:
id: 902
- params_yaml: "--- \n\
- :incoming_message_id: 1\n"
params:
incoming_message_id: 1
info_request_id: 101
@@ -55,8 +48,6 @@ useless_incoming_message_event:
incoming_message_id: 1
silly_comment_event:
id: 903
- params_yaml: "--- \n\
- :comment_id: 1\n"
params:
comment_id: 1
incoming_message_id:
@@ -70,8 +61,6 @@ silly_comment_event:
created_at: 2008-08-12 23:05:12.500942
badger_outgoing_message_event:
id: 904
- params_yaml: "--- \n\
- :outgoing_message_id: 3\n"
params:
outgoing_message_id: 3
info_request_id: 104
@@ -84,8 +73,6 @@ badger_outgoing_message_event:
# These in chronological order
boring_outgoing_message_event:
id: 905
- params_yaml: "--- \n\
- :outgoing_message_id: 4\n"
params:
outgoing_message_id: 4
outgoing_message_id: 4
@@ -96,8 +83,6 @@ boring_outgoing_message_event:
calculated_state: waiting_response
useful_incoming_message_event:
id: 906
- params_yaml: "--- \n\
- :incoming_message_id: 2\n"
params:
incoming_message_id: 2
incoming_message_id: 2
@@ -109,8 +94,6 @@ useful_incoming_message_event:
another_boring_outgoing_message_event:
id: 907
- params_yaml: "--- \n\
- :outgoing_message_id: 5\n"
params:
outgoing_message_id: 5
outgoing_message_id: 5
@@ -121,8 +104,6 @@ another_boring_outgoing_message_event:
calculated_state: waiting_response
another_useful_incoming_message_event:
id: 908
- params_yaml: "--- \n\
- :incoming_message_id: 3\n"
params:
incoming_message_id: 3
incoming_message_id: 3
@@ -135,8 +116,6 @@ another_useful_incoming_message_event:
# The spam requests were both successful
spam_1_outgoing_message_event:
id: 910
- params_yaml: "--- \n\
- :outgoing_message_id: 6\n"
params:
outgoing_message_id: 6
outgoing_message_id: 6
@@ -147,8 +126,6 @@ spam_1_outgoing_message_event:
calculated_state: waiting_response
spam_1_incoming_message_event:
id: 911
- params_yaml: "--- \n\
- :incoming_message_id: 4\n"
params:
incoming_message_id: 4
incoming_message_id: 4
@@ -160,8 +137,6 @@ spam_1_incoming_message_event:
spam_2_outgoing_message_event:
id: 912
- params_yaml: "--- \n\
- :outgoing_message_id: 7\n"
params:
outgoing_message_id: 7
outgoing_message_id: 7
@@ -172,8 +147,6 @@ spam_2_outgoing_message_event:
calculated_state: waiting_response
spam_2_incoming_message_event:
id: 913
- params_yaml: "--- \n\
- :incoming_message_id: 5\n"
params:
incoming_message_id: 5
incoming_message_id: 5
@@ -185,8 +158,6 @@ spam_2_incoming_message_event:
external_outgoing_message_event:
id: 914
- params_yaml: "--- \n\
- :outgoing_message_id: 8\n"
params:
outgoing_message_id: 8
outgoing_message_id: 8
@@ -198,8 +169,6 @@ external_outgoing_message_event:
anonymous_external_outgoing_message_event:
id: 915
- params_yaml: "--- \n\
- :outgoing_message_id: 9\n"
params:
outgoing_message_id: 9
outgoing_message_id: 9
@@ -211,8 +180,6 @@ anonymous_external_outgoing_message_event:
other_request_outgoing_message_event:
id: 916
- params_yaml: "--- \n\
- :outgoing_message_id: 10\n"
params:
outgoing_message_id: 10
outgoing_message_id: 10
diff --git a/spec/lib/yaml_compatability_spec.rb b/spec/lib/yaml_compatability_spec.rb
deleted file mode 100644
index 482ea5aa01..0000000000
--- a/spec/lib/yaml_compatability_spec.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'spec_helper'
-require Rails.root.join('lib/yaml_compatibility')
-
-RSpec.describe YAMLCompatibility do
- describe '.load' do
- subject(:output_hash) { described_class.load(content) }
- let(:hash) { YAML.load(yaml_compatibility_fixture('5_1')) }
-
- context 'with Rails 5.0 YAML file' do
- let(:content) { yaml_compatibility_fixture('5_0') }
-
- it 'correctly loads YAML file' do
- is_expected.to eq hash if RUBY_VERSION < '3.1'
- end
- end
-
- context 'with Rails 5.1 YAML file' do
- let(:content) { yaml_compatibility_fixture('5_1') }
-
- it 'correctly loads YAML file' do
- is_expected.to eq hash if RUBY_VERSION < '3.1'
- end
- end
-
- context 'YAML file with old PublicBodyTag class' do
- let(:content) { yaml_compatibility_fixture('public_body_tag') }
-
- it 'does not raise an error' do
- expect { output_hash }.to_not raise_error
- end
- end
-
- context 'YAML file with old TMail classes' do
- let(:content) { yaml_compatibility_fixture('tmail') }
-
- it 'does not raise an error' do
- expect { output_hash }.to_not raise_error
- end
- end
- end
-
- private
-
- def yaml_compatibility_fixture(file)
- load_file_fixture("yaml_compatibility_#{file}.yml")
- end
-end
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 7bc84b7f58..4894db65bb 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -1,12 +1,11 @@
# == Schema Information
-# Schema version: 20220408125559
+# Schema version: 20230127132719
#
# Table name: info_request_events
#
# id :integer not null, primary key
# info_request_id :integer not null
# event_type :text not null
-# params_yaml :text not null
# created_at :datetime not null
# described_state :string
# calculated_state :string
@@ -41,16 +40,9 @@
it "should convert event parameters into YAML and back successfully" do
example_params = { :foo => 'this is stuff', :bar => 83, :humbug => "yikes!!!" }
ire.params = example_params
- expect(ire.params_yaml).to eq(example_params.to_yaml)
expect(ire.params).to eq(example_params)
end
- it "should restore UTF8-heavy params stored under ruby 1.8 as UTF-8" do
- utf8_params = "--- \n:foo: !binary |\n 0KLQvtCz0LDRiCDR\n"
- ire.params_yaml = utf8_params
- expect(ire.params[:foo].encoding.to_s).to eq('UTF-8')
- end
-
it "should store the incoming_message, outgoing_messsage and comment ids" do
comment = FactoryBot.create(:comment)
example_params = {:incoming_message_id => 1,
@@ -90,12 +82,6 @@
ire.params = { foo_id: 4 }
expect(ire.params).to include(foo_id: 4)
end
-
- it "should allow params_yaml to be blank" do
- ire.params_yaml = ''
-
- expect(ire.params).to eql({})
- end
end
describe 'when deciding if it is indexed by search' do
@@ -324,15 +310,6 @@
end
end
- describe '#params' do
- it 'should not error with Rails 5.0 params' do
- ire = InfoRequestEvent.new(
- params_yaml: load_file_fixture('yaml_compatibility_5_0.yml')
- )
- expect { ire.params }.to_not raise_error
- end
- end
-
describe '#params_diff' do
let(:ire) { InfoRequestEvent.new }
From 404921de256f27e68e61fdd0140d81be946c6d16 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 1 Feb 2023 17:55:43 +0000
Subject: [PATCH 066/289] Extract old request magic variables
Want to use these values in help pages so that configuration changes do
not go out of sync with explanatory text.
---
app/models/info_request.rb | 15 ++++++++++-----
spec/models/info_request_spec.rb | 24 ++++++++++++++++++++++++
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index d54b029f82..70881e2ee1 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -531,18 +531,23 @@ def self.reject_incoming_at_mta(options)
end
end
+ def self.requests_old_after_months
+ AlaveteliConfiguration.restrict_new_responses_on_old_requests_after_months
+ end
+
+ def self.requests_very_old_after_months
+ requests_old_after_months * 4
+ end
+
# This is called from cron regularly.
def self.stop_new_responses_on_old_requests
- old = AlaveteliConfiguration.restrict_new_responses_on_old_requests_after_months
- very_old = old * 4
-
# 'old' months since last change to request, only allow new incoming
# messages from authority domains
InfoRequest
.been_published
.where(allow_new_responses_from: 'anybody')
.where.not(url_title: 'holding_pen')
- .updated_before(old.months.ago.to_date)
+ .updated_before(requests_old_after_months.months.ago.to_date)
.find_in_batches do |batch|
batch.each do |info_request|
old_allow_new_responses_from = info_request.allow_new_responses_from
@@ -565,7 +570,7 @@ def self.stop_new_responses_on_old_requests
.been_published
.where(allow_new_responses_from: %w[anybody authority_only])
.where.not(url_title: 'holding_pen')
- .updated_before(very_old.months.ago.to_date)
+ .updated_before(requests_very_old_after_months.months.ago.to_date)
.find_in_batches do |batch|
batch.each do |info_request|
old_allow_new_responses_from = info_request.allow_new_responses_from
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 2f3accff7c..dd11c58ef4 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -82,6 +82,30 @@
end
end
+ describe '.requests_old_after_months' do
+ subject { described_class.requests_old_after_months }
+
+ before do
+ allow(AlaveteliConfiguration).
+ to receive(:restrict_new_responses_on_old_requests_after_months).
+ and_return(1)
+ end
+
+ it { is_expected.to eq(1) }
+ end
+
+ describe '.requests_very_old_after_months' do
+ subject { described_class.requests_very_old_after_months }
+
+ before do
+ allow(AlaveteliConfiguration).
+ to receive(:restrict_new_responses_on_old_requests_after_months).
+ and_return(1)
+ end
+
+ it { is_expected.to eq(4) }
+ end
+
describe '#foi_attachments' do
subject { info_request.foi_attachments }
From 8ad7d666a5ade2bc26011bc9c8616ac3d30ac7bc Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 3 Feb 2023 10:44:16 +0000
Subject: [PATCH 067/289] Remove deprecated methods
---
app/models/comment.rb | 6 ------
app/models/incoming_message.rb | 19 -------------------
2 files changed, 25 deletions(-)
diff --git a/app/models/comment.rb b/app/models/comment.rb
index adc73e8d02..256c56c520 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -108,12 +108,6 @@ def reindex_request_events
info_request_events.find_each(&:xapian_mark_needs_index)
end
- def event_xapian_update
- warn 'DEPRECATION: Comment#event_xapian_update will be removed in 0.42. ' \
- 'It has been replaced with Comment#reindex_request_events'
- reindex_request_events
- end
-
# Return body for display as HTML
def get_body_for_html_display
text = body.strip
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 096213af00..9f0bd0f3a2 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -115,12 +115,6 @@ def parse_raw_email!(force = nil)
alias_method :valid_to_reply_to?, :valid_to_reply_to
- def mail_from
- warn %q([DEPRECATION] IncomingMessage#mail_from will be removed in 0.42. It
- has been replaced by IncomingMessage#from_name).squish
- from_name
- end
-
# Public: The display name of the email sender with the associated
# InfoRequest's censor rules applied.
#
@@ -135,23 +129,10 @@ def mail_from
# # => FOI [REDACTED]
#
# Returns a String
- def safe_mail_from
- warn %q([DEPRECATION] IncomingMessage#safe_mail_from will be removed in
- 0.42. It has been replaced by IncomingMessage#safe_from_name).squish
- safe_from_name
- end
-
def safe_from_name
info_request.apply_censor_rules_to_text(from_name) if from_name
end
- def mail_from_domain
- warn %q([DEPRECATION] IncomingMessage#mail_from_domain will be removed in
- 0.42. It has been replaced by
- IncomingMessage#from_email_domain).squish
- from_email_domain
- end
-
def specific_from_name?
!safe_from_name.nil? && safe_from_name.strip != info_request.public_body.name.strip
end
From 0f4e9fd8c073226c83f91df8a3ffc3cad4033ed4 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 12:46:08 +0000
Subject: [PATCH 068/289] Refactor: Comment annotation linting
---
app/controllers/application_controller.rb | 2 +-
app/mailers/outgoing_mailer.rb | 2 +-
lib/mail_handler.rb | 2 +-
spec/lib/alaveteli_pro/metrics_report_spec.rb | 2 +-
spec/models/user_spec.rb | 2 +-
.../info_request_batches/_authority_list.html.erb_spec.rb | 2 +-
.../info_request_batches/_authority_list.text.erb_spec.rb | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ea80e6a4c2..a789da1ded 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -32,7 +32,7 @@ class RouteNotFound < StandardError
include FastGettext::Translation # make functions like _, n_, N_ etc available)
include AlaveteliPro::PostRedirectHandler
- # Note: a filter stops the chain if it redirects or renders something
+ # NOTE: a filter stops the chain if it redirects or renders something
before_action :html_response
before_action :authentication_check
before_action :check_in_post_redirect
diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb
index bf11b55dbf..ebee8e4762 100644
--- a/app/mailers/outgoing_mailer.rb
+++ b/app/mailers/outgoing_mailer.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
-# Note: The layout for this wraps messages by lines rather than (blank line
+# NOTE: The layout for this wraps messages by lines rather than (blank line
# separated) paragraphs, as is the convention for all the other mailers. This
# turned out to fit better with user exepectations when formatting messages.
#
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index 9a12ee2153..087e9b1cdd 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -67,7 +67,7 @@ def normalise_content_type(content_type)
end
def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
- # note re. charset: TMail always tries to convert email bodies
+ # NOTE: re. charset: TMail always tries to convert email bodies
# to UTF8 by default, so normally it should already be that.
text = ''
# TODO: - tell all these command line tools to return utf-8
diff --git a/spec/lib/alaveteli_pro/metrics_report_spec.rb b/spec/lib/alaveteli_pro/metrics_report_spec.rb
index aa39a0c0b3..9a97ff819a 100644
--- a/spec/lib/alaveteli_pro/metrics_report_spec.rb
+++ b/spec/lib/alaveteli_pro/metrics_report_spec.rb
@@ -149,7 +149,7 @@
subscription = Stripe::Subscription.create(customer: customer,
plan: pro_plan.id)
- # note - in later API versions, at_period_end is no longer
+ # NOTE: - in later API versions, at_period_end is no longer
# available for delete so we'd have to call something like
# this instead:
# Stripe::Subscription.update(subscription.id,
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c4f771ea9a..68a7557ac3 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1522,7 +1522,7 @@ def create_user(options = {})
end
it "returns all of the user's events" do
- # Note: there is a fourth "sent" event created automatically
+ # NOTE: there is a fourth "sent" event created automatically
expect(user.info_request_events.count).to eq 4
end
end
diff --git a/spec/views/alaveteli_pro/info_request_batches/_authority_list.html.erb_spec.rb b/spec/views/alaveteli_pro/info_request_batches/_authority_list.html.erb_spec.rb
index 7869f2568d..795efdf0e9 100644
--- a/spec/views/alaveteli_pro/info_request_batches/_authority_list.html.erb_spec.rb
+++ b/spec/views/alaveteli_pro/info_request_batches/_authority_list.html.erb_spec.rb
@@ -15,7 +15,7 @@ def render_html_partial(public_bodies)
it "escapes HTMLEntities in public body names" do
render_html_partial(public_bodies)
- # Note: using include not have_text to test the html entity is there
+ # NOTE: using include not have_text to test the html entity is there
expect(response).to include("One & Two")
expect(response).not_to include("One & Two")
end
diff --git a/spec/views/alaveteli_pro/info_request_batches/_authority_list.text.erb_spec.rb b/spec/views/alaveteli_pro/info_request_batches/_authority_list.text.erb_spec.rb
index 94d04d3f97..cdf6ef3d08 100644
--- a/spec/views/alaveteli_pro/info_request_batches/_authority_list.text.erb_spec.rb
+++ b/spec/views/alaveteli_pro/info_request_batches/_authority_list.text.erb_spec.rb
@@ -17,7 +17,7 @@ def render_text_partial(public_bodies)
it "doesn't escape HTMLEntities in public body names" do
render_text_partial(public_bodies)
- # Note: using include not have_text to test the html entity is not there
+ # NOTE: using include not have_text to test the html entity is not there
expect(response).to include("One & Two")
expect(response).not_to include("One & Two")
end
From f0979da311b5722ff1a42c5a7d75553decff9af4 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 12:46:54 +0000
Subject: [PATCH 069/289] Refactor: Numeric literals linting
---
app/controllers/admin_public_body_controller.rb | 2 +-
app/controllers/request_game_controller.rb | 2 +-
app/models/incoming_message.rb | 4 ++--
app/models/request_classification.rb | 4 ++--
lib/database_collation.rb | 2 +-
lib/mail_handler.rb | 2 +-
spec/controllers/request_controller_spec.rb | 2 +-
spec/helpers/analytics_helper_spec.rb | 2 +-
spec/helpers/currency_helper_spec.rb | 8 ++++----
spec/lib/database_collation_spec.rb | 4 ++--
.../previews/alaveteli_pro/metrics_mailer_preview.rb | 2 +-
spec/models/incoming_message_spec.rb | 6 +++---
spec/models/info_request_spec.rb | 10 +++++-----
.../_cancel_subscription.html.erb_spec.rb | 4 ++--
14 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index e82a37c0bd..1dbaf53ac0 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -207,7 +207,7 @@ def import_csv
# Save the contents to a temporary file - not using Tempfile as we need
# the file to persist between requests. Return the name of the file.
def store_csv_data(csv_contents)
- tempfile_name = "csv_upload-#{Time.zone.now.strftime("%Y%m%d")}-#{SecureRandom.random_number(10000)}"
+ tempfile_name = "csv_upload-#{Time.zone.now.strftime("%Y%m%d")}-#{SecureRandom.random_number(10_000)}"
tempfile = File.new(File.join(Dir::tmpdir, tempfile_name), 'w')
tempfile.write(csv_contents)
tempfile.close
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index c3c0acf704..f7bf70ba42 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -16,7 +16,7 @@ def play
@total = InfoRequest.is_searchable.count
@done = @total - @missing
@percentage = if @total > 0
- (@done.to_f / @total.to_f * 10000).round / 100.0
+ (@done.to_f / @total.to_f * 10_000).round / 100.0
else
100.0
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 096213af00..1287273ceb 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -41,7 +41,7 @@ class IncomingMessage < ApplicationRecord
include CacheAttributesFromRawEmail
include Taggable
- MAX_ATTACHMENT_TEXT_CLIPPED = 1000000 # 1Mb ish
+ MAX_ATTACHMENT_TEXT_CLIPPED = 1_000_000 # 1Mb ish
belongs_to :info_request,
inverse_of: :incoming_messages,
@@ -343,7 +343,7 @@ def _cache_main_body_text
# - this also effectively does a .dup as well, so text mods don't alter original
text = text.split(/^begin.+^`\n^end\n/m).join(" ")
- if text.size > 1000000 # 1 MB ish
+ if text.size > 1_000_000 # 1 MB ish
raise "main body text more than 1 MB, need to implement clipping like for attachment text, or there is some other MIME decoding problem or similar"
end
diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb
index bfce22be80..d0e4ff3889 100644
--- a/app/models/request_classification.rb
+++ b/app/models/request_classification.rb
@@ -12,8 +12,8 @@
class RequestClassification < ApplicationRecord
MILESTONES = [
- 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 75000, 100000,
- 250000, 500000, 750000, 1000000
+ 100, 250, 500, 1000, 2500, 5000, 10_000, 25_000, 50_000, 75_000, 100_000,
+ 250_000, 500_000, 750_000, 1_000_000
].freeze
belongs_to :user,
diff --git a/lib/database_collation.rb b/lib/database_collation.rb
index f0cc6a8ac9..c72535d085 100644
--- a/lib/database_collation.rb
+++ b/lib/database_collation.rb
@@ -3,7 +3,7 @@
# a given language. Prefer the class method .supports? rather than creating a
# new instance.
class DatabaseCollation
- MINIMUM_POSTGRESQL_VERSION = 90112
+ MINIMUM_POSTGRESQL_VERSION = 90112 # rubocop:disable Style/NumericLiterals
attr_reader :connection
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index 087e9b1cdd..397e3fa05f 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -83,7 +83,7 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
:timeout => 1200 }
if content_type == 'application/vnd.ms-word'
AlaveteliExternalCommand.run("wvText", tempfile.path, tempfile.path + ".txt",
- { :memory_limit => 536870912, :timeout => 120 } )
+ { :memory_limit => 536_870_912, :timeout => 120 } )
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
if not File.exist?(tempfile.path + ".txt")
AlaveteliExternalCommand.run("catdoc", tempfile.path, default_params)
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 658d59d0ca..4c3fe03944 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -19,7 +19,7 @@
it "should return 404 for pages we don't want to serve up" do
xap_results = double(ActsAsXapian::Search,
:results => (1..25).to_a.map { |m| { :model => m } },
- :matches_estimated => 1000000)
+ :matches_estimated => 1_000_000)
expect {
get :list, params: { :view => 'all', :page => 100 }
}.to raise_error(ActiveRecord::RecordNotFound)
diff --git a/spec/helpers/analytics_helper_spec.rb b/spec/helpers/analytics_helper_spec.rb
index e1d61ad577..4d7f00abd4 100644
--- a/spec/helpers/analytics_helper_spec.rb
+++ b/spec/helpers/analytics_helper_spec.rb
@@ -66,7 +66,7 @@
expect(track_analytics_event(
AnalyticsEvent::Category::OUTBOUND,
AnalyticsEvent::Action::FACEBOOK_EXIT,
- :value => 1234567
+ :value => 1_234_567
)).not_to include("1234567")
end
diff --git a/spec/helpers/currency_helper_spec.rb b/spec/helpers/currency_helper_spec.rb
index ebfea16715..a0e9dcd354 100644
--- a/spec/helpers/currency_helper_spec.rb
+++ b/spec/helpers/currency_helper_spec.rb
@@ -10,11 +10,11 @@
end
it 'formats the amount in the configured currency' do
- expect(format_currency(123456)).to eq('£1,234.56')
+ expect(format_currency(123_456)).to eq('£1,234.56')
allow(AlaveteliConfiguration).to receive(:iso_currency_code).
and_return('HRK')
- expect(format_currency(123456)).to eq('1.234,56 kn')
+ expect(format_currency(123_456)).to eq('1.234,56 kn')
end
it 'shows currency sub-units by default' do
@@ -23,13 +23,13 @@
context 'when asked to show the amount without trailing zeros' do
it 'does not show the trailing sub-unit amount when it is 00' do
- expect(format_currency(123400, no_cents_if_whole: true)).to eq('£1,234')
+ expect(format_currency(123_400, no_cents_if_whole: true)).to eq('£1,234')
end
it 'does not rely on the UK currency format' do
allow(AlaveteliConfiguration).to receive(:iso_currency_code).
and_return('EUR')
- expect(format_currency(123400, no_cents_if_whole: true)).to eq('€1.234')
+ expect(format_currency(123_400, no_cents_if_whole: true)).to eq('€1.234')
end
it 'still shows the sub-unit value if it is a non-zero amount' do
diff --git a/spec/lib/database_collation_spec.rb b/spec/lib/database_collation_spec.rb
index deac08baf0..5c84a21ba8 100644
--- a/spec/lib/database_collation_spec.rb
+++ b/spec/lib/database_collation_spec.rb
@@ -35,7 +35,7 @@
it 'does not support collation if the postgresql version is too old' do
database = DatabaseCollation.
- new(mock_connection(:postgresql_version => 90111))
+ new(mock_connection(:postgresql_version => 90111)) # rubocop:disable Style/NumericLiterals
expect(database.supports?('en_GB')).to be false
end
@@ -66,7 +66,7 @@
def mock_connection(connection_double_opts = {})
# Connection must be PostgreSQL 90112 or greater
default_double_opts = { :adapter_name => 'PostgreSQL',
- :postgresql_version => 90112 }
+ :postgresql_version => 90112 } # rubocop:disable Style/NumericLiterals
connection_double_opts = default_double_opts.merge(connection_double_opts)
diff --git a/spec/mailers/previews/alaveteli_pro/metrics_mailer_preview.rb b/spec/mailers/previews/alaveteli_pro/metrics_mailer_preview.rb
index e73933c7eb..4a2fca2c39 100644
--- a/spec/mailers/previews/alaveteli_pro/metrics_mailer_preview.rb
+++ b/spec/mailers/previews/alaveteli_pro/metrics_mailer_preview.rb
@@ -6,7 +6,7 @@ def weekly_report
data =
{
new_pro_requests: 104,
- estimated_total_pro_requests: 37535,
+ estimated_total_pro_requests: 37_535,
new_batches: 3,
new_signups: 5,
total_accounts: 284,
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 3e0e9983ef..d9104f94e1 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -1138,9 +1138,9 @@ def populate_raw_email(fixture)
incoming_message = FactoryBot.build(:incoming_message)
# This character is 2 bytes so the string should get sliced unless
# we are handling multibyte chars correctly
- multibyte_string = "å" * 500002
+ multibyte_string = "å" * 500_002
allow(incoming_message).to receive(:_get_attachment_text_internal).and_return(multibyte_string)
- expect(incoming_message.get_attachment_text_clipped.length).to eq(500002)
+ expect(incoming_message.get_attachment_text_clipped.length).to eq(500_002)
end
end
@@ -1152,7 +1152,7 @@ def populate_raw_email(fixture)
before do
@incoming_message = FactoryBot.create(:incoming_message)
allow(@incoming_message).to receive(:get_main_body_text_internal).
- and_return("x" * 1000010)
+ and_return("x" * 1_000_010)
end
it 'raises an exception' do
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index 2f3accff7c..f99559e7dc 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -1789,8 +1789,8 @@
end
context 'email with an id mistyped using letters and missing punctuation' do
- before { InfoRequest.where(id: 1231014).destroy_all }
- let!(:info_request) { FactoryBot.create(:info_request, id: 1231014) }
+ before { InfoRequest.where(id: 1_231_014).destroy_all }
+ let!(:info_request) { FactoryBot.create(:info_request, id: 1_231_014) }
let(:email) { 'request-123loL4abcdefgh@example.com' }
let(:guess) { described_class::Guess.new(info_request, email, :id) }
it { is_expected.to include(guess) }
@@ -3669,7 +3669,7 @@ def apply_filters(filters)
context "when the request is public" do
let(:request) do
- FactoryBot.create(:info_request_with_incoming, id: 123456,
+ FactoryBot.create(:info_request_with_incoming, id: 123_456,
title: "Test")
end
@@ -3682,7 +3682,7 @@ def apply_filters(filters)
context "when the request is hidden" do
let(:request) do
- FactoryBot.create(:info_request_with_incoming, id: 123456,
+ FactoryBot.create(:info_request_with_incoming, id: 123_456,
title: "Test",
prominence: "hidden")
end
@@ -3694,7 +3694,7 @@ def apply_filters(filters)
let(:request) do
FactoryBot.create(
:info_request_with_incoming,
- id: 123456,
+ id: 123_456,
title: "Test",
prominence: "requester_only"
)
diff --git a/spec/views/alaveteli_pro/subscriptions/_cancel_subscription.html.erb_spec.rb b/spec/views/alaveteli_pro/subscriptions/_cancel_subscription.html.erb_spec.rb
index 4334e5969d..6dfa8b0019 100644
--- a/spec/views/alaveteli_pro/subscriptions/_cancel_subscription.html.erb_spec.rb
+++ b/spec/views/alaveteli_pro/subscriptions/_cancel_subscription.html.erb_spec.rb
@@ -13,7 +13,7 @@ def render_view
let(:subscription) do
double(id: 'sub_BWb9jBSSO0nafs',
cancel_at_period_end: false,
- current_period_end: 1509882971)
+ current_period_end: 1_509_882_971)
end
it 'sets the section heading' do
@@ -47,7 +47,7 @@ def render_view
let(:subscription) do
double(id: 'sub_BWb9jBSSO0nafs',
cancel_at_period_end: true,
- current_period_end: 1509882971)
+ current_period_end: 1_509_882_971)
end
it 'sets the section heading' do
From 4321d61c29c480b91cb28ba55a51e594ffbc3f3b Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 12:47:54 +0000
Subject: [PATCH 070/289] Refactor: Parallel assignment linting
---
app/mailers/contact_mailer.rb | 13 ++++++++++---
app/mailers/info_request_batch_mailer.rb | 3 ++-
app/mailers/request_mailer.rb | 9 ++++++---
app/mailers/track_mailer.rb | 3 ++-
app/mailers/user_mailer.rb | 16 ++++++++++++----
lib/i18n_fixes.rb | 3 ++-
spec/models/public_body_spec.rb | 3 ++-
spec/models/user_spec.rb | 6 ++++--
spec/spec_helper.rb | 6 ++++--
9 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb
index 45936ad0d1..c84661a621 100644
--- a/app/mailers/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -9,7 +9,10 @@ class ContactMailer < ApplicationMailer
# Send message to administrator
def to_admin_message(name, email, subject, message, logged_in_user, last_request, last_body)
- @message, @logged_in_user, @last_request, @last_body = message, logged_in_user, last_request, last_body
+ @message = message
+ @logged_in_user = logged_in_user
+ @last_request = last_request
+ @last_body = last_body
reply_to_address = MailHandler.address_from_name_and_email(name, email)
set_reply_to_headers(nil, 'Reply-To' => reply_to_address)
@@ -22,7 +25,10 @@ def to_admin_message(name, email, subject, message, logged_in_user, last_request
# Send message to another user
def user_message(from_user, recipient_user, from_user_url, subject, message)
- @message, @from_user, @recipient_user, @from_user_url = message, from_user, recipient_user, from_user_url
+ @message = message
+ @from_user = from_user
+ @recipient_user = recipient_user
+ @from_user_url = from_user_url
set_reply_to_headers(nil, 'Reply-To' => from_user.name_and_email)
@@ -35,7 +41,8 @@ def user_message(from_user, recipient_user, from_user_url, subject, message)
# Send message to a user from the administrator
def from_admin_message(recipient_name, recipient_email, subject, message)
@message = message
- @recipient_name, @recipient_email = recipient_name, recipient_email
+ @recipient_name = recipient_name
+ @recipient_email = recipient_email
recipient_user = User.find_by_email(recipient_email)
diff --git a/app/mailers/info_request_batch_mailer.rb b/app/mailers/info_request_batch_mailer.rb
index ffc55ad7ed..4d7ed3475c 100644
--- a/app/mailers/info_request_batch_mailer.rb
+++ b/app/mailers/info_request_batch_mailer.rb
@@ -7,7 +7,8 @@
class InfoRequestBatchMailer < ApplicationMailer
def batch_sent(info_request_batch, unrequestable, user)
- @info_request_batch, @unrequestable = info_request_batch, unrequestable
+ @info_request_batch = info_request_batch
+ @unrequestable = unrequestable
@url = info_request_batch_url(@info_request_batch)
set_reply_to_headers(user)
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 3e88f50bb7..0bc77ab2ea 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -85,7 +85,8 @@ def requires_admin(info_request, set_by = nil, message = "")
# Tell the requester that a new response has arrived
def new_response(info_request, incoming_message)
- @incoming_message, @info_request = incoming_message, info_request
+ @incoming_message = incoming_message
+ @info_request = info_request
set_reply_to_headers(info_request.user)
set_auto_generated_headers
@@ -179,7 +180,8 @@ def not_clarified_alert(info_request, incoming_message)
# Tell requester that somebody add an annotation to their request
def comment_on_alert(info_request, comment)
- @comment, @info_request = comment, info_request
+ @comment = comment
+ @info_request = info_request
@url = comment_url(comment)
set_reply_to_headers(info_request.user)
@@ -194,7 +196,8 @@ def comment_on_alert(info_request, comment)
# Tell requester that somebody added annotations to more than one of
# their requests
def comment_on_alert_plural(info_request, count, earliest_unalerted_comment)
- @count, @info_request = count, info_request
+ @count = count
+ @info_request = info_request
@url = comment_url(earliest_unalerted_comment)
set_reply_to_headers(info_request.user)
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index af29c144b2..299feaa957 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -16,7 +16,8 @@ def contact_from_name_and_email
end
def event_digest(user, email_about_things)
- @user, @email_about_things = user, email_about_things
+ @user = user
+ @email_about_things = email_about_things
headers(
# http://tools.ietf.org/html/rfc3834
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index bc08e7171f..390a1d4ed2 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -6,21 +6,28 @@
class UserMailer < ApplicationMailer
def confirm_login(user, reasons, url)
- @reasons, @name, @url = reasons, user.name, url
+ @reasons = reasons
+ @name = user.name
+ @url = url
set_reply_to_headers(user)
mail_user(user, reasons[:email_subject])
end
def already_registered(user, reasons, url)
- @reasons, @name, @url = reasons, user.name, url
+ @reasons = reasons
+ @name = user.name
+ @url = url
set_reply_to_headers(user)
mail_user(user, reasons[:email_subject])
end
def changeemail_confirm(user, new_email, url)
- @name, @url, @old_email, @new_email = user.name, url, user.email, new_email
+ @name = user.name
+ @url = url
+ @old_email = user.email
+ @new_email = new_email
set_reply_to_headers(user)
mail(:from => contact_for_user(user),
@@ -29,7 +36,8 @@ def changeemail_confirm(user, new_email, url)
end
def changeemail_already_used(old_email, new_email)
- @old_email, @new_email = old_email, new_email
+ @old_email = old_email
+ @new_email = new_email
user = User.find_by_email(@old_email)
set_reply_to_headers(user)
diff --git a/lib/i18n_fixes.rb b/lib/i18n_fixes.rb
index be667a043f..838b52c0ec 100644
--- a/lib/i18n_fixes.rb
+++ b/lib/i18n_fixes.rb
@@ -28,7 +28,8 @@ def gettext_interpolate(string, values)
# $1, $2 don't work with SafeBuffer so casting to string as workaround
safe = string.html_safe?
string = string.to_str.gsub(MATCH) do
- pattern, key = $1, $1.to_sym
+ pattern = $1
+ key = $1.to_sym
if !values.include?(key)
raise I18n::MissingInterpolationArgument.new(pattern, string, values)
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index d6eb744368..af1d3b3e5c 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -756,7 +756,8 @@
it 'calls expire on all associated requests' do
public_body = FactoryBot.build(:public_body)
- request_1, request_2 = double(:info_request), double(:info_request)
+ request_1 = double(:info_request)
+ request_2 = double(:info_request)
allow(public_body).to receive_message_chain(:info_requests, :find_each).
and_yield(request_1).and_yield(request_2)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 68a7557ac3..bd31f5fdbc 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -792,7 +792,8 @@ def create_user(options = {})
it 'calls expire on all associated requests' do
user = FactoryBot.build(:user)
- request_1, request_2 = double(:info_request), double(:info_request)
+ request_1 = double(:info_request)
+ request_2 = double(:info_request)
allow(user).to receive_message_chain(:info_requests, :find_each).
and_yield(request_1).and_yield(request_2)
@@ -808,7 +809,8 @@ def create_user(options = {})
it 'calls reindex_request_events on all associated requests' do
user = FactoryBot.build(:user)
- comment_1, comment_2 = double(:comment), double(:comment)
+ comment_1 = double(:comment)
+ comment_2 = double(:comment)
allow(user).to receive_message_chain(:comments, :find_each).
and_yield(comment_1).and_yield(comment_2)
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 0b426f0d8d..ac559e9903 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -181,14 +181,16 @@ def xapian_before_create_job_hook(action, model, model_id)
end
def with_env_tz(new_tz = 'US/Eastern')
- old_tz, ENV['TZ'] = ENV['TZ'], new_tz
+ old_tz = ENV['TZ']
+ ENV['TZ'] = new_tz
yield
ensure
old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
end
def with_active_record_default_timezone(zone)
- old_zone, ActiveRecord::Base.default_timezone = ActiveRecord::Base.default_timezone, zone
+ old_zone = ActiveRecord::Base.default_timezone
+ ActiveRecord::Base.default_timezone = zone
yield
ensure
ActiveRecord::Base.default_timezone = old_zone
From 31815813509df06ecc51396237e3631924aee566 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 12:57:35 +0000
Subject: [PATCH 071/289] Add generated stubs to global exclude
---
.ruby-style.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 7b17e64b65..ee6ea7fde2 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -24,6 +24,8 @@ AllCops:
- node_modules/**/*
- vendor/**/*
- ".git/**/*"
+ - "bin/bundle"
+ - "bin/rubocop"
DisplayCopNames: false
StyleGuideCopsOnly: false
DisabledByDefault: true
From 5b29d9c91ecd82d8914f0254070cfe5d8d8f3362 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 12:59:28 +0000
Subject: [PATCH 072/289] Refactor: If modifier form
---
Vagrantfile | 4 +-
app/controllers/admin_comment_controller.rb | 12 +-
.../admin_public_body_controller.rb | 12 +-
app/controllers/admin_user_controller.rb | 4 +-
.../embargo_extensions_controller.rb | 8 +-
.../alaveteli_pro/embargoes_controller.rb | 4 +-
app/controllers/api_controller.rb | 12 +-
app/controllers/application_controller.rb | 8 +-
app/controllers/followups_controller.rb | 8 +-
app/controllers/general_controller.rb | 8 +-
.../info_request_batch_controller.rb | 4 +-
.../password_changes_controller.rb | 4 +-
app/controllers/public_body_controller.rb | 4 +-
app/controllers/request_controller.rb | 48 +++----
app/controllers/user_controller.rb | 12 +-
app/controllers/widgets_controller.rb | 4 +-
app/helpers/highlight_helper.rb | 8 +-
app/helpers/link_to_helper.rb | 4 +-
app/mailers/request_mailer.rb | 4 +-
app/mailers/track_mailer.rb | 12 +-
app/models/ability.rb | 8 +-
.../alaveteli_pro/draft_info_request_batch.rb | 4 +-
app/models/alaveteli_pro/embargo.rb | 8 +-
.../concerns/public_body_derived_fields.rb | 4 +-
app/models/foi_attachment.rb | 8 +-
app/models/holiday_import.rb | 4 +-
app/models/incoming_message.rb | 28 ++--
app/models/info_request.rb | 60 +++-----
app/models/info_request_event.rb | 48 ++-----
app/models/mail_server_log.rb | 4 +-
app/models/outgoing_message.rb | 8 +-
app/models/post_redirect.rb | 4 +-
app/models/profile_photo.rb | 12 +-
app/models/public_body.rb | 16 +--
.../category_collection.rb | 4 +-
app/models/public_body_change_request.rb | 8 +-
app/models/user.rb | 4 +-
config/boot.rb | 4 +-
config/initializers/theme_loader.rb | 4 +-
db/migrate/096_create_translation_tables.rb | 4 +-
...1107_create_category_translation_tables.rb | 8 +-
...0718261524_add_expiring_notification_at.rb | 4 +-
...8_add_stripe_customer_id_to_pro_account.rb | 4 +-
lib/acts_as_xapian/acts_as_xapian.rb | 136 +++++++++++-------
lib/acts_as_xapian/tasks/xapian.rake | 8 +-
lib/alaveteli_external_command.rb | 4 +-
lib/alaveteli_file_types.rb | 20 +--
lib/alaveteli_mail_poller.rb | 8 +-
lib/attachment_to_html.rb | 4 +-
lib/attachment_to_html/adapters/rtf.rb | 4 +-
lib/confidence_intervals.rb | 4 +-
lib/mail_handler.rb | 8 +-
lib/mail_handler/backends/mail_backend.rb | 20 +--
lib/mail_handler/reply_handler.rb | 28 +---
lib/memory_profiler.rb | 4 +-
lib/routing_filters.rb | 17 ++-
lib/tasks/cleanup.rake | 8 +-
lib/tasks/config_files.rake | 4 +-
lib/tasks/geoip.rake | 4 +-
lib/tasks/gettext.rake | 4 +-
lib/tasks/import.rake | 4 +-
lib/tasks/themes.rake | 12 +-
lib/tasks/usage.rb | 8 +-
lib/tasks/users.rake | 4 +-
lib/typeahead_search.rb | 4 +-
lib/xapian_queries.rb | 8 +-
script/handle-mail-replies.rb | 4 +-
spec/models/info_request_spec.rb | 4 +-
spec/spec_helper.rb | 16 +--
69 files changed, 316 insertions(+), 477 deletions(-)
diff --git a/Vagrantfile b/Vagrantfile
index 401d8ec794..f08833608d 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -159,9 +159,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_url = os[:box_url]
config.vm.hostname = "alaveteli-#{ SETTINGS['os'] }"
- if SETTINGS['public_network']
- config.vm.network :public_network
- end
+ config.vm.network :public_network if SETTINGS['public_network']
config.vm.network :private_network, ip: SETTINGS['ip']
diff --git a/app/controllers/admin_comment_controller.rb b/app/controllers/admin_comment_controller.rb
index 50792aff40..333bfc99b3 100644
--- a/app/controllers/admin_comment_controller.rb
+++ b/app/controllers/admin_comment_controller.rb
@@ -19,23 +19,17 @@ def index
Comment.order(created_at: :desc)
end
- if cannot? :admin, AlaveteliPro::Embargo
- comments = comments.not_embargoed
- end
+ comments = comments.not_embargoed if cannot? :admin, AlaveteliPro::Embargo
@comments = comments.paginate :page => params[:page], :per_page => 100
end
def edit
- if cannot? :admin, @comment
- raise ActiveRecord::RecordNotFound
- end
+ raise ActiveRecord::RecordNotFound if cannot? :admin, @comment
end
def update
- if cannot? :admin, @comment
- raise ActiveRecord::RecordNotFound
- end
+ raise ActiveRecord::RecordNotFound if cannot? :admin, @comment
old_body = @comment.body.dup
old_visible = @comment.visible
old_attention = @comment.attention_requested
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 1dbaf53ac0..b18da4ff23 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -190,9 +190,7 @@ def import_csv
admin_current_user,
AlaveteliLocalization.
available_locales)
- if errors.size != 0
- raise "dry run mismatched real run"
- end
+ raise "dry run mismatched real run" if errors.size != 0
notes.push("Import was successful.")
end
end
@@ -234,13 +232,9 @@ def lookup_query
@locale = AlaveteliLocalization.locale
AlaveteliLocalization.with_locale(@locale) do
@query = params[:query]
- if @query == ""
- @query = nil
- end
+ @query = nil if @query == ""
@page = params[:page]
- if @page == ""
- @page = nil
- end
+ @page = nil if @page == ""
query = if @query
query_str = <<-EOF.strip_heredoc
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
index 5d6df278ab..ac7271496a 100644
--- a/app/controllers/admin_user_controller.rb
+++ b/app/controllers/admin_user_controller.rb
@@ -111,9 +111,7 @@ def clear_bounce
end
def clear_profile_photo
- if @admin_user.profile_photo
- @admin_user.profile_photo.destroy
- end
+ @admin_user.profile_photo.destroy if @admin_user.profile_photo
flash[:notice] = "Profile photo cleared"
redirect_to admin_user_url(@admin_user)
diff --git a/app/controllers/alaveteli_pro/embargo_extensions_controller.rb b/app/controllers/alaveteli_pro/embargo_extensions_controller.rb
index 0771c3d265..d00ad8c16a 100644
--- a/app/controllers/alaveteli_pro/embargo_extensions_controller.rb
+++ b/app/controllers/alaveteli_pro/embargo_extensions_controller.rb
@@ -13,13 +13,9 @@ def create
@info_request = @embargo.info_request
# Embargoes cannot be updated individually on batch requests
- if @info_request.info_request_batch_id
- raise PermissionDenied
- end
+ raise PermissionDenied if @info_request.info_request_batch_id
- unless @embargo.expiring_soon?
- raise PermissionDenied
- end
+ raise PermissionDenied unless @embargo.expiring_soon?
@embargo_extension =
AlaveteliPro::EmbargoExtension.new(embargo_extension_params)
diff --git a/app/controllers/alaveteli_pro/embargoes_controller.rb b/app/controllers/alaveteli_pro/embargoes_controller.rb
index 1855b50fe2..b20e92bff6 100644
--- a/app/controllers/alaveteli_pro/embargoes_controller.rb
+++ b/app/controllers/alaveteli_pro/embargoes_controller.rb
@@ -36,9 +36,7 @@ def destroy
authorize! :destroy, @embargo
@info_request = @embargo.info_request
# Embargoes cannot be updated individually on batch requests
- if @info_request.info_request_batch_id
- raise PermissionDenied
- end
+ raise PermissionDenied if @info_request.info_request_batch_id
if @embargo.destroy
@info_request.log_event('expire_embargo', {})
flash[:notice] = _("Your request is now public!")
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 2b1c7f8aca..1b85464b1c 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -196,7 +196,9 @@ def update_state
def body_request_events
feed_type = params[:feed_type]
- raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}") if @public_body.id != params[:id].to_i
+ if @public_body.id != params[:id].to_i
+ raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}")
+ end
since_date_str = params[:since_date]
since_event_id = params[:since_event_id]
@@ -256,9 +258,7 @@ def body_request_events
:body => event.outgoing_message.body,
:user_name => request.user_name,
}
- if request.user
- this_event[:user_url] = user_url(request.user)
- end
+ this_event[:user_url] = user_url(request.user) if request.user
@event_data.push(this_event)
end
@@ -270,7 +270,9 @@ def body_request_events
protected
def check_api_key
- raise PermissionDenied.new("Missing required parameter 'k'") if params[:k].nil?
+ if params[:k].nil?
+ raise PermissionDenied.new("Missing required parameter 'k'")
+ end
@public_body = PublicBody.find_by_api_key(params[:k].gsub(' ', '+'))
raise PermissionDenied if @public_body.nil?
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a789da1ded..1dd8e05821 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -172,9 +172,7 @@ def clear_session_credentials
def render_exception(exception)
# In development let Rails handle the exception with its stack trace
# templates.
- if Rails.application.config.consider_all_requests_local
- raise exception
- end
+ raise exception if Rails.application.config.consider_all_requests_local
@exception_backtrace = exception.backtrace.join("\n")
@exception_class = exception.class.to_s
@@ -473,7 +471,9 @@ def user_ip
#
# Returns a Hash
def sanitize_path(params)
- params.merge!(:path => Rack::Utils.escape(params[:path])) if params.key?(:path)
+ if params.key?(:path)
+ params.merge!(:path => Rack::Utils.escape(params[:path]))
+ end
end
# Collect the current and available locales for the locale switcher
diff --git a/app/controllers/followups_controller.rb b/app/controllers/followups_controller.rb
index f558eb7fc0..463db9601d 100644
--- a/app/controllers/followups_controller.rb
+++ b/app/controllers/followups_controller.rb
@@ -33,9 +33,7 @@ def create
def preview
@outgoing_message.info_request = @info_request
- if @outgoing_message.what_doing == 'internal_review'
- @internal_review = true
- end
+ @internal_review = true if @outgoing_message.what_doing == 'internal_review'
unless @outgoing_message.valid?
render :action => 'new'
return
@@ -54,9 +52,7 @@ def check_can_followup
def set_internal_review
@internal_review = false
- if params[:internal_review]
- @internal_review = true
- end
+ @internal_review = true if params[:internal_review]
end
def check_reedit
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index dfa30f67ea..c06a8229c8 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -101,9 +101,7 @@ def search
@sort_postfix = combined.pop
@sortby = @sort_postfix
end
- if !params[:view].nil?
- combined += [params[:view]]
- end
+ combined += [params[:view]] if !params[:view].nil?
if combined.size > 0 && (['bodies', 'requests', 'users', 'all'].include?(combined[-1]))
@variety_postfix = combined.pop
case @variety_postfix
@@ -124,9 +122,7 @@ def search
end
end
@query = combined.join("/")
- if params[:query].nil?
- params[:query] = @query
- end
+ params[:query] = @query if params[:query].nil?
if @variety_postfix != "all" && @requests
@query = InfoRequestEvent.make_query_from_params(params)
end
diff --git a/app/controllers/info_request_batch_controller.rb b/app/controllers/info_request_batch_controller.rb
index e68396fe55..c06aee89a9 100644
--- a/app/controllers/info_request_batch_controller.rb
+++ b/app/controllers/info_request_batch_controller.rb
@@ -20,9 +20,7 @@ def show
def load_and_authorise_resource
@info_request_batch = InfoRequestBatch.find(params[:id])
- if cannot?(:read, @info_request_batch)
- raise ActiveRecord::RecordNotFound
- end
+ raise ActiveRecord::RecordNotFound if cannot?(:read, @info_request_batch)
end
def redirect_embargoed_requests_for_pro_users
diff --git a/app/controllers/password_changes_controller.rb b/app/controllers/password_changes_controller.rb
index 1e3f1b3e6a..7bf4e8972a 100644
--- a/app/controllers/password_changes_controller.rb
+++ b/app/controllers/password_changes_controller.rb
@@ -69,9 +69,7 @@ def edit
end
def update
- if @pretoken
- @pretoken_redirect = PostRedirect.find_by(:token => @pretoken)
- end
+ @pretoken_redirect = PostRedirect.find_by(:token => @pretoken) if @pretoken
if @password_change_user
@password_change_user.password = params[:password_change_user][:password]
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index c51a55aa68..754a0561c7 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -77,9 +77,7 @@ def show
@track_thing = TrackThing.create_track_for_public_body(@public_body)
- if @user
- @existing_track = TrackThing.find_existing(@user, @track_thing)
- end
+ @existing_track = TrackThing.find_existing(@user, @track_thing) if @user
@follower_count = TrackThing.where(:public_body_id => @public_body.id).count
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index a7808eec1f..82de89a3cc 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -49,9 +49,7 @@ def show
medium_cache
AlaveteliLocalization.with_locale(locale) do
# Test for whole request being hidden
- if cannot?(:read, @info_request)
- return render_hidden
- end
+ return render_hidden if cannot?(:read, @info_request)
# Always show the pro livery if a request is embargoed. This makes it
# clear to admins and ex-pro users that the `InfoRequest` is still
@@ -107,9 +105,7 @@ def show
def details
long_cache
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
- if cannot?(:read, @info_request)
- return render_hidden
- end
+ return render_hidden if cannot?(:read, @info_request)
@columns = ['id',
'event_type',
'created_at',
@@ -130,9 +126,7 @@ def similar
end
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
- if cannot?(:read, @info_request)
- return render_hidden
- end
+ return render_hidden if cannot?(:read, @info_request)
@xapian_object = ActsAsXapian::Similar.new([InfoRequestEvent],
@info_request.info_request_events,
:offset => (@page - 1) * @per_page,
@@ -145,7 +139,9 @@ def similar
def list
medium_cache
@view = params[:view]
- @page = get_search_page_from_params if !@page # used in cache case, as perform_search sets @page as side effect
+ if !@page # used in cache case, as perform_search sets @page as side effect
+ @page = get_search_page_from_params
+ end
@per_page = PER_PAGE
@max_results = MAX_RESULTS
if @view == "recent"
@@ -169,9 +165,7 @@ def list
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
# Don't let robots go more than 20 pages in
- if @page > 20
- @no_crawl = true
- end
+ @no_crawl = true if @page > 20
end
# Page new form posts to
@@ -258,9 +252,7 @@ def new
end
# Show preview page, if it is a preview
- if params[:preview].to_i == 1
- return render_new_preview
- end
+ return render_new_preview if params[:preview].to_i == 1
if user_exceeded_limit
render :template => 'user/rate_limited'
@@ -443,9 +435,7 @@ def download_entire_request
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
# Check for access and hide emargoed requests immediately, so that we
# don't leak any info to people who can't access them
- if @info_request.embargo && cannot?(:read, @info_request)
- render_hidden
- end
+ render_hidden if @info_request.embargo && cannot?(:read, @info_request)
if !authenticated?
ask_to_login(
web: _('To download the zip file'),
@@ -458,9 +448,7 @@ def download_entire_request
)
else
# Test for whole request being hidden or requester-only
- if cannot?(:read, @info_request)
- return render_hidden
- end
+ return render_hidden if cannot?(:read, @info_request)
cache_file_path = @info_request.make_zip_cache_path(@user)
if !File.exist?(cache_file_path)
FileUtils.mkdir_p(File.dirname(cache_file_path))
@@ -625,7 +613,9 @@ def render_new_compose
PublicBody.find(params[:url_name]).id
else
public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
- raise ActiveRecord::RecordNotFound.new("None found") if public_body.nil? # TODO: proper 404
+ if public_body.nil? # TODO: proper 404
+ raise ActiveRecord::RecordNotFound.new("None found")
+ end
public_body.id
end
elsif params[:public_body_id]
@@ -657,7 +647,9 @@ def render_new_compose
end
message_params[:outgoing_message][:body] ||= params[:body] if params[:body]
- message_params[:outgoing_message][:default_letter] ||= params[:default_letter] if params[:default_letter]
+ if params[:default_letter]
+ message_params[:outgoing_message][:default_letter] ||= params[:default_letter]
+ end
message_params = ActionController::Parameters.new(message_params)
permitted = message_params.
@@ -717,9 +709,7 @@ def redirect_numeric_id_to_url_title
@info_request = InfoRequest.find(params[:url_title].to_i)
# We don't want to leak the title of embargoed or hidden requests, so
# don't even redirect on if the user can't access the request
- if cannot?(:read, @info_request)
- return render_hidden
- end
+ return render_hidden if cannot?(:read, @info_request)
redirect_to request_url(@info_request, :format => params[:format])
end
end
@@ -742,9 +732,7 @@ def redirect_public_requests_from_pro_context
# page, so that pro's seem them in that context after they publish them
if feature_enabled?(:alaveteli_pro) && params[:pro] == "1"
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
- unless @info_request.embargo
- redirect_to request_url(@info_request)
- end
+ redirect_to request_url(@info_request) unless @info_request.embargo
end
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index a78de197f7..9b3101c4cd 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -94,8 +94,12 @@ def wall
@xapian_comments = nil
end
- feed_results += @xapian_requests.results.map { |x| x[:model] } if @xapian_requests
- feed_results += @xapian_comments.results.map { |x| x[:model] } if @xapian_comments
+ if @xapian_requests
+ feed_results += @xapian_requests.results.map { |x| x[:model] }
+ end
+ if @xapian_comments
+ feed_results += @xapian_comments.results.map { |x| x[:model] }
+ end
# All tracks for the user
if @is_you
@@ -360,9 +364,7 @@ def clear_profile_photo
return
end
- if @user.profile_photo
- @user.profile_photo.destroy
- end
+ @user.profile_photo.destroy if @user.profile_photo
flash[:notice] = _("You've now cleared your profile photo")
redirect_to user_url(@user)
diff --git a/app/controllers/widgets_controller.rb b/app/controllers/widgets_controller.rb
index 0ecf035e5d..a7c4cc700d 100644
--- a/app/controllers/widgets_controller.rb
+++ b/app/controllers/widgets_controller.rb
@@ -17,9 +17,7 @@ def show
@user_owns_request = @info_request.user && @info_request.user == @user
@existing_track =
- if @user
- TrackThing.find_existing(@user, @track_thing)
- end
+ (TrackThing.find_existing(@user, @track_thing) if @user)
@existing_vote =
unless @existing_track
diff --git a/app/helpers/highlight_helper.rb b/app/helpers/highlight_helper.rb
index fbaabbbb2a..da0ed3539b 100644
--- a/app/helpers/highlight_helper.rb
+++ b/app/helpers/highlight_helper.rb
@@ -5,7 +5,9 @@ module HighlightHelper
# the phrases parameter.
# https://github.com/rails/rails/pull/11793
def highlight_matches(text, phrases, options = {})
- text = ActionController::Base.helpers.sanitize(text).try(:html_safe) if options.fetch(:sanitize, true)
+ if options.fetch(:sanitize, true)
+ text = ActionController::Base.helpers.sanitize(text).try(:html_safe)
+ end
if text.blank? || phrases.blank?
text
@@ -34,9 +36,7 @@ def highlight_words(t, words, html = true)
def highlight_and_excerpt(t, words, excount, html = true)
newt = excerpt(t, words[0], :radius => excount)
- if not newt
- newt = excerpt(t, '', :radius => excount)
- end
+ newt = excerpt(t, '', :radius => excount) if not newt
t = newt
t = highlight_words(t, words, html)
return t
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 4c1c1cb08b..64ac95ad70 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -240,9 +240,7 @@ def search_url(query, options = nil)
:action => 'search',
:combined => query,
:view => nil}
- if !options.nil?
- routing_info = options.merge(routing_info)
- end
+ routing_info = options.merge(routing_info) if !options.nil?
if routing_info.kind_of?(Hash)
routing_info = ActionController::Parameters.new(routing_info)
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 0bc77ab2ea..d995eb6b93 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -250,9 +250,7 @@ def receive(email, raw_email, source = :mailin)
_("Could not identify the request from the email address")
request = InfoRequest.holding_pen_request
- unless SpamAddress.spam?(email.to)
- request.receive(email, raw_email, opts)
- end
+ request.receive(email, raw_email, opts) unless SpamAddress.spam?(email.to)
return
end
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index 299feaa957..37f682dedd 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -85,9 +85,15 @@ def self.alert_tracks
raise "need to add other types to TrackMailer.alert_tracks (unalerted)"
end
- next if track_thing.created_at >= result[:model].described_at # made before the track was created
- next if result[:model].described_at < one_week_ago # older than 1 week (see 14 days / 7 days in comment above)
- next if done_info_request_events.include?(result[:model].id) # definitely already done
+ if track_thing.created_at >= result[:model].described_at # made before the track was created
+ next
+ end
+ if result[:model].described_at < one_week_ago # older than 1 week (see 14 days / 7 days in comment above)
+ next
+ end
+ if done_info_request_events.include?(result[:model].id) # definitely already done
+ next
+ end
# OK alert this one
alert_results.push(result)
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 0f3f18bd7e..7ef1689933 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -208,13 +208,9 @@ def initialize(user, project: nil, public_token: false)
end
if feature_enabled? :alaveteli_pro
- if user && user.is_pro_admin?
- can :read, :api_key
- end
+ can :read, :api_key if user && user.is_pro_admin?
else
- if user && user.is_admin?
- can :read, :api_key
- end
+ can :read, :api_key if user && user.is_admin?
end
if feature_enabled? :projects
diff --git a/app/models/alaveteli_pro/draft_info_request_batch.rb b/app/models/alaveteli_pro/draft_info_request_batch.rb
index 2943fc7819..9c14e28e25 100644
--- a/app/models/alaveteli_pro/draft_info_request_batch.rb
+++ b/app/models/alaveteli_pro/draft_info_request_batch.rb
@@ -37,9 +37,7 @@ def set_default_body
template_options = {}
template_options[:info_request_title] = title if title
self.body = template.body(template_options)
- if self.user
- self.body += self.user.name
- end
+ self.body += self.user.name if self.user
end
end
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index 2bad2bc23b..e40124e470 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -131,9 +131,7 @@ def self.log_expiring_events
{ event_created_at: Time.zone.now },
created_at: embargo.expiring_notification_at
)
- if info_request.use_notifications?
- info_request.user.notify(event)
- end
+ info_request.user.notify(event) if info_request.use_notifications?
end
end
@@ -144,9 +142,7 @@ def add_set_embargo_event
yield
if publish_at_changed
params = { :embargo_id => self.id }
- if extension
- params[:embargo_extension_id] = extension.id
- end
+ params[:embargo_extension_id] = extension.id if extension
info_request.log_event('set_embargo', params)
end
end
diff --git a/app/models/concerns/public_body_derived_fields.rb b/app/models/concerns/public_body_derived_fields.rb
index 0566c0da62..a24bc147aa 100644
--- a/app/models/concerns/public_body_derived_fields.rb
+++ b/app/models/concerns/public_body_derived_fields.rb
@@ -32,9 +32,7 @@ def set_first_letter
unless name.blank?
# we use a regex to ensure it works with utf-8/multi-byte
new_first_letter = name.scan(/^./mu)[0]&.upcase
- if new_first_letter != first_letter
- self.first_letter = new_first_letter
- end
+ self.first_letter = new_first_letter if new_first_letter != first_letter
end
end
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index aa8edfaa7e..d9586628e7 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -158,9 +158,7 @@ def extra_note
# For delivery status notification attachments, extract the status and
# look up what it means in the DSN table.
if @content_type == 'message/delivery-status'
- if !@body.match(/Status:\s+([0-9]+\.([0-9]+\.[0-9]+))\s+/)
- return ""
- end
+ return "" if !@body.match(/Status:\s+([0-9]+\.([0-9]+\.[0-9]+))\s+/)
dsn = $1
dsn_part = 'X.' + $2
@@ -214,9 +212,7 @@ def display_filename
def ensure_filename!
if self.filename.blank?
calc_ext = AlaveteliFileTypes.mimetype_to_extension(self.content_type)
- if !calc_ext
- calc_ext = "bin"
- end
+ calc_ext = "bin" if !calc_ext
if !self.within_rfc822_subject.nil?
computed = self.within_rfc822_subject + "." + calc_ext
else
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index 3e2d739f66..d7e5a8d14e 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -60,7 +60,9 @@ def holidays
private
def all_holidays_valid
- errors.add(:base, 'These holidays could not be imported') unless holidays.all?(&:valid?)
+ unless holidays.all?(&:valid?)
+ errors.add(:base, 'These holidays could not be imported')
+ end
end
def populate_from_ical_feed
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 1287273ceb..dd6b19fb81 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -95,9 +95,7 @@ def parse_raw_email!(force = nil)
# The following fields may be absent; we treat them as cached
# values in case we want to regenerate them (due to mail
# parsing bugs, etc).
- if self.raw_email.nil?
- raise "Incoming message id=#{id} has no raw_email"
- end
+ raise "Incoming message id=#{id} has no raw_email" if self.raw_email.nil?
if (!force.nil? || self.last_parsed.nil?)
ActiveRecord::Base.transaction do
extract_attachments
@@ -363,15 +361,11 @@ def _cache_main_body_text
# (marked with FOLDED_QUOTED_SECTION)
# TODO: returns a .dup of the text, so calling functions can in place modify it
def get_main_body_text_folded
- if self.cached_main_body_text_folded.nil?
- self._cache_main_body_text
- end
+ self._cache_main_body_text if self.cached_main_body_text_folded.nil?
return self.cached_main_body_text_folded
end
def get_main_body_text_unfolded
- if self.cached_main_body_text_unfolded.nil?
- self._cache_main_body_text
- end
+ self._cache_main_body_text if self.cached_main_body_text_unfolded.nil?
return self.cached_main_body_text_unfolded
end
# Returns body text from main text part of email, converted to UTF-8
@@ -432,9 +426,7 @@ def get_main_body_text_part(leaves=[])
# Otherwise first part which is any sort of text
leaves.each do |p|
- if p.content_type.match(/^text/)
- return p
- end
+ return p if p.content_type.match(/^text/)
end
# ... or if none, consider first part
@@ -540,9 +532,7 @@ def get_body_for_html_display(collapse_quoted_sections = true)
# links, without escaping them. Rather than using some proper parser
# making a tree structure (I don't know of one that is to hand, that
# works well in this kind of situation, such as with regexps).
- if collapse_quoted_sections
- text = folded_quoted_text
- end
+ text = folded_quoted_text if collapse_quoted_sections
text = MySociety::Format.simplify_angle_bracketed_urls(text)
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text, :contract => 1)
@@ -651,7 +641,9 @@ def recently_arrived
def self.find_all_unknown_mime_types
IncomingMessage.find_each do |incoming_message|
for attachment in incoming_message.get_attachments_for_display
- raise "internal error incoming_message " + incoming_message.id.to_s if attachment.content_type.nil?
+ if attachment.content_type.nil?
+ raise "internal error incoming_message " + incoming_message.id.to_s
+ end
if AlaveteliFileTypes.mimetype_to_extension(attachment.content_type).nil?
$stderr.puts "Unknown type for /request/" + incoming_message.info_request.id.to_s + "#incoming-"+incoming_message.id.to_s
$stderr.puts " " + attachment.filename.to_s + " " + attachment.content_type.to_s
@@ -668,7 +660,9 @@ def get_present_file_extensions
ret = {}
for attachment in self.get_attachments_for_display
ext = AlaveteliFileTypes.mimetype_to_extension(attachment.content_type)
- ext = File.extname(attachment.filename).gsub(/^[.]/, "") if ext.nil? && !attachment.filename.nil?
+ if ext.nil? && !attachment.filename.nil?
+ ext = File.extname(attachment.filename).gsub(/^[.]/, "")
+ end
ret[ext] = 1 if !ext.nil?
end
return ret.keys.join(" ")
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index d54b029f82..4f2f9b7e59 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -242,9 +242,7 @@ def self.custom_states_loaded
def self.guess_by_incoming_email(*emails)
guesses = emails.flatten.reduce([]) do |memo, email|
id, idhash = _extract_id_hash_from_email(email)
- if idhash.nil? || id.nil?
- id, idhash = _guess_idhash_from_email(email)
- end
+ id, idhash = _guess_idhash_from_email(email) if idhash.nil? || id.nil?
memo << Guess.new(find_by_id(id), email, :id)
memo << Guess.new(find_by_idhash(idhash), email, :idhash)
end
@@ -265,9 +263,7 @@ def self._guess_idhash_from_email(incoming_email)
# try to grab the last 8 chars of the local part of the address instead
local_part = incoming_email[0..incoming_email.index('@')-1]
id_hash =
- if local_part.length >= 8
- _clean_idhash(local_part[-8..-1])
- end
+ (_clean_idhash(local_part[-8..-1]) if local_part.length >= 8)
end
[id, id_hash]
@@ -481,7 +477,9 @@ def self.hash_from_id(id)
# Used to find when event last changed
def self.last_event_time_clause(event_type=nil, join_table=nil, join_clause=nil)
event_type_clause = ''
- event_type_clause = " AND info_request_events.event_type = '#{event_type}'" if event_type
+ if event_type
+ event_type_clause = " AND info_request_events.event_type = '#{event_type}'"
+ end
tables = ['info_request_events']
tables << join_table if join_table
join_clause = "AND #{join_clause}" if join_clause
@@ -681,9 +679,7 @@ def self.log_overdue_event_type(event_type)
{ event_created_at: Time.zone.now },
created_at: created_at
)
- if info_request.use_notifications?
- info_request.user.notify(event)
- end
+ info_request.user.notify(event) if info_request.use_notifications?
end
end
@@ -739,8 +735,12 @@ def must_be_internal_or_external
# We must permit user_id and external_user_name both to be nil, because the system
# allows a request to be created by a non-logged-in user.
if user_id
- errors.add(:external_user_name, "must be null for an internal request") unless external_user_name.nil?
- errors.add(:external_url, "must be null for an internal request") unless external_url.nil?
+ unless external_user_name.nil?
+ errors.add(:external_user_name, "must be null for an internal request")
+ end
+ unless external_url.nil?
+ errors.add(:external_url, "must be null for an internal request")
+ end
end
end
@@ -826,9 +826,7 @@ def update_last_public_response_at
# Needed for legacy reasons, even though we call strip_attributes now
def title
_title = read_attribute(:title)
- if _title
- _title.strip!
- end
+ _title.strip! if _title
_title
end
@@ -877,14 +875,10 @@ def find_existing_outgoing_message(body)
# Has this email already been received here? Based just on message id.
def already_received?(email, raw_email_data)
message_id = email.message_id
- if message_id.nil?
- raise "No message id for this message"
- end
+ raise "No message id for this message" if message_id.nil?
for im in incoming_messages
- if message_id == im.message_id
- return true
- end
+ return true if message_id == im.message_id
end
false
@@ -1051,9 +1045,7 @@ def calculate_event_states
for event in info_request_events.reverse
event.xapian_mark_needs_index # we need to reindex all events in order to update their latest_* terms
if curr_state.nil?
- if event.described_state
- curr_state = event.described_state
- end
+ curr_state = event.described_state if event.described_state
end
if curr_state && event.event_type == 'response'
@@ -1264,7 +1256,9 @@ def get_last_public_response_event
end
def get_last_public_response
- get_last_public_response_event.incoming_message if get_last_public_response_event
+ if get_last_public_response_event
+ get_last_public_response_event.incoming_message
+ end
end
def public_outgoing_events
@@ -1316,9 +1310,7 @@ def get_previous_email_sent_to(info_request_event)
last_email = nil
for e in info_request_events
if ((info_request_event.is_sent_sort? && e.is_sent_sort?) || (info_request_event.is_followup_sort? && e.is_followup_sort?)) && e.outgoing_message_id == info_request_event.outgoing_message_id
- if e.id == info_request_event.id
- break
- end
+ break if e.id == info_request_event.id
last_email = e.params[:email]
end
end
@@ -1449,9 +1441,7 @@ def who_can_followup_to(skip_message = nil)
end
end
for incoming_message in incoming_messages.reverse
- if incoming_message == skip_message
- next
- end
+ next if incoming_message == skip_message
incoming_message.safe_from_name
next if ! incoming_message.is_public?
@@ -1476,9 +1466,7 @@ def who_can_followup_to(skip_message = nil)
# Get the list of censor rules that apply to this request
def applicable_censor_rules
applicable_rules = [censor_rules, CensorRule.global]
- unless public_body.blank?
- applicable_rules << public_body.censor_rules
- end
+ applicable_rules << public_body.censor_rules unless public_body.blank?
applicable_rules << user.censor_rules if user
applicable_rules.flatten
end
@@ -1863,9 +1851,7 @@ def index_of_last_described_event
def set_defaults
begin
- if described_state.nil?
- self.described_state = 'waiting_response'
- end
+ self.described_state = 'waiting_response' if described_state.nil?
rescue ActiveModel::MissingAttributeError
# this should only happen on Model.exists? call. It can be safely ignored.
# See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index bbfa169034..73fcad12ef 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -160,17 +160,13 @@ def request
def latest_variety
sibling_events(:reverse => true).each do |event|
- unless event.variety.blank?
- return event.variety
- end
+ return event.variety unless event.variety.blank?
end
end
def latest_status
sibling_events(:reverse => true).each do |event|
- unless event.calculated_state.blank?
- return event.calculated_state
- end
+ return event.calculated_state unless event.calculated_state.blank?
end
end
@@ -206,9 +202,7 @@ def incoming_message_selective_columns(fields)
where('info_request_events.id = ?', id)
message = message[0]
- if message
- message.info_request = InfoRequest.find(message.info_request_id)
- end
+ message.info_request = InfoRequest.find(message.info_request_id) if message
message
end
@@ -285,18 +279,14 @@ def request_public_body_tags
def indexed_by_search?
if ['sent', 'followup_sent', 'response', 'comment'].include?(event_type)
- if !info_request.indexed_by_search?
- return false
- end
+ return false if !info_request.indexed_by_search?
if event_type == 'response' && !incoming_message.indexed_by_search?
return false
end
if ['sent', 'followup_sent'].include?(event_type) && !outgoing_message.indexed_by_search?
return false
end
- if event_type == 'comment' && !comment.visible
- return false
- end
+ return false if event_type == 'comment' && !comment.visible
return true
end
false
@@ -325,9 +315,7 @@ def params=(new_params)
if params[:outgoing_message]
self.outgoing_message = params[:outgoing_message]
end
- if params[:comment]
- self.comment = params[:comment]
- end
+ self.comment = params[:comment] if params[:comment]
end
# A hash to lazy load Global ID reference models
@@ -402,9 +390,7 @@ def is_clarification?
waiting_clarification = true
break
end
- if event.event_type == 'followup_sent'
- break
- end
+ break if event.event_type == 'followup_sent'
end
waiting_clarification && event_type == 'followup_sent'
end
@@ -413,9 +399,7 @@ def is_clarification?
# on the request and resets them if so
def recheck_due_dates
subsequent_events.each do |event|
- if event.resets_due_dates?
- info_request.set_due_dates(event)
- end
+ info_request.set_due_dates(event) if event.resets_due_dates?
end
end
@@ -429,12 +413,8 @@ def display_status
if is_outgoing_message?
status = calculated_state
if status
- if status == 'internal_review'
- return _("Internal review request")
- end
- if status == 'waiting_response'
- return _("Clarification")
- end
+ return _("Internal review request") if status == 'internal_review'
+ return _("Clarification") if status == 'waiting_response'
raise _("unknown status {{status}}", :status => status)
end
# TRANSLATORS: "Follow up" in this context means a further
@@ -479,12 +459,8 @@ def update_request
def same_email_as_previous_send?
prev_addr = info_request.get_previous_email_sent_to(self)
curr_addr = params[:email]
- if prev_addr.nil? && curr_addr.nil?
- return true
- end
- if prev_addr.nil? || curr_addr.nil?
- return false
- end
+ return true if prev_addr.nil? && curr_addr.nil?
+ return false if prev_addr.nil? || curr_addr.nil?
MailHandler.address_from_string(prev_addr) == MailHandler.address_from_string(curr_addr)
end
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 580b7b6915..74b2c0e83f 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -40,7 +40,9 @@ def self.load_file(file_name)
file_name_db = is_gz ? file_name.gsub(".gz", "") : file_name
modified = File.stat(file_name).mtime
- raise "MailServerLog.load_file: file not found " + file_name if modified.nil?
+ if modified.nil?
+ raise "MailServerLog.load_file: file not found " + file_name
+ end
ActiveRecord::Base.transaction do
# see if we already have it
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 9bae5237e5..6f42118031 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -127,9 +127,7 @@ def get_default_message
def set_signature_name(name)
# We compare against raw_body as body strips linebreaks and applies
# censor rules
- if raw_body == get_default_message
- self.body = get_default_message + name
- end
+ self.body = get_default_message + name if raw_body == get_default_message
end
# Public: The value to be used in the From: header of an OutgoingMailer
@@ -237,7 +235,9 @@ def record_email_delivery(to_addrs, message_id, log_event_type = 'sent')
self.status = 'sent'
save!
- log_event_type = "followup_#{ log_event_type }" if message_type == 'followup'
+ if message_type == 'followup'
+ log_event_type = "followup_#{ log_event_type }"
+ end
info_request.log_event(
log_event_type,
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 3cd3c8dc59..2de60a80d4 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -93,7 +93,9 @@ def reason_params=(reason_params)
def reason_params
param_hash = YAML.load(reason_params_yaml)
param_hash.each do |key, value|
- param_hash[key] = value.force_encoding('UTF-8') if value.respond_to?(:force_encoding)
+ if value.respond_to?(:force_encoding)
+ param_hash[key] = value.force_encoding('UTF-8')
+ end
end
param_hash
end
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 65559da8c7..ba4621f17c 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -49,9 +49,7 @@ def convert_image
# draft images are before the user has cropped them
if !draft && (image.width != WIDTH || image.height != HEIGHT)
# do any exact cropping (taken from Jcrop interface)
- if w && h
- image.crop("#{ w }x#{ h }+#{ x }+#{ y }")
- end
+ image.crop("#{ w }x#{ h }+#{ x }+#{ y }") if w && h
# do any further cropping
# resize_to_fill!
image.combine_options do |c|
@@ -69,9 +67,7 @@ def convert_image
altered = true
end
- if altered
- self.data = image.to_blob
- end
+ self.data = image.to_blob if altered
end
private
@@ -103,9 +99,7 @@ def data_and_draft_checks
raise "Internal error, draft pictures must not have a user"
end
- if !draft && !user_id
- raise "Internal error, real pictures must have a user"
- end
+ raise "Internal error, real pictures must have a user" if !draft && !user_id
end
# Convert binary data blob into ImageMagick image when assigned
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 2801fe6c1c..6dfa05bad8 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -298,7 +298,9 @@ def self.find_by_url_name_with_historic(name)
# Maybe return the first one, so we show something relevant,
# rather than throwing an error?
- raise "Two bodies with the same historical URL name: #{name}" if old.size > 1
+ if old.size > 1
+ raise "Two bodies with the same historical URL name: #{name}"
+ end
return unless old.size == 1
# does acts_as_versioned provide a method that returns the current version?
PublicBody.find(old.first)
@@ -547,9 +549,7 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
end
# Rollback if a dry run, or we had errors
- if dry_run or errors.size > 0
- raise ImportCSVDryRun
- end
+ raise ImportCSVDryRun if dry_run or errors.size > 0
end
rescue ImportCSVDryRun
# Ignore
@@ -954,12 +954,8 @@ def name_for_search
def self.get_public_body_list_translated_condition(table, has_first_letter=false, locale=nil)
result = "(upper(#{table}.name) LIKE upper(:query)" \
" OR upper(#{table}.short_name) LIKE upper(:query))"
- if has_first_letter
- result += " AND #{table}.first_letter = :first_letter"
- end
- if locale
- result += " AND #{table}.locale = :locale"
- end
+ result += " AND #{table}.first_letter = :first_letter" if has_first_letter
+ result += " AND #{table}.locale = :locale" if locale
result
end
diff --git a/app/models/public_body_category/category_collection.rb b/app/models/public_body_category/category_collection.rb
index c8b36a96f7..31adbd82ca 100644
--- a/app/models/public_body_category/category_collection.rb
+++ b/app/models/public_body_category/category_collection.rb
@@ -47,9 +47,7 @@ def by_heading
def headings
output = []
@categories.each do |row|
- unless row.is_a?(Array)
- output << row
- end
+ output << row unless row.is_a?(Array)
end
output
end
diff --git a/app/models/public_body_change_request.rb b/app/models/public_body_change_request.rb
index ff652a104a..785491442f 100644
--- a/app/models/public_body_change_request.rb
+++ b/app/models/public_body_change_request.rb
@@ -118,12 +118,8 @@ def send_response(subject, response)
def comment_for_public_body
comments = ["Requested by: #{get_user_name} (#{get_user_email})"]
- if !source_url.blank?
- comments << "Source URL: #{source_url}"
- end
- if !notes.blank?
- comments << "Notes: #{notes}"
- end
+ comments << "Source URL: #{source_url}" if !source_url.blank?
+ comments << "Notes: #{notes}" if !notes.blank?
comments.join("\n")
end
diff --git a/app/models/user.rb b/app/models/user.rb
index b827dac824..9234366c52 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -479,7 +479,9 @@ def next_request_permitted_at
order(created_at: :desc).
limit(AlaveteliConfiguration.max_requests_per_user_per_day)
- return nil if n_most_recent_requests.size < AlaveteliConfiguration::max_requests_per_user_per_day
+ if n_most_recent_requests.size < AlaveteliConfiguration::max_requests_per_user_per_day
+ return nil
+ end
nth_most_recent_request = n_most_recent_requests[-1]
nth_most_recent_request.created_at + 1.day
diff --git a/config/boot.rb b/config/boot.rb
index 2ef988ccf4..e6a5f1c48d 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -7,6 +7,4 @@
# it exists. Put just a line like this in there:
# ENV['RAILS_ENV'] = 'production'
rails_env_file = File.expand_path(File.join(File.dirname(__FILE__), 'rails_env.rb'))
-if File.exist?(rails_env_file)
- require rails_env_file
-end
+require rails_env_file if File.exist?(rails_env_file)
diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb
index bd8dc69cdf..ec9b9c4e93 100644
--- a/config/initializers/theme_loader.rb
+++ b/config/initializers/theme_loader.rb
@@ -28,9 +28,7 @@ def require_theme(theme_name)
# By setting this ALAVETELI_TEST_THEME to a theme name, theme tests can run in the Rails
# context with the theme loaded. Otherwise the themes from the config aren't loaded in testing
# so they don't interfere with core Alaveteli tests
- if defined? ALAVETELI_TEST_THEME
- require_theme(ALAVETELI_TEST_THEME)
- end
+ require_theme(ALAVETELI_TEST_THEME) if defined? ALAVETELI_TEST_THEME
else
for url in AlaveteliConfiguration::theme_urls.reverse
require_theme theme_url_to_theme_name(url)
diff --git a/db/migrate/096_create_translation_tables.rb b/db/migrate/096_create_translation_tables.rb
index a07e1cbf1d..c914a6fc6f 100644
--- a/db/migrate/096_create_translation_tables.rb
+++ b/db/migrate/096_create_translation_tables.rb
@@ -19,9 +19,7 @@ def self.up
PublicBody.all.each do |publicbody|
publicbody.translated_attributes.each do |a, default|
value = publicbody.read_attribute(a)
- unless value.nil?
- publicbody.send(:"#{a}=", value)
- end
+ publicbody.send(:"#{a}=", value) unless value.nil?
end
publicbody.save!
end
diff --git a/db/migrate/20140716131107_create_category_translation_tables.rb b/db/migrate/20140716131107_create_category_translation_tables.rb
index f60ec1f3f6..798f40d404 100644
--- a/db/migrate/20140716131107_create_category_translation_tables.rb
+++ b/db/migrate/20140716131107_create_category_translation_tables.rb
@@ -16,9 +16,7 @@ def up
PublicBodyCategory.where(:locale => default_locale).each do |category|
category.translated_attributes.each do |a, default|
value = category.read_attribute(a)
- unless value.nil?
- category.send(:"#{a}=", value)
- end
+ category.send(:"#{a}=", value) unless value.nil?
end
category.save!
end
@@ -54,9 +52,7 @@ def up
PublicBodyHeading.where(:locale => default_locale).each do |heading|
heading.translated_attributes.each do |a, default|
value = heading.read_attribute(a)
- unless value.nil?
- heading.send(:"#{a}=", value)
- end
+ heading.send(:"#{a}=", value) unless value.nil?
end
heading.save!
end
diff --git a/db/migrate/20170718261524_add_expiring_notification_at.rb b/db/migrate/20170718261524_add_expiring_notification_at.rb
index a1390b2b82..c8539aca73 100644
--- a/db/migrate/20170718261524_add_expiring_notification_at.rb
+++ b/db/migrate/20170718261524_add_expiring_notification_at.rb
@@ -14,9 +14,7 @@ def down
private
def column_exists?(table, column)
- if data_source_exists?(table)
- connection.column_exists?(table, column)
- end
+ connection.column_exists?(table, column) if data_source_exists?(table)
end
def data_source_exists?(table)
diff --git a/db/migrate/20170825150448_add_stripe_customer_id_to_pro_account.rb b/db/migrate/20170825150448_add_stripe_customer_id_to_pro_account.rb
index 35957da64f..97196e469d 100644
--- a/db/migrate/20170825150448_add_stripe_customer_id_to_pro_account.rb
+++ b/db/migrate/20170825150448_add_stripe_customer_id_to_pro_account.rb
@@ -14,9 +14,7 @@ def down
private
def column_exists?(table, column)
- if data_source_exists?(table)
- connection.column_exists?(table, column)
- end
+ connection.column_exists?(table, column) if data_source_exists?(table)
end
def data_source_exists?(table)
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 610e9ebdc5..34caf8d98a 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -111,7 +111,9 @@ def self.prepare_environment
# barf if we can't figure out the environment
environment = (ENV['RAILS_ENV'] or Rails.env)
- raise "Set RAILS_ENV, so acts_as_xapian can find the right Xapian database" if not environment
+ if not environment
+ raise "Set RAILS_ENV, so acts_as_xapian can find the right Xapian database"
+ end
# check for a config file
config_file = Rails.root.join("config","xapian.yml")
@@ -141,8 +143,12 @@ def self.prepare_environment
# TODO: we perhaps don't need to rebuild database and enquire and queryparser -
# but db.reopen wasn't enough by itself, so just do everything it's easier.
def self.readable_init
- raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed") unless ActsAsXapian.bindings_available
- raise "acts_as_xapian hasn't been called in any models" if @@init_values.empty?
+ unless ActsAsXapian.bindings_available
+ raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed")
+ end
+ if @@init_values.empty?
+ raise "acts_as_xapian hasn't been called in any models"
+ end
prepare_environment
@@ -151,9 +157,7 @@ def self.readable_init
# only speculate about at the moment. (It is easy to reproduce this by
# changing the code below to use reopen rather than open followed by
# close, and running rake spec.)
- if !@@db.nil?
- @@db.close
- end
+ @@db.close if !@@db.nil?
# basic Xapian objects
begin
@@ -207,7 +211,9 @@ def self.init_query_parser
def self.init_values(values)
values.each do |method, index, prefix, value_type|
- raise "Value index '#{index}' must be an Integer, is #{index.class}" unless index.is_a? Integer
+ unless index.is_a? Integer
+ raise "Value index '#{index}' must be an Integer, is #{index.class}"
+ end
if @@values_by_number.include?(index) && @@values_by_number[index] != prefix
raise "Already have value index '#{index}' in another model " \
"but with different prefix '#{@@values_by_number[index]}'"
@@ -239,9 +245,15 @@ def self.init_values(values)
def self.init_terms(terms)
terms.each do |method, term_code, prefix|
- raise "Use a single capital letter for term code" if not term_code.match(/^[A-Z]$/)
- raise "M and I are reserved for use as the model/id term" if term_code == "M" || term_code == "I"
- raise "model and modelid are reserved for use as the model/id prefixes" if prefix == "model" || prefix == "modelid"
+ if not term_code.match(/^[A-Z]$/)
+ raise "Use a single capital letter for term code"
+ end
+ if term_code == "M" || term_code == "I"
+ raise "M and I are reserved for use as the model/id term"
+ end
+ if prefix == "model" || prefix == "modelid"
+ raise "model and modelid are reserved for use as the model/id prefixes"
+ end
raise "Z is reserved for stemming terms" if term_code == "Z"
if @@terms_by_capital.include?(term_code) && @@terms_by_capital[term_code] != prefix
raise "Already have code '#{term_code}' in another model but with different prefix " \
@@ -257,8 +269,12 @@ def self.init_terms(terms)
end
def self.writable_init(suffix = "")
- raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed") unless ActsAsXapian.bindings_available
- raise "acts_as_xapian hasn't been called in any models" if @@init_values.empty?
+ unless ActsAsXapian.bindings_available
+ raise NoXapianRubyBindingsError.new("Xapian Ruby bindings not installed")
+ end
+ if @@init_values.empty?
+ raise "acts_as_xapian hasn't been called in any models"
+ end
# if DB is not nil, then we're already initialised, so don't do it
# again TODO: reopen it each time, xapian_spec.rb needs this so database
@@ -295,9 +311,7 @@ def initialize_db
self.runtime = 0.0
ActsAsXapian.readable_init
- if ActsAsXapian.db.nil?
- raise "ActsAsXapian not initialized"
- end
+ raise "ActsAsXapian not initialized" if ActsAsXapian.db.nil?
end
MSET_MAX_TRIES = 5
@@ -309,7 +323,9 @@ def initialize_query(options)
self.runtime += Benchmark::realtime {
offset = options[:offset] || 0; offset = offset.to_i
limit = options[:limit]
- raise "please specifiy maximum number of results to return with parameter :limit" if not limit
+ if not limit
+ raise "please specifiy maximum number of results to return with parameter :limit"
+ end
limit = limit.to_i
sort_by_prefix = options[:sort_by_prefix] || nil
sort_by_ascending = options[:sort_by_ascending].nil? ? true : options[:sort_by_ascending]
@@ -321,14 +337,18 @@ def initialize_query(options)
ActsAsXapian.enquire.sort_by_relevance!
else
value = ActsAsXapian.values_by_prefix[sort_by_prefix]
- raise "couldn't find prefix '" + sort_by_prefix.to_s + "'" if value.nil?
+ if value.nil?
+ raise "couldn't find prefix '" + sort_by_prefix.to_s + "'"
+ end
ActsAsXapian.enquire.sort_by_value_then_relevance!(value, sort_by_ascending)
end
if collapse_by_prefix.nil?
ActsAsXapian.enquire.collapse_key = Xapian::BAD_VALUENO
else
value = ActsAsXapian.values_by_prefix[collapse_by_prefix]
- raise "couldn't find prefix '" + collapse_by_prefix + "'" if value.nil?
+ if value.nil?
+ raise "couldn't find prefix '" + collapse_by_prefix + "'"
+ end
ActsAsXapian.enquire.collapse_key = value
end
@@ -374,9 +394,7 @@ def has_normal_search_terms?
#x = x + term.to_yaml + term.size.to_s + term[0..0] + "*"
if term.size >= 2 && term[0..0] == 'Z'
# normal terms begin Z (for stemmed), then have no capital letter prefix
- if term[1..1] == term[1..1].downcase
- ret = true
- end
+ ret = true if term[1..1] == term[1..1].downcase
end
end
return ret
@@ -390,18 +408,14 @@ def matches_estimated
# Return query string with spelling correction
def spelling_correction
correction = ActsAsXapian.query_parser.get_corrected_query_string
- if correction.empty?
- return nil
- end
+ return nil if correction.empty?
correction.force_encoding('UTF-8')
end
# Return array of models found
def results
# If they've already pulled out the results, just return them.
- if !self.cached_results.nil?
- return self.cached_results
- end
+ return self.cached_results if !self.cached_results.nil?
docs = []
self.runtime += Benchmark::realtime {
@@ -476,7 +490,9 @@ def initialize(model_classes, query_string, options = {}, user_query = nil)
new_model_classes = []
model_classes = [model_classes] if model_classes.class != Array
for model_class in model_classes
- raise "pass in the model class itself, or a string containing its name" if model_class.class != Class && model_class.class != String
+ if model_class.class != Class && model_class.class != String
+ raise "pass in the model class itself, or a string containing its name"
+ end
model_class = model_class.constantize if model_class.class == String
new_model_classes.push(model_class)
end
@@ -513,11 +529,15 @@ def words_to_highlight(opts = {})
# Reject all prefixes other than Z, which we know is reserved for stems
terms = query.terms.reject { |t| t.term.first.match(/^[A-Y]$/) }
# Collect the stems including the Z prefix
- raw_stems = terms.map { |t| t.term if t.term.start_with?('Z') }.compact.uniq.sort
+ raw_stems = terms.map { |t| if t.term.start_with?('Z')
+ t.term
+ end }.compact.uniq.sort
# Collect stems, chopping the Z prefix off
stems = raw_stems.map { |t| t[1..-1] }.compact.sort
# Collect the non-stem terms
- words = terms.map { |t| t.term unless t.term.start_with?('Z') }.compact.sort
+ words = terms.map { |t| unless t.term.start_with?('Z')
+ t.term
+ end }.compact.sort
# Add the unstemmed words from the original query
# Sometimes stems can be unhelpful with the :regex option, for example
@@ -756,7 +776,9 @@ def self.update_index(flush = false, verbose = false)
end
def self.run_job(job, flush, verbose)
- STDOUT.puts("ActsAsXapian.update_index #{job.action} #{job.model} #{job.model_id.to_s} #{Time.now.to_s}") if verbose
+ if verbose
+ STDOUT.puts("ActsAsXapian.update_index #{job.action} #{job.model} #{job.model_id.to_s} #{Time.now.to_s}")
+ end
begin
if job.action == 'update'
@@ -776,9 +798,7 @@ def self.run_job(job, flush, verbose)
job.action = 'destroy'
retry
end
- if flush
- ActsAsXapian.writable_db.flush
- end
+ ActsAsXapian.writable_db.flush if flush
job.destroy
end
@@ -817,12 +837,12 @@ def self.destroy_and_rebuild_index(model_classes, verbose = false, terms = true,
new_path = ActsAsXapian.db_path + ".new"
old_path = ActsAsXapian.db_path
if File.exist?(new_path)
- raise "found existing " + new_path + " which is not Xapian chert or glass database, please delete for me" if not ActsAsXapian._is_xapian_db(new_path)
+ if not ActsAsXapian._is_xapian_db(new_path)
+ raise "found existing " + new_path + " which is not Xapian chert or glass database, please delete for me"
+ end
FileUtils.rm_r(new_path)
end
- if update_existing
- FileUtils.cp_r(old_path, new_path)
- end
+ FileUtils.cp_r(old_path, new_path) if update_existing
ActsAsXapian.writable_init
ActsAsXapian.writable_db.close # just to make an empty one to read
# Index everything
@@ -833,9 +853,13 @@ def self.destroy_and_rebuild_index(model_classes, verbose = false, terms = true,
ActsAsXapian.writable_init
# Save time by running the indexing in one go and in-process
for model_class in model_classes
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: Rebuilding #{model_class.to_s}") if verbose
+ if verbose
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: Rebuilding #{model_class.to_s}")
+ end
model_class.find_each do |model|
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index #{model_class} #{model.id}") if verbose
+ if verbose
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index #{model_class} #{model.id}")
+ end
model.xapian_index(terms, values, texts)
end
end
@@ -847,12 +871,12 @@ def self.destroy_and_rebuild_index(model_classes, verbose = false, terms = true,
temp_path = old_path + ".tmp"
if File.exist?(temp_path)
@@db_path = old_path
- raise "temporary database found " + temp_path + " which is not Xapian chert or glass database, please delete for me" if not ActsAsXapian._is_xapian_db(temp_path)
+ if not ActsAsXapian._is_xapian_db(temp_path)
+ raise "temporary database found " + temp_path + " which is not Xapian chert or glass database, please delete for me"
+ end
FileUtils.rm_r(temp_path)
end
- if File.exist?(old_path)
- FileUtils.mv old_path, temp_path
- end
+ FileUtils.mv old_path, temp_path if File.exist?(old_path)
FileUtils.mv new_path, old_path
# Delete old database
@@ -883,9 +907,7 @@ def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values
pid = Process.fork # TODO: this will only work on Unix, tough
if pid
Process.waitpid(pid)
- if not $?.success?
- raise "batch fork child failed, exiting also"
- end
+ raise "batch fork child failed, exiting also" if not $?.success?
# database connection doesn't survive a fork, rebuild it
else
# fully reopen the database each time (with a new object)
@@ -893,9 +915,13 @@ def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values
ActiveRecord::Base.establish_connection
@@db_path = ActsAsXapian.db_path + ".new"
ActsAsXapian.writable_init
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: New batch. #{model_class.to_s} from #{i} to #{i + batch_size} of #{model_class_count} pid #{Process.pid.to_s}") if verbose
+ if verbose
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: New batch. #{model_class.to_s} from #{i} to #{i + batch_size} of #{model_class_count} pid #{Process.pid.to_s}")
+ end
model_class.limit(batch_size).offset(i).order(:id).each do |model|
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index #{model_class} #{model.id}") if verbose
+ if verbose
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index #{model_class} #{model.id}")
+ end
model.xapian_index(terms, values, texts)
end
ActsAsXapian.writable_db.flush
@@ -1092,7 +1118,9 @@ def xapian_mark_needs_destroy
# Allow reindexing to be skipped if a flag is set
def xapian_mark_needs_index_if_reindex
- return true if (self.respond_to?(:no_xapian_reindex) && self.no_xapian_reindex == true)
+ if (self.respond_to?(:no_xapian_reindex) && self.no_xapian_reindex == true)
+ return true
+ end
xapian_mark_needs_index
end
@@ -1110,7 +1138,9 @@ def xapian_create_job(action, model, model_id)
rescue ActiveRecord::RecordNotUnique => e
# Given the error handling in ActsAsXapian::update_index, we can just fail silently if
# another process has inserted an acts_as_xapian_jobs record for this model.
- raise unless (e.message =~ /duplicate key value violates unique constraint "index_acts_as_xapian_jobs_on_model_and_model_id"/)
+ unless (e.message =~ /duplicate key value violates unique constraint "index_acts_as_xapian_jobs_on_model_and_model_id"/)
+ raise
+ end
end
end
@@ -1127,9 +1157,7 @@ module ActsMethods
# See top of this file for docs
def acts_as_xapian(options)
# Give error only on queries if bindings not available
- if not ActsAsXapian.bindings_available
- return
- end
+ return if not ActsAsXapian.bindings_available
include InstanceMethods
diff --git a/lib/acts_as_xapian/tasks/xapian.rake b/lib/acts_as_xapian/tasks/xapian.rake
index fee2ccf49d..01e3c0facf 100644
--- a/lib/acts_as_xapian/tasks/xapian.rake
+++ b/lib/acts_as_xapian/tasks/xapian.rake
@@ -39,7 +39,9 @@ namespace :xapian do
return arg
end
end
- raise "specify ALL your models with models=\"ModelName1 ModelName2\" as parameter" if ENV['models'].nil?
+ if ENV['models'].nil?
+ raise "specify ALL your models with models=\"ModelName1 ModelName2\" as parameter"
+ end
ActsAsXapian.destroy_and_rebuild_index(
ENV['models'].split(" ").map { |m| m.constantize },
coerce_arg(ENV['verbose'], false),
@@ -52,7 +54,9 @@ namespace :xapian do
# collapse_by_prefix
desc 'Run a query, return YAML of results'
task :query => :environment do
- raise "specify models=\"ModelName1 ModelName2\" as parameter" if ENV['models'].nil?
+ if ENV['models'].nil?
+ raise "specify models=\"ModelName1 ModelName2\" as parameter"
+ end
raise "specify query=\"your terms\" as parameter" if ENV['query'].nil?
s = ActsAsXapian::Search.new(ENV['models'].split(" ").map { |m| m.constantize },
ENV['query'],
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index 3363d8cd6c..89b9e14b48 100644
--- a/lib/alaveteli_external_command.rb
+++ b/lib/alaveteli_external_command.rb
@@ -36,9 +36,7 @@ def run(*args)
# TODO: calling code should be able to specify error stream - may want to log it or
# otherwise act upon it.
opts = {}
- if !args.empty? && args.last.is_a?(Hash)
- opts = args.last
- end
+ opts = args.last if !args.empty? && args.last.is_a?(Hash)
program_path = find_program!
xc = ExternalCommand.new(program_path, *command_args, *args)
diff --git a/lib/alaveteli_file_types.rb b/lib/alaveteli_file_types.rb
index 7442702549..1d6d35d612 100644
--- a/lib/alaveteli_file_types.rb
+++ b/lib/alaveteli_file_types.rb
@@ -38,9 +38,7 @@ def all_extensions
def filename_and_content_to_mimetype(filename, content)
# Try filename
ret = filename_to_mimetype(filename)
- if !ret.nil?
- return ret
- end
+ return ret if !ret.nil?
# Otherwise look inside the file to work out the type.
# Mahoro is a Ruby binding for libmagic.
@@ -49,29 +47,21 @@ def filename_and_content_to_mimetype(filename, content)
mahoro_type.strip!
# TODO: we shouldn't have to check empty? here, but Mahoro sometimes returns a blank line :(
# e.g. for InfoRequestEvent 17930
- if mahoro_type.nil? || mahoro_type.empty?
- return nil
- end
+ return nil if mahoro_type.nil? || mahoro_type.empty?
# text/plain types sometimes come with a charset
mahoro_type.match(/^(.*);/)
- if $1
- mahoro_type = $1
- end
+ mahoro_type = $1 if $1
# see if looks like a content type, or has something in it that does
# and return that
# mahoro returns junk "\012- application/msword" as mime type.
mahoro_type.match(/([a-z0-9.-]+\/[a-z0-9.-]+)/)
- if $1
- return $1
- end
+ return $1 if $1
# otherwise we got junk back from mahoro
return nil
end
def filename_to_mimetype(filename)
- if !filename
- return nil
- end
+ return nil if !filename
if filename.match(/\.([^.]+)$/i)
lext = $1.downcase
if FileExtensionToMimeType.include?(lext)
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index dc7b0cb64d..27a1f4f984 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -113,13 +113,9 @@ def start(&block)
yield pop3
rescue StandardError => error
- if send_exception_notifications?
- ExceptionNotifier.notify_exception(error)
- end
+ ExceptionNotifier.notify_exception(error) if send_exception_notifications?
ensure
- if defined?(pop3) && pop3 && pop3.started?
- pop3.finish
- end
+ pop3.finish if defined?(pop3) && pop3 && pop3.started?
end
def default_pop3
diff --git a/lib/attachment_to_html.rb b/lib/attachment_to_html.rb
index 34164e9bdb..928eb56aaa 100644
--- a/lib/attachment_to_html.rb
+++ b/lib/attachment_to_html.rb
@@ -17,7 +17,9 @@ def to_html(attachment, opts = {})
end
view = View.new(adapter)
- view.wrapper = 'wrapper_google_embed' if adapter.is_a?(Adapters::GoogleDocsViewer)
+ if adapter.is_a?(Adapters::GoogleDocsViewer)
+ view.wrapper = 'wrapper_google_embed'
+ end
view.render do
opts.fetch(:content_for, []).each do |k,v|
diff --git a/lib/attachment_to_html/adapters/rtf.rb b/lib/attachment_to_html/adapters/rtf.rb
index 0657133b3b..0d98a1b19d 100644
--- a/lib/attachment_to_html/adapters/rtf.rb
+++ b/lib/attachment_to_html/adapters/rtf.rb
@@ -55,9 +55,7 @@ def sanitize_converted(html)
invalid = %Q()
valid = %Q( /dev/null", "wb") do |f|
f.write(content)
f.close
- if $?.signaled?
- raise IOError, "tnef exited with signal #{$?.termsig}"
- end
+ raise IOError, "tnef exited with signal #{$?.termsig}" if $?.signaled?
if $?.exited? && $?.exitstatus != 0
raise TNEFParsingError, "tnef exited with status #{$?.exitstatus}"
end
@@ -36,9 +34,7 @@ def tnef_attachments(content)
found += 1
end
end
- if found == 0
- raise TNEFParsingError, "tnef produced no attachments"
- end
+ raise TNEFParsingError, "tnef produced no attachments" if found == 0
end
attachments
end
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index fd00e1eabf..98581ee9e1 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -66,9 +66,7 @@ def mail_from_outlook(content)
def get_subject(mail)
subject = mail.subject
- if subject
- convert_string_to_utf8(subject).string
- end
+ convert_string_to_utf8(subject).string if subject
end
def get_within_rfc822_subject(leaf)
@@ -252,17 +250,13 @@ def expand_and_normalize_parts(part, parent_mail)
part_body = get_part_body(part)
calc_mime = AlaveteliFileTypes.filename_and_content_to_mimetype(part_filename,
part_body)
- if calc_mime
- part.content_type = calc_mime
- end
+ part.content_type = calc_mime if calc_mime
end
# Use standard content types for Word documents etc.
part.content_type = normalise_content_type(get_content_type(part))
decode_attached_part(part, parent_mail)
- if original_charset
- part.charset = original_charset
- end
+ part.charset = original_charset if original_charset
end
end
@@ -285,9 +279,7 @@ def count_parts(part, parent_mail)
# Choose the best part from alternatives
def choose_best_alternative(mail)
- if mail.parts.any?(&:multipart?)
- return mail.parts.detect(&:multipart?)
- end
+ return mail.parts.detect(&:multipart?) if mail.parts.any?(&:multipart?)
if mail.html_part
return mail.html_part
elsif mail.text_part
@@ -397,9 +389,7 @@ def address_from_name_and_email(name, email)
if !MySociety::Validate.is_valid_email(email)
raise "invalid email " + email + " passed to address_from_name_and_email"
end
- if name.nil?
- return Mail::Address.new(email.dup).to_s
- end
+ return Mail::Address.new(email.dup).to_s if name.nil?
address = Mail::Address.new
address.display_name = name.dup
address.address = email.dup
diff --git a/lib/mail_handler/reply_handler.rb b/lib/mail_handler/reply_handler.rb
index e9137bac51..5161baebb8 100644
--- a/lib/mail_handler/reply_handler.rb
+++ b/lib/mail_handler/reply_handler.rb
@@ -64,32 +64,18 @@ def self.is_oof?(message)
subject = MailHandler.get_header_string("Subject", message).downcase
if MailHandler.empty_return_path?(message)
- if subject.start_with? "out of office: "
- return true
- end
- if subject.start_with? "automatic reply: "
- return true
- end
+ return true if subject.start_with? "out of office: "
+ return true if subject.start_with? "automatic reply: "
end
if MailHandler.get_header_string("Auto-Submitted", message) == "auto-generated"
- if subject =~ /out of( the)? office/
- return true
- end
+ return true if subject =~ /out of( the)? office/
end
- if subject.start_with? "out of office autoreply:"
- return true
- end
- if subject == "out of office"
- return true
- end
- if subject == "out of office reply"
- return true
- end
- if subject.end_with? "is out of the office"
- return true
- end
+ return true if subject.start_with? "out of office autoreply:"
+ return true if subject == "out of office"
+ return true if subject == "out of office reply"
+ return true if subject.end_with? "is out of the office"
return false
end
diff --git a/lib/memory_profiler.rb b/lib/memory_profiler.rb
index a8e0267368..b418a777f4 100644
--- a/lib/memory_profiler.rb
+++ b/lib/memory_profiler.rb
@@ -35,9 +35,7 @@ def self.start(opt={})
ObjectSpace.each_object do |o|
curr[o.class] += 1 #Marshal.dump(o).size rescue 1
- if opt[:string_debug] and o.class == String
- curr_strings.push o
- end
+ curr_strings.push o if opt[:string_debug] and o.class == String
end
if opt[:string_debug]
diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb
index a875166de9..0a5f4f2458 100644
--- a/lib/routing_filters.rb
+++ b/lib/routing_filters.rb
@@ -13,11 +13,18 @@ def prepend_locale?(locale)
# what FastGettext and other POSIX-based systems use, and will
# look like `en_US`
def around_generate(*args, &block)
- params = args.extract_options! # this is because we might get a call like forum_topics_path(forum, topic, :locale => :en)
-
- locale = params.delete(:locale) # extract the passed :locale option
- locale = AlaveteliLocalization.locale if locale.nil? # default to underscore locale when locale is nil (could also be false)
- locale = nil unless valid_locale?(locale) # reset to no locale when locale is not valid
+ # this is because we might get a call like forum_topics_path(forum, topic, :locale => :en)
+ params = args.extract_options!
+ # extract the passed :locale option
+ locale = params.delete(:locale)
+ if locale.nil?
+ # default to underscore locale when locale is nil (could also be false)
+ locale = AlaveteliLocalization.locale
+ end
+ unless valid_locale?(locale)
+ # reset to no locale when locale is not valid
+ locale = nil
+ end
args << params
yield.tap do |result|
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 0e1ad91044..9b85695c3f 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -3,17 +3,13 @@ namespace :cleanup do
desc 'Clean up all message redelivery and destroy actions from the holding pen to make admin actions there faster'
task :holding_pen => :environment do
dryrun = ENV['DRYRUN'] != '0' if ENV['DRYRUN']
- if dryrun
- $stderr.puts "This is a dryrun - nothing will be deleted"
- end
+ $stderr.puts "This is a dryrun - nothing will be deleted" if dryrun
holding_pen = InfoRequest.holding_pen_request
holding_pen.info_request_events.
where(:event_type => %w(redeliver_incoming destroy_incoming)).
find_each do |event|
$stderr.puts event.inspect if verbose or dryrun
- if not dryrun
- event.destroy
- end
+ event.destroy if not dryrun
end
end
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index e9b41368b1..be32028121 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -188,9 +188,7 @@ namespace :config_files do
example = 'rake config_files:set_reject_incoming_at_mta REJECTED_THRESHOLD=5 AGE_IN_MONTHS=12'
check_for_env_vars(['REJECTED_THRESHOLD', 'AGE_IN_MONTHS'], example)
dryrun = ENV['DRYRUN'] != '0'
- if dryrun
- STDERR.puts "Only a dry run; info_requests will not be updated"
- end
+ STDERR.puts "Only a dry run; info_requests will not be updated" if dryrun
options = {:rejection_threshold => ENV['REJECTED_THRESHOLD'],
:age_in_months => ENV['AGE_IN_MONTHS'],
:dryrun => dryrun}
diff --git a/lib/tasks/geoip.rake b/lib/tasks/geoip.rake
index 08dd7fe688..42fda379c8 100644
--- a/lib/tasks/geoip.rake
+++ b/lib/tasks/geoip.rake
@@ -58,9 +58,7 @@ namespace :geoip do
`tar -xzf #{downloaded_location} -C #{tmp_dir}`
- unless File.exist?(target_dir)
- FileUtils.mkdir target_dir
- end
+ FileUtils.mkdir target_dir unless File.exist?(target_dir)
extracted_folder = Dir["#{tmp_dir}/GeoLite2-Country_*"].last
FileUtils.mv("#{extracted_folder}/GeoLite2-Country.mmdb", destination)
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
index 7d6bb7ebc4..94b1e69f77 100644
--- a/lib/tasks/gettext.rake
+++ b/lib/tasks/gettext.rake
@@ -121,7 +121,9 @@ namespace :gettext do
lines << line
end
end
- puts "Mappings unused in #{po_file}: #{lang_mappings.keys}" unless lang_mappings.empty?
+ unless lang_mappings.empty?
+ puts "Mappings unused in #{po_file}: #{lang_mappings.keys}"
+ end
File.open(po_file, "w") { |f| f.puts(lines) }
end
end
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 8e1d410511..6126cb7261 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -5,9 +5,7 @@ namespace :import do
desc 'Import public bodies from CSV provided on standard input'
task :import_csv => :environment do
dryrun = ENV['DRYRUN'] != '0'
- if dryrun
- STDERR.puts 'Only a dry run; public bodies will not be created'
- end
+ STDERR.puts 'Only a dry run; public bodies will not be created' if dryrun
tmp_csv = nil
Tempfile.open('alaveteli') do |f|
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index b2b84106c2..247ee02c40 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -31,9 +31,7 @@ namespace :themes do
def uninstall(theme_name, verbose=false)
possible_theme_dirs(theme_name).each do |dir|
- if File.directory?(dir)
- run_hook(theme_name, 'uninstall', verbose)
- end
+ run_hook(theme_name, 'uninstall', verbose) if File.directory?(dir)
end
end
@@ -164,9 +162,7 @@ namespace :themes do
locale_extensions(locale).each do |locale_extension|
filename = "#{template_name}#{locale_extension}.html.erb"
filepath = "lib/themes/#{theme_name}/lib/views/help/#{filename}"
- if File.exist?(filepath)
- return filepath
- end
+ return filepath if File.exist?(filepath)
end
nil
end
@@ -258,9 +254,7 @@ EOF
missing = true
end
end
- if !missing
- puts "No missing templates or sections"
- end
+ puts "No missing templates or sections" if !missing
end
end
diff --git a/lib/tasks/usage.rb b/lib/tasks/usage.rb
index 470f8997ed..491bfb6194 100644
--- a/lib/tasks/usage.rb
+++ b/lib/tasks/usage.rb
@@ -10,15 +10,11 @@ def usage_message message
def check_for_env_vars(env_vars, example)
missing = []
env_vars.each do |env_var|
- unless ENV[env_var]
- missing << env_var
- end
+ missing << env_var unless ENV[env_var]
end
if !missing.empty?
usage = "Usage: This task requires #{env_vars.to_sentence} - missing #{missing.to_sentence}"
- if example
- usage += "\nExample: #{example}"
- end
+ usage += "\nExample: #{example}" if example
usage_message usage
end
end
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake
index 4ea8229cbc..5e25d73658 100644
--- a/lib/tasks/users.rake
+++ b/lib/tasks/users.rake
@@ -99,9 +99,7 @@ namespace :users do
end
end_date =
- if ENV['END_DATE']
- Time.zone.parse(ENV['END_DATE']).at_end_of_day
- end
+ (Time.zone.parse(ENV['END_DATE']).at_end_of_day if ENV['END_DATE'])
# Only auto-calculate missing dates if one has been provided without the
# other
diff --git a/lib/typeahead_search.rb b/lib/typeahead_search.rb
index ac14a2522e..79fb122520 100644
--- a/lib/typeahead_search.rb
+++ b/lib/typeahead_search.rb
@@ -58,9 +58,7 @@ def check_query
end
# don't run a search if there's no query
- if @query.blank?
- @run_search = false
- end
+ @run_search = false if @query.blank?
end
diff --git a/lib/xapian_queries.rb b/lib/xapian_queries.rb
index e95ea8ef0c..451e8dbb18 100644
--- a/lib/xapian_queries.rb
+++ b/lib/xapian_queries.rb
@@ -20,9 +20,7 @@ def get_request_variety_from_params(params)
varieties << ['variety:comment']
end
end
- if !varieties.empty?
- query = " (#{varieties.join(' OR ')})"
- end
+ query = " (#{varieties.join(' OR ')})" if !varieties.empty?
return query
end
@@ -54,9 +52,7 @@ def get_status_from_params(params)
if params[:latest_status].include? "gone_postal"
statuses << ['latest_status:gone_postal']
end
- if !statuses.empty?
- query = " (#{statuses.join(' OR ')})"
- end
+ query = " (#{statuses.join(' OR ')})" if !statuses.empty?
end
return query
end
diff --git a/script/handle-mail-replies.rb b/script/handle-mail-replies.rb
index 5d1462412b..d751772166 100755
--- a/script/handle-mail-replies.rb
+++ b/script/handle-mail-replies.rb
@@ -91,7 +91,9 @@ def main(in_test_mode)
return 2 if MailHandler::ReplyHandler.is_oof?(message)
# Otherwise forward the message on
- MailHandler::ReplyHandler.forward_on(raw_message, message) unless in_test_mode
+ unless in_test_mode
+ MailHandler::ReplyHandler.forward_on(raw_message, message)
+ end
return 0
end
end
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index f99559e7dc..232f50400e 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -3431,9 +3431,7 @@ def create_old_unclassified_holding_pen
request_events, request_events_all_successful = InfoRequest.recent_requests
previous = nil
request_events.each do |event|
- if previous
- expect(previous.created_at).to be >= event.created_at
- end
+ expect(previous.created_at).to be >= event.created_at if previous
expect(['sent', 'response'].include?(event.event_type)).to be true
if event.event_type == 'response'
expect(['successful', 'partially_successful'].include?(event.calculated_state)).to be true
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ac559e9903..fc08296aac 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -86,9 +86,7 @@
# Clean up raw emails directory
config.after(:suite) do
raw_email_dir = File.join(Rails.root, 'files/raw_email_test')
- if File.directory?(raw_email_dir)
- FileUtils.rm_rf(raw_email_dir)
- end
+ FileUtils.rm_rf(raw_email_dir) if File.directory?(raw_email_dir)
FileUtils.rm_rf(Rails.root.join('tmp', 'storage'))
end
@@ -101,9 +99,7 @@
config.before(:suite) do
if ENV['ALAVETELI_USE_OINK']
oink_log = Rails.root + 'log/oink.log'
- if File.exist?(oink_log)
- File.write(oink_log, '')
- end
+ File.write(oink_log, '') if File.exist?(oink_log)
end
BCrypt::Engine.cost = 1
@@ -129,11 +125,15 @@
# Turn routing-filter off in functional and unit tests as per
# https://github.com/svenfuchs/routing-filter/blob/master/README.markdown#testing
config.before(:each) do |example|
- RoutingFilter.active = false if [:controller, :helper, :model].include? example.metadata[:type]
+ if [:controller, :helper, :model].include? example.metadata[:type]
+ RoutingFilter.active = false
+ end
end
config.after(:each) do |example|
- RoutingFilter.active = true if [:controller, :helper, :model].include? example.metadata[:type]
+ if [:controller, :helper, :model].include? example.metadata[:type]
+ RoutingFilter.active = true
+ end
end
# This section makes the garbage collector run less often to speed up tests
From 7a0c7ec219a0a877f9eb69205d561749157a0330 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 13:00:35 +0000
Subject: [PATCH 073/289] Refactor: Redundant self removed
---
app/controllers/admin_controller.rb | 2 +-
app/controllers/track_controller.rb | 10 +--
app/mailers/notification_mailer.rb | 6 +-
app/mailers/request_mailer.rb | 4 +-
.../alaveteli_pro/draft_info_request_batch.rb | 4 +-
app/models/alaveteli_pro/embargo.rb | 6 +-
app/models/alaveteli_pro/request_summary.rb | 6 +-
.../alaveteli_pro/request_summaries.rb | 6 +-
app/models/concerns/message_prominence.rb | 2 +-
app/models/draft_info_request.rb | 4 +-
app/models/foi_attachment.rb | 18 ++---
app/models/holiday_import.rb | 2 +-
app/models/incoming_message.rb | 54 +++++++--------
app/models/info_request/state/transitions.rb | 2 +-
app/models/info_request_batch.rb | 30 ++++----
app/models/info_request_event.rb | 6 +-
app/models/notification.rb | 10 +--
app/models/outgoing_message.rb | 6 +-
.../template/initial_request.rb | 2 +-
app/models/profile_photo.rb | 2 +-
app/models/public_body.rb | 18 ++---
app/models/public_body_change_request.rb | 6 +-
app/models/user.rb | 6 +-
app/validators/change_email_validator.rb | 2 +-
.../lib/alaveteli_features.rb | 2 +-
.../install/install_generator.rb | 2 +-
lib/acts_as_xapian/acts_as_xapian.rb | 68 +++++++++----------
lib/mail_handler/backends/mail_backend.rb | 6 +-
lib/mail_handler/reply_handler.rb | 4 +-
lib/world_foi_websites.rb | 2 +-
spec/mailers/application_mailer_spec.rb | 2 +-
spec/models/customstates.rb | 18 ++---
32 files changed, 159 insertions(+), 159 deletions(-)
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index f0201bf022..5c5eb81f03 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -59,7 +59,7 @@ def authenticate
session[:using_admin] = nil
session[:user_id] = nil
session[:admin_name] = nil
- self.authenticate
+ authenticate
end
end
else
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 65fdbf5165..165e4b79d1 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -19,7 +19,7 @@ def track_request
return atom_feed_internal if params[:feed] == 'feed'
- if self.track_set
+ if track_set
if AlaveteliConfiguration.enable_widgets && cookies[:widget_vote]
@info_request.
widget_votes.
@@ -45,7 +45,7 @@ def track_list
return atom_feed_internal if params[:feed] == 'feed'
- if self.track_set || @track_thing.errors.any?
+ if track_set || @track_thing.errors.any?
redirect_to request_list_url(:view => @view)
end
end
@@ -68,7 +68,7 @@ def track_public_body
return atom_feed_internal if params[:feed] == 'feed'
- if self.track_set || @track_thing.errors.any?
+ if track_set || @track_thing.errors.any?
redirect_to public_body_url(@public_body)
end
end
@@ -81,7 +81,7 @@ def track_user
return atom_feed_internal if params[:feed] == 'feed'
- if self.track_set || @track_thing.errors.any?
+ if track_set || @track_thing.errors.any?
redirect_to user_url(@track_user)
end
end
@@ -100,7 +100,7 @@ def track_search_query
return atom_feed_internal if params[:feed] == 'feed'
- if self.track_set || @track_thing.errors.any?
+ if track_set || @track_thing.errors.any?
if @query.scan("variety").length == 1
# we're making a track for a simple filter, for which
# there's an expression in the UI (rather than relying
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 101909e6e2..4d4db92687 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -53,8 +53,8 @@ def self.send_instant_notifications
end
def self.send_notifications
- sent_instant_notifications = self.send_instant_notifications
- sent_daily_notifications = self.send_daily_notifications
+ sent_instant_notifications = send_instant_notifications
+ sent_daily_notifications = send_daily_notifications
sent_instant_notifications || sent_daily_notifications
end
@@ -95,7 +95,7 @@ def daily_summary(user, notifications)
def instant_notification(notification)
event_type = notification.info_request_event.event_type
method = "#{event_type}_notification".to_sym
- self.send(method, notification)
+ send(method, notification)
end
def response_notification(notification)
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index d995eb6b93..210838dad1 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -242,7 +242,7 @@ def receive(email, raw_email, source = :mailin)
opts = { :source => source }
# Find which info requests the email is for
- reply_info_requests = self.requests_matching_email(email)
+ reply_info_requests = requests_matching_email(email)
# Nothing found, so save in holding pen
if reply_info_requests.size == 0
@@ -348,7 +348,7 @@ def self.alert_overdue_requests
# it goes out 3 days after last update of event, then after 10, then after 24.
def self.alert_new_response_reminders
AlaveteliConfiguration::new_response_reminder_after_days.each_with_index do |days, i|
- self.alert_new_response_reminders_internal(days, "new_response_reminder_#{i+1}")
+ alert_new_response_reminders_internal(days, "new_response_reminder_#{i+1}")
end
end
def self.alert_new_response_reminders_internal(days_since, type_code)
diff --git a/app/models/alaveteli_pro/draft_info_request_batch.rb b/app/models/alaveteli_pro/draft_info_request_batch.rb
index 9c14e28e25..d34faf6c52 100644
--- a/app/models/alaveteli_pro/draft_info_request_batch.rb
+++ b/app/models/alaveteli_pro/draft_info_request_batch.rb
@@ -37,7 +37,7 @@ def set_default_body
template_options = {}
template_options[:info_request_title] = title if title
self.body = template.body(template_options)
- self.body += self.user.name if self.user
+ self.body += user.name if user
end
end
@@ -48,7 +48,7 @@ def request_summary_body
# @see RequestSummaries#request_summary_public_body_names
def request_summary_public_body_names
- self.public_bodies.pluck(:name).join(" ")
+ public_bodies.pluck(:name).join(" ")
end
# @see RequestSummaries#request_summary_categories
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index e40124e470..4b502fcb38 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -138,10 +138,10 @@ def self.log_expiring_events
private
def add_set_embargo_event
- publish_at_changed = self.publish_at_changed?
+ publish_at_changed = publish_at_changed?
yield
if publish_at_changed
- params = { :embargo_id => self.id }
+ params = { :embargo_id => id }
params[:embargo_extension_id] = extension.id if extension
info_request.log_event('set_embargo', params)
end
@@ -154,7 +154,7 @@ def set_publish_at_from_duration
end
def set_expiring_notification_at
- unless self.expiring_notification_at.present?
+ unless expiring_notification_at.present?
self.expiring_notification_at = calculate_expiring_notification_at
end
end
diff --git a/app/models/alaveteli_pro/request_summary.rb b/app/models/alaveteli_pro/request_summary.rb
index 0c7ed441ef..dd8498d9ad 100644
--- a/app/models/alaveteli_pro/request_summary.rb
+++ b/app/models/alaveteli_pro/request_summary.rb
@@ -41,7 +41,7 @@ def self.category(category_slug)
end
def self.not_category(category_slug)
- summary_ids_to_exclude = self.category(category_slug).pluck(:id)
+ summary_ids_to_exclude = category(category_slug).pluck(:id)
results = includes(:request_summary_categories)
unless summary_ids_to_exclude.blank?
results = results.
@@ -61,7 +61,7 @@ def self.create_or_update_from(request)
request.request_summary.update_from(request)
request.request_summary
else
- self.create_from(request)
+ create_from(request)
end
end
@@ -72,7 +72,7 @@ def update_from(request)
private
def self.create_from(request)
- self.create(attributes_from_request(request))
+ create(attributes_from_request(request))
end
def self.attributes_from_request(request)
diff --git a/app/models/concerns/alaveteli_pro/request_summaries.rb b/app/models/concerns/alaveteli_pro/request_summaries.rb
index 74c74ad33f..daa0e6b1fc 100644
--- a/app/models/concerns/alaveteli_pro/request_summaries.rb
+++ b/app/models/concerns/alaveteli_pro/request_summaries.rb
@@ -14,11 +14,11 @@ module RequestSummaries
# Creates a RequestSummary item for this model on first save, or updates
# the existing one otherwise.
def create_or_update_request_summary
- if self.should_summarise?
+ if should_summarise?
self.request_summary =
AlaveteliPro::RequestSummary.create_or_update_from(self)
- elsif self.should_update_parent_summary?
- parent = self.request_summary_parent
+ elsif should_update_parent_summary?
+ parent = request_summary_parent
parent.create_or_update_request_summary unless parent.blank?
end
end
diff --git a/app/models/concerns/message_prominence.rb b/app/models/concerns/message_prominence.rb
index b54f8a53cf..bdca038d8d 100644
--- a/app/models/concerns/message_prominence.rb
+++ b/app/models/concerns/message_prominence.rb
@@ -3,7 +3,7 @@ module MessageProminence
included do
strip_attributes only: [:prominence_reason]
- validates_inclusion_of :prominence, in: self.prominence_states
+ validates_inclusion_of :prominence, in: prominence_states
end
def indexed_by_search?
diff --git a/app/models/draft_info_request.rb b/app/models/draft_info_request.rb
index bc67e78342..e8b1031add 100644
--- a/app/models/draft_info_request.rb
+++ b/app/models/draft_info_request.rb
@@ -27,12 +27,12 @@ class DraftInfoRequest < ApplicationRecord
# @see RequestSummaries#request_summary_body
def request_summary_body
- self.body
+ body
end
# @see RequestSummaries#request_summary_public_body_names
def request_summary_public_body_names
- self.public_body.name unless self.public_body.blank?
+ public_body.name unless public_body.blank?
end
# @see RequestSummaries#request_summary_categories
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index d9586628e7..d4b74a2537 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -79,7 +79,7 @@ def body(tries: 0, delay: 1)
raise if tries > BODY_MAX_TRIES
sleep [delay, BODY_MAX_DELAY].min
- self.incoming_message.parse_raw_email!(true)
+ incoming_message.parse_raw_email!(true)
reload
body(tries: tries + 1, delay: delay * 2)
@@ -188,7 +188,7 @@ def old_display_filename
# make another old_display_filename see above
def display_filename
filename = self.filename
- if !self.incoming_message.nil?
+ if !incoming_message.nil?
filename = incoming_message.info_request.apply_censor_rules_to_text(filename)
end
# Sometimes filenames have e.g. %20 in - no point butchering that
@@ -210,11 +210,11 @@ def display_filename
def ensure_filename!
- if self.filename.blank?
- calc_ext = AlaveteliFileTypes.mimetype_to_extension(self.content_type)
+ if filename.blank?
+ calc_ext = AlaveteliFileTypes.mimetype_to_extension(content_type)
calc_ext = "bin" if !calc_ext
- if !self.within_rfc822_subject.nil?
- computed = self.within_rfc822_subject + "." + calc_ext
+ if !within_rfc822_subject.nil?
+ computed = within_rfc822_subject + "." + calc_ext
else
computed = "attachment." + calc_ext
end
@@ -224,7 +224,7 @@ def ensure_filename!
def filename=(filename)
filename.try(:delete!, "\0")
- calc_ext = AlaveteliFileTypes.mimetype_to_extension(self.content_type)
+ calc_ext = AlaveteliFileTypes.mimetype_to_extension(content_type)
# Put right extension on if missing
if !filename.nil? && !filename.match(/\.#{calc_ext}$/) && calc_ext
computed = filename + "." + calc_ext
@@ -236,7 +236,7 @@ def filename=(filename)
# Size to show next to the download link for the attachment
def update_display_size!
- s = self.body.size
+ s = body.size
if s > 1024 * 1024
self.display_size = sprintf("%.1f", s.to_f / 1024 / 1024) + 'M'
@@ -289,7 +289,7 @@ def name_of_content_type
'application/vnd.ms-excel' => "Excel spreadsheet",
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "Excel spreadsheet",
- }[self.content_type]
+ }[content_type]
end
# For "View as HTML" of attachment
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index d7e5a8d14e..8b2aff6bc4 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -50,7 +50,7 @@ def save!
end
def holidays_attributes=(incoming_data)
- incoming_data.each { |offset, incoming| self.holidays << Holiday.new(incoming) }
+ incoming_data.each { |offset, incoming| holidays << Holiday.new(incoming) }
end
def holidays
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index dd6b19fb81..629b5f6d9d 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -95,8 +95,8 @@ def parse_raw_email!(force = nil)
# The following fields may be absent; we treat them as cached
# values in case we want to regenerate them (due to mail
# parsing bugs, etc).
- raise "Incoming message id=#{id} has no raw_email" if self.raw_email.nil?
- if (!force.nil? || self.last_parsed.nil?)
+ raise "Incoming message id=#{id} has no raw_email" if raw_email.nil?
+ if (!force.nil? || last_parsed.nil?)
ActiveRecord::Base.transaction do
extract_attachments
self.sent_at = raw_email.date || created_at
@@ -106,7 +106,7 @@ def parse_raw_email!(force = nil)
self.from_email_domain = raw_email.from_email_domain || ''
self.valid_to_reply_to = raw_email.valid_to_reply_to?
self.last_parsed = Time.zone.now
- self.save!
+ save!
end
end
end
@@ -228,8 +228,8 @@ def apply_masks(text, content_type)
# Lotus notes quoting yeuch!
def remove_lotus_quoting(text, replacement = "FOLDED_QUOTED_SECTION")
text = text.dup
- return text if self.info_request.user_name.nil?
- name = Regexp.escape(self.info_request.user_name)
+ return text if info_request.user_name.nil?
+ name = Regexp.escape(info_request.user_name)
# To end of message sections
text.gsub!(/^\s?#{name}[^\n]+\n([^\n]+\n)?\s?Sent by:[^\n]+\n.*/im, "\n\n" + replacement)
@@ -329,14 +329,14 @@ def clear_in_database_caches!
self.cached_attachment_text_clipped = nil
self.cached_main_body_text_unfolded = nil
self.cached_main_body_text_folded = nil
- self.save!
+ save!
end
# Internal function to cache two sorts of main body text.
# Cached as loading raw_email can be quite huge, and need this for just
# search results
def _cache_main_body_text
- text = self.get_main_body_text_internal
+ text = get_main_body_text_internal
# Strip the uudecode parts from main text
# - this also effectively does a .dup as well, so text mods don't alter original
text = text.split(/^begin.+^`\n^end\n/m).join(" ")
@@ -349,24 +349,24 @@ def _cache_main_body_text
text = apply_masks(text, 'text/html')
# Remove existing quoted sections
- folded_quoted_text = self.remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION')
+ folded_quoted_text = remove_lotus_quoting(text, 'FOLDED_QUOTED_SECTION')
folded_quoted_text = IncomingMessage.remove_quoted_sections(folded_quoted_text, "FOLDED_QUOTED_SECTION")
self.cached_main_body_text_unfolded = text.delete("\0")
self.cached_main_body_text_folded = folded_quoted_text.delete("\0")
- self.save!
+ save!
end
# Returns body text from main text part of email, converted to UTF-8, with uudecode removed,
# emails and privacy sensitive things remove, censored, and folded to remove excess quoted text
# (marked with FOLDED_QUOTED_SECTION)
# TODO: returns a .dup of the text, so calling functions can in place modify it
def get_main_body_text_folded
- self._cache_main_body_text if self.cached_main_body_text_folded.nil?
- return self.cached_main_body_text_folded
+ _cache_main_body_text if cached_main_body_text_folded.nil?
+ return cached_main_body_text_folded
end
def get_main_body_text_unfolded
- self._cache_main_body_text if self.cached_main_body_text_unfolded.nil?
- return self.cached_main_body_text_unfolded
+ _cache_main_body_text if cached_main_body_text_unfolded.nil?
+ return cached_main_body_text_unfolded
end
# Returns body text from main text part of email, converted to UTF-8
def get_main_body_text_internal
@@ -411,7 +411,7 @@ def _convert_part_body_to_text(part)
# from a set of foi_attachments. If the leaves parameter is empty or not
# supplied, uses its own foi_attachments.
def get_main_body_text_part(leaves=[])
- leaves = self.foi_attachments if leaves.empty?
+ leaves = foi_attachments if leaves.empty?
# Find first part which is text/plain or text/html
# (We have to include HTML, as increasingly there are mail clients that
@@ -477,7 +477,7 @@ def get_attachments_for_display
# return what user would consider attachments, i.e. not the main body
main_part = get_main_body_text_part
attachments = []
- for attachment in self.foi_attachments
+ for attachment in foi_attachments
attachments << attachment if attachment != main_part
end
return attachments
@@ -549,13 +549,13 @@ def get_body_for_html_display(collapse_quoted_sections = true)
text.strip!
# if there is nothing but quoted stuff, then show the subject
if text == "FOLDED_QUOTED_SECTION"
- text = "[Subject only] " + CGI.escapeHTML(self.subject || '') + text
+ text = "[Subject only] " + CGI.escapeHTML(subject || '') + text
end
# and display link for quoted stuff
- text = text.gsub(/FOLDED_QUOTED_SECTION/, "\n\n" + ''+_("show quoted sections")+'' + "\n\n")
+ text = text.gsub(/FOLDED_QUOTED_SECTION/, "\n\n" + ''+_("show quoted sections")+'' + "\n\n")
else
if folded_quoted_text.include?('FOLDED_QUOTED_SECTION')
- text = text + "\n\n" + ''+_("hide quoted sections")+''
+ text = text + "\n\n" + ''+_("hide quoted sections")+''
end
end
text.strip!
@@ -581,14 +581,14 @@ def get_body_for_quoting
# Returns text version of attachment text
def get_attachment_text_full
- text = self._get_attachment_text_internal
+ text = _get_attachment_text_internal
text = apply_masks(text, 'text/html')
# This can be useful for memory debugging
#STDOUT.puts 'xxx '+ MySociety::DebugHelpers::allocated_string_size_around_gc
# Save clipped version for snippets
- if self.cached_attachment_text_clipped.nil?
+ if cached_attachment_text_clipped.nil?
clipped = text.mb_chars[0..MAX_ATTACHMENT_TEXT_CLIPPED].delete("\0")
self.cached_attachment_text_clipped = clipped
save!
@@ -599,18 +599,18 @@ def get_attachment_text_full
# Returns a version reduced to a sensible maximum size - this
# is for performance reasons when showing snippets in search results.
def get_attachment_text_clipped
- if self.cached_attachment_text_clipped.nil?
+ if cached_attachment_text_clipped.nil?
# As side effect, get_attachment_text_full makes snippet text
- attachment_text = self.get_attachment_text_full
- raise "internal error" if self.cached_attachment_text_clipped.nil?
+ attachment_text = get_attachment_text_full
+ raise "internal error" if cached_attachment_text_clipped.nil?
end
- return self.cached_attachment_text_clipped
+ return cached_attachment_text_clipped
end
def _extract_text
# Extract text from each attachment
- self.get_attachments_for_display.reduce('') { |memo, attachment|
+ get_attachments_for_display.reduce('') { |memo, attachment|
return memo if Ability.guest.cannot?(:read, attachment)
memo += MailHandler.get_attachment_text_one_file(attachment.content_type,
@@ -634,7 +634,7 @@ def get_text_for_indexing_clipped
# Has message arrived "recently"?
def recently_arrived
- (Time.zone.now - self.created_at) <= 3.days
+ (Time.zone.now - created_at) <= 3.days
end
# Search all info requests for
@@ -658,7 +658,7 @@ def self.find_all_unknown_mime_types
# the normal extension for known mime type, otherwise uses other extensions.
def get_present_file_extensions
ret = {}
- for attachment in self.get_attachments_for_display
+ for attachment in get_attachments_for_display
ext = AlaveteliFileTypes.mimetype_to_extension(attachment.content_type)
if ext.nil? && !attachment.filename.nil?
ext = File.extname(attachment.filename).gsub(/^[.]/, "")
diff --git a/app/models/info_request/state/transitions.rb b/app/models/info_request/state/transitions.rb
index e49a9fef83..9efd6a1acf 100644
--- a/app/models/info_request/state/transitions.rb
+++ b/app/models/info_request/state/transitions.rb
@@ -52,7 +52,7 @@ def self.transition_label(to_state, opts = {})
def self.labelled_hash(states, opts = {})
hash = {}
states.each do |state|
- hash[state] = self.transition_label(state, opts)
+ hash[state] = transition_label(state, opts)
end
hash
end
diff --git a/app/models/info_request_batch.rb b/app/models/info_request_batch.rb
index 528be63668..0a8d08431f 100644
--- a/app/models/info_request_batch.rb
+++ b/app/models/info_request_batch.rb
@@ -91,7 +91,7 @@ def self.find_existing(user, title, body, public_body_ids, id: nil)
# Create a new batch from the supplied draft version
def self.from_draft(draft)
- self.new(:user => draft.user,
+ new(:user => draft.user,
:public_bodies => draft.public_bodies,
:title => draft.title,
:body => draft.body,
@@ -162,17 +162,17 @@ def sent?
# Build an InfoRequest object which is an example of this batch.
def example_request
- public_body = self.public_bodies.first
+ public_body = public_bodies.first
body = OutgoingMessage.fill_in_salutation(self.body, public_body)
info_request = InfoRequest.build_from_attributes(
- { :title => self.title, :public_body => public_body },
+ { :title => title, :public_body => public_body },
{ :body => body },
- self.user
+ user
)
- unless self.embargo_duration.blank?
+ unless embargo_duration.blank?
info_request.embargo = AlaveteliPro::Embargo.new(
:info_request => info_request,
- :embargo_duration => self.embargo_duration
+ :embargo_duration => embargo_duration
)
end
info_request
@@ -223,41 +223,41 @@ def request_phases_summary
{
:in_progress => {
:label => _('In progress'),
- :count => self.info_requests.in_progress.count
+ :count => info_requests.in_progress.count
},
:action_needed => {
:label => _('Action needed'),
- :count => self.info_requests.action_needed.count
+ :count => info_requests.action_needed.count
},
:complete => {
:label => _('Complete'),
- :count => self.info_requests.complete.count
+ :count => info_requests.complete.count
},
:other => {
:label => _('Other'),
- :count => self.info_requests.other.count
+ :count => info_requests.other.count
}
}
end
# @see RequestSummaries#request_summary_body
def request_summary_body
- self.body
+ body
end
# @see RequestSummaries#request_summary_public_body_names
def request_summary_public_body_names
- self.public_bodies.pluck(:name).join(" ")
+ public_bodies.pluck(:name).join(" ")
end
# @see RequestSummaries#request_summary_categories
def request_summary_categories
categories = []
- if self.embargo_expiring?
+ if embargo_expiring?
categories << AlaveteliPro::RequestSummaryCategory.embargo_expiring
end
- if self.sent_at
- phase_slugs = self.request_phases.map(&:to_s).uniq
+ if sent_at
+ phase_slugs = request_phases.map(&:to_s).uniq
phases = AlaveteliPro::RequestSummaryCategory.where(slug: phase_slugs)
categories.concat phases
else
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 73fcad12ef..9f9e0e1903 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -89,7 +89,7 @@ class InfoRequestEvent < ApplicationRecord
end
after_create :update_request, :if => :response?
- after_commit -> { self.info_request.create_or_update_request_summary },
+ after_commit -> { info_request.create_or_update_request_summary },
:on => [:create]
validates_inclusion_of :event_type, :in => EVENT_TYPES
@@ -514,7 +514,7 @@ def previous_events(opts = {})
events = self.
class.
where(:info_request_id => info_request_id).
- where('created_at < ?', self.created_at).
+ where('created_at < ?', created_at).
order(order)
end
@@ -524,7 +524,7 @@ def subsequent_events(opts = {})
events = self.
class.
where(:info_request_id => info_request_id).
- where('created_at > ?', self.created_at).
+ where('created_at > ?', created_at).
order(order)
end
diff --git a/app/models/notification.rb b/app/models/notification.rb
index dc3cc7d024..817287df04 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -32,9 +32,9 @@ class Notification < ApplicationRecord
# Set the send_at timestamp based on the chosen frequency
def calculate_send_after
- unless self.persisted? || self.send_after.present?
- if self.daily?
- self.send_after = self.user.next_daily_summary_time
+ unless persisted? || send_after.present?
+ if daily?
+ self.send_after = user.next_daily_summary_time
else
self.send_after = Time.zone.now
end
@@ -88,14 +88,14 @@ def expire_embargo_expired
end
def overdue_expired
- info_request = self.info_request_event.info_request
+ info_request = info_request_event.info_request
user = info_request.user
status = info_request.calculate_status
!(user.can_make_followup? && status == 'waiting_response_overdue')
end
def very_overdue_expired
- info_request = self.info_request_event.info_request
+ info_request = info_request_event.info_request
user = info_request.user
status = info_request.calculate_status
!(user.can_make_followup? && status == 'waiting_response_very_overdue')
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 6f42118031..5ec9905c7e 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -71,7 +71,7 @@ class OutgoingMessage < ApplicationRecord
admin_columns include: [:to, :from, :subject]
- self.default_url_options[:host] = AlaveteliConfiguration.domain
+ default_url_options[:host] = AlaveteliConfiguration.domain
scope :followup, -> { where(message_type: 'followup') }
scope :is_searchable, -> { where(prominence: 'normal') }
@@ -358,7 +358,7 @@ def get_text_for_indexing(strip_salutation = true, opts = {})
end
# Remove email addresses from display/index etc.
- self.remove_privacy_sensitive_things!(text)
+ remove_privacy_sensitive_things!(text)
text
end
@@ -366,7 +366,7 @@ def get_text_for_indexing(strip_salutation = true, opts = {})
# Return body for display as HTML
def get_body_for_html_display
text = body.strip
- self.remove_privacy_sensitive_things!(text)
+ remove_privacy_sensitive_things!(text)
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text, { :contract => 1, :nofollow => true })
text.gsub!(/\[(email address|mobile number)\]/, '[\1]')
diff --git a/app/models/outgoing_message/template/initial_request.rb b/app/models/outgoing_message/template/initial_request.rb
index 48380f0a0d..eec008f877 100644
--- a/app/models/outgoing_message/template/initial_request.rb
+++ b/app/models/outgoing_message/template/initial_request.rb
@@ -8,7 +8,7 @@ def body(opts = {})
def self.placeholder_salutation
_('Dear {{placeholder_body_name}},',
- placeholder_body_name: self.placeholder_body_name)
+ placeholder_body_name: placeholder_body_name)
end
# Separate so that it can be referred to directly elsewhere (e.g. to
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index ba4621f17c..fb225c02ca 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -42,7 +42,7 @@ def convert_image
# convert to PNG if it isn't, and to right size
altered = false
if image.type != 'PNG'
- self.image.format('PNG')
+ image.format('PNG')
altered = true
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 6dfa05bad8..3a32a6750f 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -151,11 +151,11 @@ class Translation
strip_attributes allow_empty: true, only: %i[request_email]
end
- self.non_versioned_columns << 'created_at' << 'updated_at' << 'first_letter' << 'api_key'
- self.non_versioned_columns << 'info_requests_count' << 'info_requests_successful_count'
- self.non_versioned_columns << 'info_requests_count' << 'info_requests_visible_classified_count'
- self.non_versioned_columns << 'info_requests_not_held_count' << 'info_requests_overdue'
- self.non_versioned_columns << 'info_requests_overdue_count' << 'info_requests_visible_count'
+ non_versioned_columns << 'created_at' << 'updated_at' << 'first_letter' << 'api_key'
+ non_versioned_columns << 'info_requests_count' << 'info_requests_successful_count'
+ non_versioned_columns << 'info_requests_count' << 'info_requests_visible_classified_count'
+ non_versioned_columns << 'info_requests_not_held_count' << 'info_requests_overdue'
+ non_versioned_columns << 'info_requests_overdue_count' << 'info_requests_visible_count'
# Cannot be defined directly under `include` statements as this is opening
# the PublicBody::Version class dynamically defined by the
@@ -187,7 +187,7 @@ def copy_translated_attributes
end
def last_edit_comment_for_html_display
- text = self.last_edit_comment.strip
+ text = last_edit_comment.strip
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text)
text = text.gsub(/\n/, ' ')
@@ -206,7 +206,7 @@ def compare(previous = nil, &block)
created_at
updated_at).include?(c.name)
from = previous.send(c.name)
- to = self.send(c.name)
+ to = send(c.name)
memo << { :name => c.name.humanize,
:from => from,
:to => to } if from != to
@@ -938,8 +938,8 @@ def read_attribute_value(name, locale)
def request_email_if_requestable
# Request_email can be blank, meaning we don't have details
- if self.is_requestable?
- unless MySociety::Validate.is_valid_email(self.request_email)
+ if is_requestable?
+ unless MySociety::Validate.is_valid_email(request_email)
errors.add(:request_email,
"Request email doesn't look like a valid email address")
end
diff --git a/app/models/public_body_change_request.rb b/app/models/public_body_change_request.rb
index 785491442f..e9d3a18970 100644
--- a/app/models/public_body_change_request.rb
+++ b/app/models/public_body_change_request.rb
@@ -139,19 +139,19 @@ def default_response_subject
def close!
self.is_open = false
- self.save!
+ save!
end
private
def body_email_format
- unless MySociety::Validate.is_valid_email(self.public_body_email)
+ unless MySociety::Validate.is_valid_email(public_body_email)
errors.add(:public_body_email, _("The authority email doesn't look like a valid address"))
end
end
def user_email_format
- unless MySociety::Validate.is_valid_email(self.user_email)
+ unless MySociety::Validate.is_valid_email(user_email)
errors.add(:user_email, _("Your email doesn't look like a valid address"))
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 9234366c52..6f8b30a0f4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -222,7 +222,7 @@ def self.authenticate_from_form(params, specific_user_login = false)
# Case-insensitively find a user from their email
def self.find_user_by_email(email)
return nil if email.blank?
- self.where('lower(email) = lower(?)', email.strip).first
+ where('lower(email) = lower(?)', email.strip).first
end
# The "internal admin" is a special user for internal use.
@@ -576,14 +576,14 @@ def indexed_by_search?
def notify(info_request_event)
Notification.create(
info_request_event: info_request_event,
- frequency: Notification.frequencies[self.notification_frequency],
+ frequency: Notification.frequencies[notification_frequency],
user: self
)
end
# Return a timestamp for the next time a user should be sent a daily summary
def next_daily_summary_time
- summary_time = Time.zone.now.change(self.daily_summary_time)
+ summary_time = Time.zone.now.change(daily_summary_time)
summary_time += 1.day if summary_time < Time.zone.now
summary_time
end
diff --git a/app/validators/change_email_validator.rb b/app/validators/change_email_validator.rb
index 1efdf53673..58ed734279 100644
--- a/app/validators/change_email_validator.rb
+++ b/app/validators/change_email_validator.rb
@@ -32,7 +32,7 @@ def initialize(attributes = {})
end
def changing_email
- self.user_circumstance == 'change_email'
+ user_circumstance == 'change_email'
end
private
diff --git a/gems/alaveteli_features/lib/alaveteli_features.rb b/gems/alaveteli_features/lib/alaveteli_features.rb
index e578691f58..66c1bbf65f 100644
--- a/gems/alaveteli_features/lib/alaveteli_features.rb
+++ b/gems/alaveteli_features/lib/alaveteli_features.rb
@@ -19,7 +19,7 @@ def self.groups
def self.backend
return @backend if @backend
- if self.tables_exist?
+ if tables_exist?
@backend = Flipper.new(Flipper::Adapters::ActiveRecord.new)
else
if defined?(Rails)
diff --git a/gems/alaveteli_features/lib/alaveteli_features/generators/alaveteli_features/install/install_generator.rb b/gems/alaveteli_features/lib/alaveteli_features/generators/alaveteli_features/install/install_generator.rb
index 9c5db8ac0d..f3461f1e71 100644
--- a/gems/alaveteli_features/lib/alaveteli_features/generators/alaveteli_features/install/install_generator.rb
+++ b/gems/alaveteli_features/lib/alaveteli_features/generators/alaveteli_features/install/install_generator.rb
@@ -5,7 +5,7 @@ class InstallGenerator < Rails::Generators::Base
class_option :migrate, type: :boolean, default: true, banner: 'Run AlaveteliFeatures migrations'
def self.source_paths
- paths = self.superclass.source_paths
+ paths = superclass.source_paths
paths << File.expand_path('../templates', "../../#{__FILE__}")
paths << File.expand_path('../templates', "../#{__FILE__}")
paths << File.expand_path('../templates', __FILE__)
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 34caf8d98a..f84f20556e 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -331,7 +331,7 @@ def initialize_query(options)
sort_by_ascending = options[:sort_by_ascending].nil? ? true : options[:sort_by_ascending]
collapse_by_prefix = options[:collapse_by_prefix] || nil
- ActsAsXapian.enquire.query = self.query
+ ActsAsXapian.enquire.query = query
if sort_by_prefix.nil?
ActsAsXapian.enquire.sort_by_relevance!
@@ -382,14 +382,14 @@ def initialize_query(options)
# Return a description of the query
def description
- self.query.description
+ query.description
end
# Does the query have non-prefixed search terms in it?
def has_normal_search_terms?
ret = false
#x = ''
- for t in self.query.terms
+ for t in query.terms
term = t.term
#x = x + term.to_yaml + term.size.to_s + term[0..0] + "*"
if term.size >= 2 && term[0..0] == 'Z'
@@ -402,7 +402,7 @@ def has_normal_search_terms?
# Estimate total number of results
def matches_estimated
- self.matches.matches_estimated
+ matches.matches_estimated
end
# Return query string with spelling correction
@@ -415,13 +415,13 @@ def spelling_correction
# Return array of models found
def results
# If they've already pulled out the results, just return them.
- return self.cached_results if !self.cached_results.nil?
+ return cached_results if !cached_results.nil?
docs = []
self.runtime += Benchmark::realtime {
# Pull out all the results
- iter = self.matches._begin
- while not iter.equals(self.matches._end)
+ iter = matches._begin
+ while not iter.equals(matches._end)
docs.push({:data => iter.document.data,
:percent => iter.percent,
:weight => iter.weight,
@@ -432,7 +432,7 @@ def results
# Log time taken, excluding database lookups below which will be displayed separately by ActiveRecord
if ActiveRecord::Base.logger
- ActiveRecord::Base.logger.add(Logger::DEBUG, " Xapian query (#{'%.5fs' % self.runtime}) #{self.log_description}")
+ ActiveRecord::Base.logger.add(Logger::DEBUG, " Xapian query (#{'%.5fs' % self.runtime}) #{log_description}")
end
# Look up without too many SQL queries
@@ -499,7 +499,7 @@ def initialize(model_classes, query_string, options = {}, user_query = nil)
model_classes = new_model_classes
# Set things up
- self.initialize_db
+ initialize_db
# Case of a string, searching for a Google-like syntax query
self.query_string = query_string
@@ -516,7 +516,7 @@ def initialize(model_classes, query_string, options = {}, user_query = nil)
self.query = Xapian::Query.new(Xapian::Query::OP_AND, model_query, user_query)
# Call base class constructor
- self.initialize_query(options)
+ initialize_query(options)
end
# Return just normal words in the query i.e. Not operators, ones in
@@ -562,7 +562,7 @@ def words_to_highlight(opts = {})
# Text for lines in log file
def log_description
- "Search: " + self.query_string
+ "Search: " + query_string
end
private
@@ -583,7 +583,7 @@ class Similar < QueryBase
# model_classes - model classes to search within, e.g. [PublicBody, User]
# query_models - list of models you want to find things similar to
def initialize(model_classes, query_models, options = {})
- self.initialize_db
+ initialize_db
self.runtime += Benchmark::realtime {
# Case of an array, searching for models similar to those models in the array
@@ -612,10 +612,10 @@ def initialize(model_classes, query_models, options = {})
self.important_terms = []
iter = eset._begin
while not iter.equals(eset._end)
- self.important_terms.push(iter.term)
+ important_terms.push(iter.term)
iter.next
end
- similar_query = Xapian::Query.new(Xapian::Query::OP_OR, self.important_terms)
+ similar_query = Xapian::Query.new(Xapian::Query::OP_OR, important_terms)
# Exclude original
combined_query = Xapian::Query.new(Xapian::Query::OP_AND_NOT, similar_query, input_models_query)
@@ -625,12 +625,12 @@ def initialize(model_classes, query_models, options = {})
}
# Call base class constructor
- self.initialize_query(options)
+ initialize_query(options)
end
# Text for lines in log file
def log_description
- "Similar: " + self.query_models.to_s
+ "Similar: " + query_models.to_s
end
end
@@ -944,16 +944,16 @@ def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values
module InstanceMethods
# Used internally
def xapian_document_term
- self.class.to_s + "-" + self.id.to_s
+ self.class.to_s + "-" + id.to_s
end
def xapian_value(field, type = nil, index_translations = false)
- if index_translations && self.respond_to?("translations")
+ if index_translations && respond_to?("translations")
if type == :date or type == :boolean
value = single_xapian_value(field, type = type)
else
values = []
- for locale in self.translations.map { |x| x.locale }
+ for locale in translations.map { |x| x.locale }
AlaveteliLocalization.with_locale(locale) do
values << single_xapian_value(field, type=type)
end
@@ -974,7 +974,7 @@ def xapian_value(field, type = nil, index_translations = false)
# Extract value of a field from the model
def single_xapian_value(field, type = nil)
- value = self.send(field.to_sym) || self[field]
+ value = send(field.to_sym) || self[field]
if type == :date
if value.kind_of?(Time)
value.utc.strftime("%Y%m%d")
@@ -1001,12 +1001,12 @@ def xapian_index(terms = true, values = true, texts = true)
if self.class.xapian_options.include?(:if)
if_value = xapian_value(self.class.xapian_options[:if], :boolean)
if not if_value
- self.xapian_destroy
+ xapian_destroy
return
end
end
- existing_query = Xapian::Query.new("I" + self.xapian_document_term)
+ existing_query = Xapian::Query.new("I" + xapian_document_term)
ActsAsXapian.enquire.query = existing_query
match = ActsAsXapian.enquire.mset(0,1,1).matches[0]
@@ -1014,7 +1014,7 @@ def xapian_index(terms = true, values = true, texts = true)
doc = match.document
else
doc = Xapian::Document.new
- doc.data = self.xapian_document_term
+ doc.data = xapian_document_term
doc.add_term("M" + self.class.to_s)
doc.add_term("I" + doc.data)
end
@@ -1022,11 +1022,11 @@ def xapian_index(terms = true, values = true, texts = true)
# 1. Which terms to index? We allow the user to specify particular ones
terms_to_index = []
drop_all_terms = false
- if terms and self.xapian_options[:terms]
- terms_to_index = self.xapian_options[:terms].dup
+ if terms and xapian_options[:terms]
+ terms_to_index = xapian_options[:terms].dup
if terms.is_a?(String)
terms_to_index.reject! { |term| !terms.include?(term[1]) }
- if terms_to_index.length == self.xapian_options[:terms].length
+ if terms_to_index.length == xapian_options[:terms].length
drop_all_terms = true
end
else
@@ -1035,13 +1035,13 @@ def xapian_index(terms = true, values = true, texts = true)
end
# 2. Texts to index? Currently, it's all or nothing
texts_to_index = []
- if texts and self.xapian_options[:texts]
- texts_to_index = self.xapian_options[:texts]
+ if texts and xapian_options[:texts]
+ texts_to_index = xapian_options[:texts]
end
# 3. Values to index? Currently, it's all or nothing
values_to_index = []
- if values and self.xapian_options[:values]
- values_to_index = self.xapian_options[:values]
+ if values and xapian_options[:values]
+ values_to_index = xapian_options[:values]
end
# clear any existing data that we might want to replace
@@ -1104,21 +1104,21 @@ def xapian_index(terms = true, values = true, texts = true)
# Delete record from the Xapian database
def xapian_destroy
- ActsAsXapian.writable_db.delete_document("I" + self.xapian_document_term)
+ ActsAsXapian.writable_db.delete_document("I" + xapian_document_term)
end
# Used to mark changes needed by batch indexer
def xapian_mark_needs_index
- xapian_create_job('update', self.class.base_class.to_s, self.id)
+ xapian_create_job('update', self.class.base_class.to_s, id)
end
def xapian_mark_needs_destroy
- xapian_create_job('destroy', self.class.base_class.to_s, self.id)
+ xapian_create_job('destroy', self.class.base_class.to_s, id)
end
# Allow reindexing to be skipped if a flag is set
def xapian_mark_needs_index_if_reindex
- if (self.respond_to?(:no_xapian_reindex) && self.no_xapian_reindex == true)
+ if (respond_to?(:no_xapian_reindex) && no_xapian_reindex == true)
return true
end
xapian_mark_needs_index
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 98581ee9e1..42b34cc87c 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -17,16 +17,16 @@ class Message
alias_method :old_cc, :cc
def clean_addresses(old_method, val)
- old_result = self.send(old_method, val)
+ old_result = send(old_method, val)
old_result.class == Mail::AddressContainer ? old_result : nil
end
def to(val = nil)
- self.clean_addresses :old_to, val
+ clean_addresses :old_to, val
end
def cc(val = nil)
- self.clean_addresses :old_cc, val
+ clean_addresses :old_cc, val
end
end
diff --git a/lib/mail_handler/reply_handler.rb b/lib/mail_handler/reply_handler.rb
index 5161baebb8..2612977a85 100644
--- a/lib/mail_handler/reply_handler.rb
+++ b/lib/mail_handler/reply_handler.rb
@@ -80,7 +80,7 @@ def self.is_oof?(message)
end
def self.forward_on(raw_message, message = nil)
- forward_to = self.get_forward_to_address(message)
+ forward_to = get_forward_to_address(message)
IO.popen(%Q(/usr/sbin/sendmail -i "#{forward_to}"), 'wb') do |f|
f.write(raw_message);
f.close;
@@ -132,7 +132,7 @@ def self.load_rails
end
def self.record_bounce(email_address, bounce_message)
- self.load_rails
+ load_rails
User.record_bounce_for_email(email_address, bounce_message)
end
end
diff --git a/lib/world_foi_websites.rb b/lib/world_foi_websites.rb
index 9dff21c045..61828eaaae 100644
--- a/lib/world_foi_websites.rb
+++ b/lib/world_foi_websites.rb
@@ -146,7 +146,7 @@ def self.world_foi_websites
end
def self.by_code(code)
- result = self.world_foi_websites.find { |x| x[:country_iso_code].downcase == code.downcase }
+ result = world_foi_websites.find { |x| x[:country_iso_code].downcase == code.downcase }
return result
end
diff --git a/spec/mailers/application_mailer_spec.rb b/spec/mailers/application_mailer_spec.rb
index e615a041dc..9ba567888c 100644
--- a/spec/mailers/application_mailer_spec.rb
+++ b/spec/mailers/application_mailer_spec.rb
@@ -7,7 +7,7 @@
def set_base_views
ApplicationMailer.class_eval do
- @previous_view_paths = self.view_paths.dup
+ @previous_view_paths = view_paths.dup
self.view_paths = [File.join(Rails.root, 'spec', 'fixtures', 'theme_views', 'core')]
end
end
diff --git a/spec/models/customstates.rb b/spec/models/customstates.rb
index 6f2f9045fd..a02c0488f0 100644
--- a/spec/models/customstates.rb
+++ b/spec/models/customstates.rb
@@ -6,20 +6,20 @@ def self.included(base)
# Mixin methods for InfoRequest
def theme_calculate_status
- return 'waiting_classification' if self.awaiting_description
- waiting_response = self.described_state == "waiting_response" || self.described_state == "deadline_extended"
- return self.described_state unless waiting_response
- if self.described_state == 'deadline_extended'
+ return 'waiting_classification' if awaiting_description
+ waiting_response = described_state == "waiting_response" || described_state == "deadline_extended"
+ return described_state unless waiting_response
+ if described_state == 'deadline_extended'
return 'deadline_extended' if
- Time.zone.now.strftime("%Y-%m-%d") < self.date_deadline_extended.strftime("%Y-%m-%d")
+ Time.zone.now.strftime("%Y-%m-%d") < date_deadline_extended.strftime("%Y-%m-%d")
return 'waiting_response_very_overdue' if
- Time.zone.now.strftime("%Y-%m-%d") > Holiday.due_date_from_working_days(self.date_deadline_extended, 15).strftime("%Y-%m-%d")
+ Time.zone.now.strftime("%Y-%m-%d") > Holiday.due_date_from_working_days(date_deadline_extended, 15).strftime("%Y-%m-%d")
return 'waiting_response_overdue'
end
return 'waiting_response_very_overdue' if
- Time.zone.now.strftime("%Y-%m-%d") > self.date_very_overdue_after.strftime("%Y-%m-%d")
+ Time.zone.now.strftime("%Y-%m-%d") > date_very_overdue_after.strftime("%Y-%m-%d")
return 'waiting_response_overdue' if
- Time.zone.now.strftime("%Y-%m-%d") > self.date_response_required_by.strftime("%Y-%m-%d")
+ Time.zone.now.strftime("%Y-%m-%d") > date_response_required_by.strftime("%Y-%m-%d")
return 'waiting_response'
end
@@ -27,7 +27,7 @@ def date_deadline_extended
# TODO: shouldn't this be 15 days after the date the status was
# changed to "deadline extended"? Or perhaps 15 days ater the
# initial request due date?
- return Holiday.due_date_from_working_days(self.date_response_required_by, 15)
+ return Holiday.due_date_from_working_days(date_response_required_by, 15)
end
module ClassMethods
From f612a16917b803f1c553e7a8f0524de4a41d8311 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Feb 2023 04:02:02 +0000
Subject: [PATCH 074/289] Bump rolify from 5.3.0 to 6.0.1
Bumps [rolify](https://github.com/RolifyCommunity/rolify) from 5.3.0 to 6.0.1.
- [Release notes](https://github.com/RolifyCommunity/rolify/releases)
- [Changelog](https://github.com/RolifyCommunity/rolify/blob/master/CHANGELOG.rdoc)
- [Commits](https://github.com/RolifyCommunity/rolify/compare/v5.3.0...v6.0.1)
---
updated-dependencies:
- dependency-name: rolify
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index cc36002b61..f4e5dfc0c6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -111,7 +111,7 @@ gem 'rack-utf8_sanitizer', '~> 1.8.0'
gem 'recaptcha', '~> 5.12.3', require: 'recaptcha/rails'
gem 'matrix', '~> 0.4.2'
gem 'mini_magick', '~> 4.12.0'
-gem 'rolify', '~> 5.3.0'
+gem 'rolify', '~> 6.0.1'
gem 'ruby-msg', '~> 1.5.0', :git => 'https://github.com/mysociety/ruby-msg.git', :branch => 'ascii-encoding'
gem 'rubyzip', '~> 2.3.2'
gem 'secure_headers', '~> 6.5.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 8fd1aeed95..2072166534 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -413,7 +413,7 @@ GEM
rack (>= 1.4)
retriable (3.1.2)
rexml (3.2.5)
- rolify (5.3.0)
+ rolify (6.0.1)
rotp (6.2.0)
routing-filter (0.7.0)
actionpack (>= 6.1)
@@ -599,7 +599,7 @@ DEPENDENCIES
rails-controller-testing
rails-i18n (~> 7.0.5)
recaptcha (~> 5.12.3)
- rolify (~> 5.3.0)
+ rolify (~> 6.0.1)
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
From 337f7b9b0894839fe52bfbd12438c56fe898695c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Feb 2023 04:09:59 +0000
Subject: [PATCH 075/289] Bump rubocop-performance from 1.15.2 to 1.16.0
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.15.2 to 1.16.0.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.15.2...v1.16.0)
---
updated-dependencies:
- dependency-name: rubocop-performance
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 8fd1aeed95..aa7c4ea80d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -451,7 +451,7 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
- rubocop-performance (1.15.2)
+ rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.17.4)
From d7233e4b96f69374d12b24d8c70e4ba60343e962 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Feb 2023 04:13:12 +0000
Subject: [PATCH 076/289] Bump mail from 2.8.0.1 to 2.8.1
Bumps [mail](https://github.com/mikel/mail) from 2.8.0.1 to 2.8.1.
- [Release notes](https://github.com/mikel/mail/releases)
- [Changelog](https://github.com/mikel/mail/blob/2.8.1/CHANGELOG.rdoc)
- [Commits](https://github.com/mikel/mail/compare/2.8.0.1...2.8.1)
---
updated-dependencies:
- dependency-name: mail
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index cc36002b61..9e117ce5e4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -101,7 +101,7 @@ gem 'jquery-ui-rails', '~> 6.0.0'
gem 'json', '~> 2.6.2'
gem 'holidays', '~> 8.6.0'
gem 'iso_country_codes', '~> 0.7.8'
-gem 'mail', '~> 2.8.0'
+gem 'mail', '~> 2.8.1'
gem 'maxmind-db', '~> 1.0.0'
gem 'mahoro', '~> 0.5'
gem 'nokogiri', '~> 1.14.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 8fd1aeed95..103b1a0aec 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -293,7 +293,7 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mahoro (0.5)
- mail (2.8.0.1)
+ mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
@@ -579,7 +579,7 @@ DEPENDENCIES
listen (>= 3.0.5, < 3.8.1)
locale (~> 2.1.3)
mahoro (~> 0.5)
- mail (~> 2.8.0)
+ mail (~> 2.8.1)
matrix (~> 0.4.2)
maxmind-db (~> 1.0.0)
mime-types (< 3.0.0)
From 1427b1f96d9ae9c70646102e6c7ad71875ddac73 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Feb 2023 04:17:30 +0000
Subject: [PATCH 077/289] Bump nokogiri from 1.14.0 to 1.14.1
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.14.0 to 1.14.1.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.14.0...v1.14.1)
---
updated-dependencies:
- dependency-name: nokogiri
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Gemfile b/Gemfile
index cc36002b61..7129c7920b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -104,7 +104,7 @@ gem 'iso_country_codes', '~> 0.7.8'
gem 'mail', '~> 2.8.0'
gem 'maxmind-db', '~> 1.0.0'
gem 'mahoro', '~> 0.5'
-gem 'nokogiri', '~> 1.14.0'
+gem 'nokogiri', '~> 1.14.1'
gem 'open4', '~> 1.3.0'
gem 'rack', '~> 2.2.6'
gem 'rack-utf8_sanitizer', '~> 1.8.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 8fd1aeed95..cd11d51f78 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -331,16 +331,16 @@ GEM
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
nio4r (2.5.8)
- nokogiri (1.14.0)
+ nokogiri (1.14.1)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
- nokogiri (1.14.0-aarch64-linux)
+ nokogiri (1.14.1-aarch64-linux)
racc (~> 1.4)
- nokogiri (1.14.0-arm64-darwin)
+ nokogiri (1.14.1-arm64-darwin)
racc (~> 1.4)
- nokogiri (1.14.0-x86_64-darwin)
+ nokogiri (1.14.1-x86_64-darwin)
racc (~> 1.4)
- nokogiri (1.14.0-x86_64-linux)
+ nokogiri (1.14.1-x86_64-linux)
racc (~> 1.4)
oink (0.10.1)
activerecord
@@ -588,7 +588,7 @@ DEPENDENCIES
money (~> 6.16.0)
net-ssh (~> 7.0.1)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
- nokogiri (~> 1.14.0)
+ nokogiri (~> 1.14.1)
oink (~> 0.10.1)
open4 (~> 1.3.0)
pg (~> 1.4.5)
From c35ec06d646f07f489ec8b76939260de86be9032 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Feb 2023 09:38:56 +0000
Subject: [PATCH 078/289] Add rubocop flags to display useful information
- Display cop names in offense messages.
- Display extra details in offense messages.
- Display style guide URLs in offense messages.
---
.github/workflows/rubocop.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml
index 4707f2017e..07e47da243 100644
--- a/.github/workflows/rubocop.yml
+++ b/.github/workflows/rubocop.yml
@@ -20,6 +20,7 @@ jobs:
uses: reviewdog/action-rubocop@v1
with:
github_token: ${{ secrets.github_token }}
+ rubocop_flags: -DES
rubocop_version: gemfile
rubocop_extensions: rubocop-performance:gemfile rubocop-rails:gemfile
level: warning
From aa866268f7f3b3d928befd273a1e31cc1f7f9771 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Feb 2023 09:49:21 +0000
Subject: [PATCH 079/289] Remove PublicBody::Version#notes column
This column has already been removed on `PublicBody` and replaced with a
separate `Note` model.
---
app/models/public_body.rb | 2 +-
.../20230209094128_remove_public_body_version_notes.rb | 5 +++++
spec/factories/public_bodies.rb | 2 +-
spec/fixtures/public_bodies.yml | 2 +-
spec/fixtures/public_body_versions.yml | 6 ------
spec/models/public_body_spec.rb | 2 +-
6 files changed, 9 insertions(+), 10 deletions(-)
create mode 100644 db/migrate/20230209094128_remove_public_body_version_notes.rb
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 3a32a6750f..eb752f567d 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220928093559
+# Schema version: 20230209094128
#
# Table name: public_bodies
#
diff --git a/db/migrate/20230209094128_remove_public_body_version_notes.rb b/db/migrate/20230209094128_remove_public_body_version_notes.rb
new file mode 100644
index 0000000000..b99dba1c09
--- /dev/null
+++ b/db/migrate/20230209094128_remove_public_body_version_notes.rb
@@ -0,0 +1,5 @@
+class RemovePublicBodyVersionNotes < ActiveRecord::Migration[7.0]
+ def change
+ remove_column :public_body_versions, :notes, :text
+ end
+end
diff --git a/spec/factories/public_bodies.rb b/spec/factories/public_bodies.rb
index 0f7dd29acb..4bfcd433fd 100644
--- a/spec/factories/public_bodies.rb
+++ b/spec/factories/public_bodies.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220928093559
+# Schema version: 20230209094128
#
# Table name: public_bodies
#
diff --git a/spec/fixtures/public_bodies.yml b/spec/fixtures/public_bodies.yml
index 25a2752d05..de6edb1960 100644
--- a/spec/fixtures/public_bodies.yml
+++ b/spec/fixtures/public_bodies.yml
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220928093559
+# Schema version: 20230209094128
#
# Table name: public_bodies
#
diff --git a/spec/fixtures/public_body_versions.yml b/spec/fixtures/public_body_versions.yml
index f5ede78207..e1264430b0 100644
--- a/spec/fixtures/public_body_versions.yml
+++ b/spec/fixtures/public_body_versions.yml
@@ -19,7 +19,6 @@ humpadink_public_body_update:
request_email: humpadink-requests@localhost
public_body_id: "3"
id: "6"
- notes: "An albatross told me!!!"
version: "2"
last_edit_editor: "francis"
short_name: DfH
@@ -33,7 +32,6 @@ geraldine_public_body_initial:
request_email: geraldine-requests@localhost
public_body_id: "2"
id: 1
- notes: "-"
version: "1"
last_edit_editor: "mark"
short_name: TGQ
@@ -47,7 +45,6 @@ forlorn_public_body_initial:
request_email: forlorn-requests@localhost
public_body_id: "4"
id: 2
- notes: A very lonely public body that no one has corresponded with
version: "1"
last_edit_editor: "robin"
short_name: DoL
@@ -61,7 +58,6 @@ silly_walks_public_body_intitial:
request_email: silly-walks-requests@localhost
public_body_id: 5
id: 3
- notes: You know the one.
version: 1
last_edit_editor: robin
short_name: MSW
@@ -75,7 +71,6 @@ sensible_walks_public_body_initial:
request_email: sensible-walks-requests@localhost
public_body_id: 6
id: 4
- notes: I bet you’ve never heard of it.
version: 1
last_edit_editor: robin
short_name: SenseWalk
@@ -89,7 +84,6 @@ other_public_body_initial:
request_email: other@localhost
public_body_id: 7
id: 7
- notes: More notes
version: 1
last_edit_editor: louise
short_name: Another Public Body
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index af1d3b3e5c..72794056c8 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220928093559
+# Schema version: 20230209094128
#
# Table name: public_bodies
#
From 4ec03ffe4bc33f4a02cd5309ebebe13d3bd56b11 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Feb 2023 12:50:56 +0000
Subject: [PATCH 080/289] Revert "Add support for Mail v2.8.x"
This reverts commit 5bbdd57633ce8e8d969483613f5937ae2e04f5d2.
---
config/environments/production.rb | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 80ca3e4c5b..8962c5835b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -118,8 +118,7 @@
config.action_mailer.delivery_method = AlaveteliConfiguration.production_mailer_delivery_method.to_sym
- case AlaveteliConfiguration.production_mailer_delivery_method.to_sym
- when :smtp
+ if AlaveteliConfiguration.production_mailer_delivery_method.to_sym == :smtp
config.action_mailer.smtp_settings = {
:address => AlaveteliConfiguration.smtp_mailer_address,
:port => AlaveteliConfiguration.smtp_mailer_port,
@@ -129,11 +128,6 @@
:authentication => AlaveteliConfiguration.smtp_mailer_authentication,
:enable_starttls_auto => AlaveteliConfiguration.smtp_mailer_enable_starttls_auto
}
- when :sendmail
- config.action_mailer.sendmail_settings = {
- location: '/usr/sbin/sendmail',
- arguments: %w[-i]
- }
end
exception_notifier_prefix = '[ERROR] '
From ebf592a2936c6e43c79ae39346e3be5107ef57ec Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Feb 2023 13:25:38 +0000
Subject: [PATCH 081/289] Update supported Rubies README link
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index bb044984fc..455a6b5088 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ see [the project website](http://alaveteli.org) for instructions on installing A
## Compatibility
-Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platforms](https://github.com/mysociety/alaveteli/blob/develop/.github/workflows/ci.yml#L15)
+Every Alaveteli commit is tested by GitHub Actions on the [following Ruby platforms](https://github.com/mysociety/alaveteli/blob/develop/.github/workflows/ci.yml#L27-L29)
* ruby-3.0
* ruby-3.1
From 9c9dff5fa9eecd90fec829c81b61f55dd5382898 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 13 Feb 2023 10:09:37 +0000
Subject: [PATCH 082/289] Update Phusion Passenger config
Updated for latest version or Passenger/Apache.
---
config/httpd.conf-example | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/config/httpd.conf-example b/config/httpd.conf-example
index d545c419b1..8701159eea 100644
--- a/config/httpd.conf-example
+++ b/config/httpd.conf-example
@@ -23,7 +23,6 @@
# App server configuration
PassengerAppRoot /var/www/alaveteli
- PassengerResolveSymlinksInDocumentRoot on
# Uncomment the following line if you want to run Alaveteli
# with the ruby set by rbenv
@@ -149,7 +148,7 @@
# Include optional configuration
- Include vhost.d/alaveteli/*.conf
+ IncludeOptional vhost.d/alaveteli/*.conf
From 9ff558560f95a56df11bd87b0f79b88116216600 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 13 Feb 2023 10:12:32 +0000
Subject: [PATCH 083/289] Remove unused CI conditionals
GitHub Actions doesn't run `script/rails-post-deploy` so this is
unneeded.
---
script/rails-deploy-before-down | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/script/rails-deploy-before-down b/script/rails-deploy-before-down
index d7a68a21f7..ada0f9411e 100755
--- a/script/rails-deploy-before-down
+++ b/script/rails-deploy-before-down
@@ -100,10 +100,7 @@ BUNDLE_PATH="${OPTION_BUNDLE_PATH:-vendor/bundle}"
bundle_install_options="--path $BUNDLE_PATH"
-if [ "$CI" = "true" ]
-then
- bundle_install_options="$bundle_install_options --deployment"
-elif [ "$STAGING_SITE" = "0" ]
+if [ "$STAGING_SITE" = "0" ]
then
bundle_install_options="$bundle_install_options --without development debug test --deployment"
else
@@ -117,10 +114,7 @@ bundle exec rake submodules:check
bundle exec rake themes:install
-if ! [ "$CI" = "true" ]
-then
- bundle exec rake geoip:download_data
-fi
+bundle exec rake geoip:download_data
if [ "$STAGING_SITE" = "0" ]
then
From 99c3dbe98bdd480efd8fecaab54ac09f937b0d0f Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 13 Feb 2023 10:52:11 +0000
Subject: [PATCH 084/289] Remove configuration of Ruby 2.7 option on install
Not needed now we've dropped support for Ruby 2.7.
---
script/install-as-user | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/script/install-as-user b/script/install-as-user
index 3d2d1ae4c0..eb72f8cf7b 100755
--- a/script/install-as-user
+++ b/script/install-as-user
@@ -110,24 +110,6 @@ if [ $USE_RBENV = true ]; then
gem install bundler
fi
-# Prevent extreme deprecation warnings on Ruby 2.7.0 provided by Ubuntu Focal
-# (Fixed in Ruby 2.7.2). ensure_line_present is not available here, so just do
-# this as it's pretty temporary.
-RUBY27_OPT_COMMENT="Set Ruby options for Ruby 2.7"
-RUBY27_OPT_START="# START $RUBY27_OPT_COMMENT"
-RUBY27_OPT_END="# END $RUBY27_OPT_COMMENT"
-if ruby -v | grep "2.7.[01]" > /dev/null && ! grep "$RUBY27_OPT_START" "$BASHRC" > /dev/null
-then
- cat >>$BASHRC < /dev/null; then
- export RUBYOPT='-W:no-deprecated -W:no-experimental'
-fi
-$RUBY27_OPT_END
-EOF
-fi
-
# Speed up the installation of gems:
echo 'gem: --no-ri --no-rdoc' > "$HOME/.gemrc"
From 303c14c1b7fb58776316d84c21c2db8aa6e4d48a Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 23 Jan 2023 11:41:15 +0000
Subject: [PATCH 085/289] Refactor: FormatString
---
app/models/mail_server_log/delivery_status.rb | 2 +-
app/models/mail_server_log/exim_line.rb | 2 +-
app/models/mail_server_log/postfix_line.rb | 2 +-
spec/models/mail_server_log/delivery_status_spec.rb | 2 +-
spec/models/mail_server_log/exim_line_spec.rb | 2 +-
spec/models/mail_server_log/postfix_line_spec.rb | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/models/mail_server_log/delivery_status.rb b/app/models/mail_server_log/delivery_status.rb
index 3da8638d4d..b3ac1ed8fe 100644
--- a/app/models/mail_server_log/delivery_status.rb
+++ b/app/models/mail_server_log/delivery_status.rb
@@ -58,7 +58,7 @@ def capitalize
end
def inspect
- obj_id = "0x00%x" % (object_id << 1)
+ obj_id = format("0x00%x", (object_id << 1))
%Q(#<#{self.class}:#{obj_id} @status=:#{ status }>)
end
diff --git a/app/models/mail_server_log/exim_line.rb b/app/models/mail_server_log/exim_line.rb
index 46d8e93b21..bf54e23a01 100644
--- a/app/models/mail_server_log/exim_line.rb
+++ b/app/models/mail_server_log/exim_line.rb
@@ -68,7 +68,7 @@ def to_s
end
def inspect
- %Q(#<#{self.class}:#{"0x00%x" % (object_id << 1)} @line="#{ line }">)
+ %Q(#<#{self.class}:#{format("0x00%x", (object_id << 1))} @line="#{ line }">)
end
private
diff --git a/app/models/mail_server_log/postfix_line.rb b/app/models/mail_server_log/postfix_line.rb
index 9aa0beb4c2..3c4d0625f7 100644
--- a/app/models/mail_server_log/postfix_line.rb
+++ b/app/models/mail_server_log/postfix_line.rb
@@ -55,7 +55,7 @@ def to_s
end
def inspect
- %Q(#<#{self.class}:#{"0x00%x" % (object_id << 1)} @line="#{ line }">)
+ %Q(#<#{self.class}:#{format("0x00%x", (object_id << 1))} @line="#{ line }">)
end
private
diff --git a/spec/models/mail_server_log/delivery_status_spec.rb b/spec/models/mail_server_log/delivery_status_spec.rb
index e2e81abdea..6f10924724 100644
--- a/spec/models/mail_server_log/delivery_status_spec.rb
+++ b/spec/models/mail_server_log/delivery_status_spec.rb
@@ -56,7 +56,7 @@
it 'returns the default format' do
subject = described_class.new(:delivered)
- obj_id = "0x00%x" % (subject.object_id << 1)
+ obj_id = format("0x00%x", (subject.object_id << 1))
expected =
%Q(#<#{described_class}:#{obj_id} @status=:delivered>)
expect(subject.inspect).to eq(expected)
diff --git a/spec/models/mail_server_log/exim_line_spec.rb b/spec/models/mail_server_log/exim_line_spec.rb
index fac905057b..290805b5ae 100644
--- a/spec/models/mail_server_log/exim_line_spec.rb
+++ b/spec/models/mail_server_log/exim_line_spec.rb
@@ -41,7 +41,7 @@
it 'returns the default format' do
subject = described_class.new('log line')
- obj_id = "0x00%x" % (subject.object_id << 1)
+ obj_id = format("0x00%x", (subject.object_id << 1))
expected =
%Q(#<#{described_class}:#{obj_id} @line="log line">)
expect(subject.inspect).to eq(expected)
diff --git a/spec/models/mail_server_log/postfix_line_spec.rb b/spec/models/mail_server_log/postfix_line_spec.rb
index 51f9930f66..63cd2654cc 100644
--- a/spec/models/mail_server_log/postfix_line_spec.rb
+++ b/spec/models/mail_server_log/postfix_line_spec.rb
@@ -23,7 +23,7 @@
it 'returns the default format' do
subject = described_class.new('log line')
- obj_id = "0x00%x" % (subject.object_id << 1)
+ obj_id = format("0x00%x", (subject.object_id << 1))
expected =
%Q(#<#{described_class}:#{obj_id} @line="log line">)
expect(subject.inspect).to eq(expected)
From 297315da47de2bb4c1bb83151ba314c6d6d915b6 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 23 Jan 2023 13:23:03 +0000
Subject: [PATCH 086/289] Refactor: FormatString
---
lib/acts_as_xapian/acts_as_xapian.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index f84f20556e..73b3fd4a31 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -432,7 +432,7 @@ def results
# Log time taken, excluding database lookups below which will be displayed separately by ActiveRecord
if ActiveRecord::Base.logger
- ActiveRecord::Base.logger.add(Logger::DEBUG, " Xapian query (#{'%.5fs' % self.runtime}) #{log_description}")
+ ActiveRecord::Base.logger.add(Logger::DEBUG, format(" Xapian query (%.5fs) %s", self.runtime, self.log_description))
end
# Look up without too many SQL queries
From 1cfdb47c87c5943c99718dede2fc52dfca21ebc4 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Feb 2023 14:48:34 +0000
Subject: [PATCH 087/289] Refactor: FormatString
---
app/mailers/outgoing_mailer.rb | 2 +-
app/models/foi_attachment.rb | 2 +-
spec/controllers/attachments_controller_spec.rb | 2 +-
spec/support/email_helpers.rb | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb
index ebee8e4762..b61d43ed84 100644
--- a/app/mailers/outgoing_mailer.rb
+++ b/app/mailers/outgoing_mailer.rb
@@ -91,7 +91,7 @@ def self.is_followupable?(info_request, incoming_message_followup)
def self.id_for_message(outgoing_message)
message_id = "ogm-" + outgoing_message.id.to_s
t = Time.zone.now
- message_id += "+" + '%08x%05x-%04x' % [t.to_i, t.tv_usec, rand(0xffff)]
+ message_id += "+" + format('%08x%05x-%04x', t.to_i, t.tv_usec, rand(0xffff))
message_id += "@" + AlaveteliConfiguration::incoming_email_domain
return "<" + message_id + ">"
end
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index d4b74a2537..ab21db2f76 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -239,7 +239,7 @@ def update_display_size!
s = body.size
if s > 1024 * 1024
- self.display_size = sprintf("%.1f", s.to_f / 1024 / 1024) + 'M'
+ self.display_size = format("%.1f", s.to_f / 1024 / 1024) + 'M'
else
self.display_size = (s / 1024).to_s + 'K'
end
diff --git a/spec/controllers/attachments_controller_spec.rb b/spec/controllers/attachments_controller_spec.rb
index 889e8d57d5..5858755901 100644
--- a/spec/controllers/attachments_controller_spec.rb
+++ b/spec/controllers/attachments_controller_spec.rb
@@ -57,7 +57,7 @@ def show(params = {})
# check the file permissions
key_path = @controller.send(:cache_key_path)
- octal_stat = sprintf("%o", File.stat(key_path).mode)[-4..-1]
+ octal_stat = format("%o", File.stat(key_path).mode)[-4..-1]
expect(octal_stat).to eq('0644')
# clean up and remove the file
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb
index 0627e4c7a9..518c0848c8 100644
--- a/spec/support/email_helpers.rb
+++ b/spec/support/email_helpers.rb
@@ -2,7 +2,7 @@ def load_raw_emails_data
raw_emails_yml = File.join(RSpec.configuration.fixture_path, "raw_emails.yml")
for raw_email_id in YAML::load_file(raw_emails_yml).map { |k,v| v["id"] } do
raw_email = RawEmail.find(raw_email_id)
- raw_email.data = load_file_fixture("raw_emails/%d.email" % [raw_email_id])
+ raw_email.data = load_file_fixture(format("raw_emails/%d.email", raw_email_id))
end
end
From 1226462642a7a500c6dec1292788c6f2cd2f94a4 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 13 Feb 2023 10:57:25 +0000
Subject: [PATCH 088/289] Set STAGING_SITE when generating initial config
We need this configuration value in `script/rails-deploy-before-down` to
correctly set `RAILS_ENV` to `production` when not doing a development
install.
Fixes #7583
---
script/install-as-user | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/script/install-as-user b/script/install-as-user
index 3d2d1ae4c0..a456bb2d98 100755
--- a/script/install-as-user
+++ b/script/install-as-user
@@ -141,6 +141,12 @@ RANDOM_EMAIL_SECRET=$(random_alphanumerics 32)
RANDOM_EMERGENCY_PASSWORD=$(random_alphanumerics 10)
RANDOM_COOKIE_SECRET=$(random_alphanumerics 100)
+if [ "$DEVELOPMENT_INSTALL" = true ]; then
+ STAGING_SITE=1
+else
+ STAGING_SITE=0
+fi
+
if ! [ -f config/general.yml ]
then
sed -r \
@@ -158,6 +164,7 @@ then
-e "s,^( *CONTACT_EMAIL:).*,\\1 'postmaster@$HOST'," \
-e "s,^( *TRACK_SENDER_EMAIL:).*,\\1 'postmaster@$HOST'," \
-e "s,^( *SECRET_KEY_BASE:).*,\\1 '$RANDOM_COOKIE_SECRET'," \
+ -e "s,^( *STAGING_SITE:).*,\\1 '$STAGING_SITE'," \
-e "s,^( *FORWARD_NONBOUNCE_RESPONSES_TO:).*,\\1 'user-support@$HOST'," \
-e "s,^( *HTML_TO_PDF_COMMAND:).*,\\1 '/usr/local/bin/wkhtmltopdf'," \
-e "s,^( *EXCEPTION_NOTIFICATIONS_FROM:).*,\\1 'do-not-reply-to-this-address@$HOST'," \
From 527493042dd66f953a9a4e83ae9a1a0a9c5cc4bd Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 14 Feb 2023 11:54:03 +0000
Subject: [PATCH 089/289] Fix bundler deprecation warnings
Also ensures when switch from a production to development install that
the correct gems are installed by unsetting the `deployment` and
`without` options.
Fixes #6417
---
script/rails-deploy-before-down | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/script/rails-deploy-before-down b/script/rails-deploy-before-down
index d7a68a21f7..0a41cf6f79 100755
--- a/script/rails-deploy-before-down
+++ b/script/rails-deploy-before-down
@@ -97,21 +97,25 @@ fi
OPTION_BUNDLE_PATH=$(bin/config BUNDLE_PATH)
BUNDLE_PATH="${OPTION_BUNDLE_PATH:-vendor/bundle}"
-
-bundle_install_options="--path $BUNDLE_PATH"
+bundle config set --local path $BUNDLE_PATH
if [ "$CI" = "true" ]
then
- bundle_install_options="$bundle_install_options --deployment"
+ bundle config set --local deployment 'true'
elif [ "$STAGING_SITE" = "0" ]
then
- bundle_install_options="$bundle_install_options --without development debug test --deployment"
+ bundle config set --local deployment 'true'
+ bundle config set --local without 'development debug test'
else
- bundle_install_options="$bundle_install_options"
+ bundle config unset --local deployment
+ bundle config unset --local without
fi
-echo "Running bundle install with options: $bundle_install_options"
-bundle install $bundle_install_options
+echo "Bundle install options:"
+bundle config list
+
+echo "Running bundle install:"
+bundle install
bundle exec rake submodules:check
From d70283f987c7842f39a5062212590894149f7b3d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 13 Feb 2023 05:02:38 +0000
Subject: [PATCH 090/289] Bump rubocop from 1.44.1 to 1.45.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.44.1 to 1.45.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.44.1...v1.45.1)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 7 +++++--
Gemfile | 2 +-
Gemfile.lock | 12 ++++++------
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index ee6ea7fde2..fdb65ea814 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -24,8 +24,8 @@ AllCops:
- node_modules/**/*
- vendor/**/*
- ".git/**/*"
- - "bin/bundle"
- - "bin/rubocop"
+ - bin/bundle
+ - bin/rubocop
DisplayCopNames: false
StyleGuideCopsOnly: false
DisabledByDefault: true
@@ -1966,6 +1966,9 @@ Style/RedundantFileExtensionInRequire:
Style/RedundantFreeze:
Enabled: true
+Style/RedundantHeredocDelimiterQuotes:
+ Enabled: false
+
Style/RedundantInitialize:
Enabled: false
diff --git a/Gemfile b/Gemfile
index a808f9a387..3d36861d68 100644
--- a/Gemfile
+++ b/Gemfile
@@ -188,7 +188,7 @@ group :development do
gem 'launchy', '< 2.6.0'
gem 'listen', '>= 3.0.5', '< 3.8.1'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.44.1', require: false
+ gem 'rubocop', '~> 1.45.1', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 97b2a05c40..787c6f4d4b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -348,7 +348,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.2.0.0)
+ parser (3.2.1.0)
ast (~> 2.4.1)
pg (1.4.5)
prime (0.1.2)
@@ -404,7 +404,7 @@ GEM
ffi (~> 1.0)
recaptcha (5.12.3)
json
- regexp_parser (2.6.2)
+ regexp_parser (2.7.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
@@ -439,7 +439,7 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.44.1)
+ rubocop (1.45.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@@ -449,8 +449,8 @@ GEM
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.24.1)
- parser (>= 3.1.1.0)
+ rubocop-ast (1.26.0)
+ parser (>= 3.2.1.0)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
@@ -603,7 +603,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.44.1)
+ rubocop (~> 1.45.1)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From 8da34dbe9a4963a571d85d2884bb3837a627c505 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Thu, 16 Feb 2023 18:01:22 +0000
Subject: [PATCH 091/289] Reduce default visibility of sign-in tracking
IP addresses are quite identifying, and in WhatDoTheyKnow's privacy
policy [1] we say that we don't ordinarily look at them while
administering the site.
Making it an active decision by an admin to reveal these preserves this
position of default privacy, but makes it much easier to investigate
issues without developer involvement.
[1] https://www.whatdotheyknow.com/help/privacy#our_logging
---
app/views/admin/users/_sign_in_table.html.erb | 81 ++++++++++++-------
1 file changed, 53 insertions(+), 28 deletions(-)
diff --git a/app/views/admin/users/_sign_in_table.html.erb b/app/views/admin/users/_sign_in_table.html.erb
index 7bc3185d39..c7fa11a9d6 100644
--- a/app/views/admin/users/_sign_in_table.html.erb
+++ b/app/views/admin/users/_sign_in_table.html.erb
@@ -10,38 +10,63 @@
<% end %>
<% if sign_ins.any? %>
-
- <% sign_ins.each do |sign_in| %>
-
-
<%= user_both_links(sign_in.user) %>
+
+
+
+
+ Sign in tracking records the IP address and date of sign in, as well
+ as a geolocation estimation, and links this IP address to sign ins
+ from other user accounts using the same IP address. This can be
+ useful for investigating misuse, but may also reveal legitimate use
+ of alternative accounts. Care should be taken when revealing this
+ information.
+
- <%= sign_in.other_users.size %> others using this
- IP
-
-
- <% end %>
-
+
+ <%= sign_in.other_users.size %> others using this
+ IP
+
+
+ <% end %>
+
+
+
+
+
<% elsif User::SignIn.retain_signins? %>
None yet.
<% end %>
From 568d040aa3c6850fa25b24f4842fca1e20bf56e3 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 17 Feb 2023 10:09:47 +0000
Subject: [PATCH 092/289] Use both_links for admin bodies index
It's now convention to use `both_links` when displaying admin records,
so update this partial to use it. We can now quickly get to the public
page from the admin bodies index.
---
app/views/admin_public_body/_public_body.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/admin_public_body/_public_body.html.erb b/app/views/admin_public_body/_public_body.html.erb
index 036ea5f598..9ab3762c25 100644
--- a/app/views/admin_public_body/_public_body.html.erb
+++ b/app/views/admin_public_body/_public_body.html.erb
@@ -2,7 +2,7 @@
<%= chevron_right %>
- <%= link_to(public_body.name, admin_body_path(public_body), :title => "view full details")%>
+ <%= both_links(public_body) %>
From d6e1bdb334c77c7b4c8840bb49ea828510111844 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 14 Nov 2022 16:51:31 +0000
Subject: [PATCH 093/289] Add InfoRequestEvent#event_type scopes
Dynamically add a scope per event type to make querying the model
easier.
The specs check the generated SQL because setting message expectations
didn't work. For example:
before { expect(described_class).to receive(:where) }
it { described_class.public_send(event_type) }
In this example I was expecting the `where` to be called, but it never
got called. Perhaps Rails is doing something different with scopes? I
tried adding a `#to_a` call to the example to force the query to
actually run, but nope.
I think asserting that the generated SQL gives us enough confidence for
what this is doing, so went with that.
---
app/models/info_request_event.rb | 4 ++++
spec/models/info_request_event_spec.rb | 9 +++++++++
2 files changed, 13 insertions(+)
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 9f9e0e1903..0356e9056a 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -97,6 +97,10 @@ class InfoRequestEvent < ApplicationRecord
# user described state (also update in info_request)
validate :must_be_valid_state
+ EVENT_TYPES.each do |event_type|
+ scope "#{event_type}_events", -> { where(event_type: event_type) }
+ end
+
def must_be_valid_state
if described_state and !InfoRequest::State.all.include?(described_state)
errors.add(:described_state, "is not a valid state")
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 4894db65bb..0e74ad44cc 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -20,6 +20,15 @@
require 'spec_helper'
RSpec.describe InfoRequestEvent do
+ describe 'event_type scopes' do
+ described_class::EVENT_TYPES.each do |event_type|
+ it "for '#{event_type}' events" do
+ expect(described_class.public_send("#{event_type}_events").to_sql).
+ to eq(described_class.where(event_type: event_type).to_sql)
+ end
+ end
+ end
+
describe "when checking for a valid state" do
it 'should add an error message for described_state if it is not valid' do
ire = InfoRequestEvent.new(:described_state => 'nope')
From 475ae7e856818924b9aaddcef49760835713dda9 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 14:59:24 +0000
Subject: [PATCH 094/289] Style: HashSyntax RuboCop (app controllers)
---
.../admin_censor_rule_controller.rb | 10 +-
app/controllers/admin_comment_controller.rb | 6 +-
app/controllers/admin_general_controller.rb | 6 +-
.../admin_holiday_imports_controller.rb | 2 +-
app/controllers/admin_holidays_controller.rb | 14 +-
.../admin_incoming_message_controller.rb | 12 +-
.../admin_info_request_event_controller.rb | 2 +-
.../admin_outgoing_message_controller.rb | 6 +-
...admin_public_body_categories_controller.rb | 12 +-
.../admin_public_body_controller.rb | 22 ++--
.../admin_public_body_headings_controller.rb | 18 +--
app/controllers/admin_request_controller.rb | 24 ++--
.../admin_spam_addresses_controller.rb | 6 +-
app/controllers/admin_track_controller.rb | 4 +-
app/controllers/admin_user_controller.rb | 18 +--
.../draft_info_request_batches_controller.rb | 2 +-
.../alaveteli_pro/info_requests_controller.rb | 4 +-
.../payment_methods_controller.rb | 2 +-
.../alaveteli_pro/public_bodies_controller.rb | 4 +-
.../alaveteli_pro/subscriptions_controller.rb | 4 +-
app/controllers/api_controller.rb | 118 ++++++++---------
app/controllers/application_controller.rb | 42 +++---
app/controllers/comment_controller.rb | 22 ++--
app/controllers/concerns/user_spam_check.rb | 2 +-
app/controllers/followups_controller.rb | 46 +++----
app/controllers/general_controller.rb | 18 +--
app/controllers/health_checks_controller.rb | 4 +-
.../info_request_batch_controller.rb | 8 +-
.../one_time_passwords_controller.rb | 6 +-
.../delivery_statuses_controller.rb | 4 +-
.../password_changes_controller.rb | 35 +++--
.../public_body_change_requests_controller.rb | 12 +-
app/controllers/public_body_controller.rb | 44 +++----
app/controllers/reports_controller.rb | 6 +-
app/controllers/request_controller.rb | 124 +++++++++---------
app/controllers/request_game_controller.rb | 10 +-
app/controllers/services_controller.rb | 28 ++--
app/controllers/track_controller.rb | 38 +++---
app/controllers/user_controller.rb | 98 +++++++-------
.../user_profile/about_me_controller.rb | 6 +-
.../users/confirmations_controller.rb | 2 +-
app/controllers/users/sessions_controller.rb | 14 +-
app/controllers/widget_votes_controller.rb | 4 +-
app/controllers/widgets_controller.rb | 6 +-
44 files changed, 437 insertions(+), 438 deletions(-)
diff --git a/app/controllers/admin_censor_rule_controller.rb b/app/controllers/admin_censor_rule_controller.rb
index e7072019c2..99c9415c63 100644
--- a/app/controllers/admin_censor_rule_controller.rb
+++ b/app/controllers/admin_censor_rule_controller.rb
@@ -6,9 +6,9 @@
class AdminCensorRuleController < AdminController
- before_action :set_editor, :only => [:create, :update]
- before_action :set_censor_rule, :only => [:edit, :update, :destroy]
- before_action :set_subject_and_censor_rule_and_form_url, :only => [:new, :create]
+ before_action :set_editor, only: [:create, :update]
+ before_action :set_censor_rule, only: [:edit, :update, :destroy]
+ before_action :set_subject_and_censor_rule_and_form_url, only: [:new, :create]
def index
@censor_rules = CensorRule.global
@@ -22,7 +22,7 @@ def create
flash[:notice] = 'Censor rule was successfully created.'
expire_requests_and_redirect
else
- render :action => 'new'
+ render action: 'new'
end
end
@@ -34,7 +34,7 @@ def update
flash[:notice] = 'Censor rule was successfully updated.'
expire_requests_and_redirect
else
- render :action => 'edit'
+ render action: 'edit'
end
end
diff --git a/app/controllers/admin_comment_controller.rb b/app/controllers/admin_comment_controller.rb
index 333bfc99b3..7f0655b58b 100644
--- a/app/controllers/admin_comment_controller.rb
+++ b/app/controllers/admin_comment_controller.rb
@@ -6,7 +6,7 @@
class AdminCommentController < AdminController
- before_action :set_comment, :only => [:edit, :update]
+ before_action :set_comment, only: [:edit, :update]
def index
@title = 'Listing comments'
@@ -21,7 +21,7 @@ def index
comments = comments.not_embargoed if cannot? :admin, AlaveteliPro::Embargo
- @comments = comments.paginate :page => params[:page], :per_page => 100
+ @comments = comments.paginate page: params[:page], per_page: 100
end
def edit
@@ -54,7 +54,7 @@ def update
flash[:notice] = 'Comment successfully updated.'
redirect_to admin_request_url(@comment.info_request)
else
- render :action => 'edit'
+ render action: 'edit'
end
end
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 60cb83a4be..9a31fd3e36 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -25,7 +25,7 @@ def index
limit(20).
is_searchable
@holding_pen_messages = InfoRequest.
- includes(:incoming_messages => :raw_email).
+ includes(incoming_messages: :raw_email).
holding_pen_request.
incoming_messages
@public_request_tasks = [ @holding_pen_messages,
@@ -85,7 +85,7 @@ def index
].any? { |to_do_list| ! to_do_list.empty? }
@embargoed_attention_comments = Comment.
- where(:attention_requested => true).
+ where(attention_requested: true).
embargoed
@embargoed_comment_tasks = [
@@ -119,7 +119,7 @@ def timeline
end
# get all the models in the slice, eagerly loading the associations we use in the view
public_body_versions = PublicBody.versioned_class.
- includes(:public_body => :translations).
+ includes(public_body: :translations).
find(public_body_version_ids.keys)
info_request_events = InfoRequestEvent.
includes(:info_request).
diff --git a/app/controllers/admin_holiday_imports_controller.rb b/app/controllers/admin_holiday_imports_controller.rb
index 02c08211e9..118c3d2456 100644
--- a/app/controllers/admin_holiday_imports_controller.rb
+++ b/app/controllers/admin_holiday_imports_controller.rb
@@ -9,7 +9,7 @@ def create
@holiday_import = HolidayImport.new(holiday_import_params)
if @holiday_import.save
notice = "Holidays successfully imported"
- redirect_to admin_holidays_path, :notice => notice
+ redirect_to admin_holidays_path, notice: notice
else
render :new
end
diff --git a/app/controllers/admin_holidays_controller.rb b/app/controllers/admin_holidays_controller.rb
index 1e6baab53c..86dd2f4e02 100644
--- a/app/controllers/admin_holidays_controller.rb
+++ b/app/controllers/admin_holidays_controller.rb
@@ -1,6 +1,6 @@
class AdminHolidaysController < AdminController
- before_action :set_holiday, :only => [:edit, :update, :destroy]
+ before_action :set_holiday, only: [:edit, :update, :destroy]
def index
get_all_holidays
@@ -9,9 +9,9 @@ def index
def new
@holiday = Holiday.new
if request.xhr?
- render :partial => 'new_form', :locals => { :holiday => @holiday }
+ render partial: 'new_form', locals: { holiday: @holiday }
else
- render :action => 'new'
+ render action: 'new'
end
end
@@ -19,7 +19,7 @@ def create
@holiday = Holiday.new(holiday_params)
if @holiday.save
notice = "Holiday successfully created."
- redirect_to admin_holidays_path, :notice => notice
+ redirect_to admin_holidays_path, notice: notice
else
render :new
end
@@ -27,9 +27,9 @@ def create
def edit
if request.xhr?
- render :partial => 'edit_form'
+ render partial: 'edit_form'
else
- render :action => 'edit'
+ render action: 'edit'
end
end
@@ -45,7 +45,7 @@ def update
def destroy
@holiday.destroy
notice = "Holiday successfully destroyed"
- redirect_to admin_holidays_path, :notice => notice
+ redirect_to admin_holidays_path, notice: notice
end
private
diff --git a/app/controllers/admin_incoming_message_controller.rb b/app/controllers/admin_incoming_message_controller.rb
index aa3d3ac555..e39cde0a32 100644
--- a/app/controllers/admin_incoming_message_controller.rb
+++ b/app/controllers/admin_incoming_message_controller.rb
@@ -1,6 +1,6 @@
class AdminIncomingMessageController < AdminController
- before_action :set_incoming_message, :only => [:edit, :update, :destroy, :redeliver]
+ before_action :set_incoming_message, only: [:edit, :update, :destroy, :redeliver]
before_action :set_info_request, :check_info_request
def edit
@@ -26,7 +26,7 @@ def update
flash[:notice] = 'Incoming message successfully updated.'
redirect_to admin_request_url(@incoming_message.info_request)
else
- render :action => 'edit'
+ render action: 'edit'
end
end
@@ -38,7 +38,7 @@ def destroy
deleted_incoming_message_id: @incoming_message.id
)
# expire cached files
- @incoming_message.info_request.expire(:preserve_database_cache => true)
+ @incoming_message.info_request.expire(preserve_database_cache: true)
flash[:notice] = 'Incoming message successfully destroyed.'
redirect_to admin_request_url(@incoming_message.info_request)
end
@@ -49,7 +49,7 @@ def bulk_destroy
end
@incoming_messages = IncomingMessage.
- where(:id => params[:ids].split(",").flatten)
+ where(id: params[:ids].split(",").flatten)
if params[:commit] == "Yes"
errors = []
info_request = InfoRequest.find(params[:request_id])
@@ -65,7 +65,7 @@ def bulk_destroy
errors << message.id
end
end
- info_request.expire(:preserve_database_cache => true)
+ info_request.expire(preserve_database_cache: true)
if errors.empty?
flash[:notice] = "Incoming messages successfully destroyed."
else
@@ -107,7 +107,7 @@ def redeliver
destination_request.
receive(mail,
raw_email_data,
- { :override_stop_new_responses => true })
+ { override_stop_new_responses: true })
@incoming_message.info_request.log_event(
'redeliver_incoming',
diff --git a/app/controllers/admin_info_request_event_controller.rb b/app/controllers/admin_info_request_event_controller.rb
index 5be80ef800..4f71e83191 100644
--- a/app/controllers/admin_info_request_event_controller.rb
+++ b/app/controllers/admin_info_request_event_controller.rb
@@ -6,7 +6,7 @@
class AdminInfoRequestEventController < AdminController
- before_action :set_info_request_event, :only => [:update]
+ before_action :set_info_request_event, only: [:update]
# used so due dates get fixed
def update
diff --git a/app/controllers/admin_outgoing_message_controller.rb b/app/controllers/admin_outgoing_message_controller.rb
index c728a04011..370d5c31fe 100644
--- a/app/controllers/admin_outgoing_message_controller.rb
+++ b/app/controllers/admin_outgoing_message_controller.rb
@@ -1,8 +1,8 @@
class AdminOutgoingMessageController < AdminController
- before_action :set_outgoing_message, :only => [:edit, :destroy, :update, :resend]
+ before_action :set_outgoing_message, only: [:edit, :destroy, :update, :resend]
before_action :set_info_request, :check_info_request
- before_action :set_is_initial_message, :only => [:edit, :destroy]
+ before_action :set_is_initial_message, only: [:edit, :destroy]
def edit
end
@@ -46,7 +46,7 @@ def update
@outgoing_message.info_request.expire
redirect_to admin_request_url(@outgoing_message.info_request)
else
- render :action => 'edit'
+ render action: 'edit'
end
end
diff --git a/app/controllers/admin_public_body_categories_controller.rb b/app/controllers/admin_public_body_categories_controller.rb
index 752ebb0cae..1ebf8f3471 100644
--- a/app/controllers/admin_public_body_categories_controller.rb
+++ b/app/controllers/admin_public_body_categories_controller.rb
@@ -2,7 +2,7 @@ class AdminPublicBodyCategoriesController < AdminController
include TranslatableParams
- before_action :set_public_body_category, :only => [:edit, :update, :destroy]
+ before_action :set_public_body_category, only: [:edit, :update, :destroy]
def index
@locale = AlaveteliLocalization.locale
@@ -30,7 +30,7 @@ def create
redirect_to admin_categories_path
else
@public_body_category.build_all_translations
- render :action => 'new'
+ render action: 'new'
end
end
end
@@ -48,7 +48,7 @@ def update
AlaveteliLocalization.with_locale(AlaveteliLocalization.default_locale) do
if params[:public_body_category][:category_tag] && PublicBody.find_by_tag(@public_body_category.category_tag).count > 0 && @public_body_category.category_tag != params[:public_body_category][:category_tag]
flash[:error] = "There are authorities associated with this category, so the tag can't be renamed"
- render :action => 'edit'
+ render action: 'edit'
else
if params[:headings]
heading_ids = params[:headings].values
@@ -58,8 +58,8 @@ def update
unless removed_headings.empty?
# remove the link objects
deleted_links = PublicBodyCategoryLink.where(
- :public_body_category_id => @public_body_category.id,
- :public_body_heading_id => [removed_headings].flatten
+ public_body_category_id: @public_body_category.id,
+ public_body_heading_id: [removed_headings].flatten
)
deleted_links.delete_all
@@ -79,7 +79,7 @@ def update
redirect_to edit_admin_category_path(@public_body_category)
else
@public_body_category.build_all_translations
- render :action => 'edit'
+ render action: 'edit'
end
end
end
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index b18da4ff23..9c8c132c83 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -8,7 +8,7 @@ class AdminPublicBodyController < AdminController
include TranslatableParams
- before_action :set_public_body, :only => [:edit, :update, :destroy]
+ before_action :set_public_body, only: [:edit, :update, :destroy]
def index
lookup_query
@@ -22,8 +22,8 @@ def show
if cannot? :admin, AlaveteliPro::Embargo
info_requests = info_requests.not_embargoed
end
- @info_requests = info_requests.paginate(:page => params[:page],
- :per_page => 100)
+ @info_requests = info_requests.paginate(page: params[:page],
+ per_page: 100)
@versions = @public_body.versions.order(version: :desc)
render
end
@@ -37,13 +37,13 @@ def new
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
end
if @change_request
- @change_request_user_response = render_to_string(:template => "admin_public_body_change_requests/add_accepted",
- :formats => [:text])
+ @change_request_user_response = render_to_string(template: "admin_public_body_change_requests/add_accepted",
+ 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
end
- render :formats => [:html]
+ render formats: [:html]
end
def create
@@ -56,7 +56,7 @@ def create
if @public_body.save
if @change_request
response_text = params[:response].gsub(_("[Authority URL will be inserted here]"),
- public_body_url(@public_body, :only_path => false))
+ public_body_url(@public_body, only_path: false))
@change_request.close!
@change_request.send_response(params[:subject], response_text)
end
@@ -64,7 +64,7 @@ def create
redirect_to admin_body_url(@public_body)
else
@public_body.build_all_translations
- render :action => 'new'
+ render action: 'new'
end
end
end
@@ -106,7 +106,7 @@ def update
redirect_to admin_body_url(@public_body)
else
@public_body.build_all_translations
- render :action => 'edit'
+ render action: 'edit'
end
end
end
@@ -145,7 +145,7 @@ def mass_tag
end
end
- redirect_to admin_bodies_url(:query => @query, :page => @page)
+ redirect_to admin_bodies_url(query: @query, page: @page)
end
def import_csv
@@ -259,7 +259,7 @@ def lookup_query
joins(:translations).
where(query).
merge(PublicBody::Translation.order(:name)).
- paginate(:page => @page, :per_page => 100)
+ paginate(page: @page, per_page: 100)
end
@public_bodies_by_tag = PublicBody.find_by_tag(@query)
diff --git a/app/controllers/admin_public_body_headings_controller.rb b/app/controllers/admin_public_body_headings_controller.rb
index 8d3a5bde7c..71864121b2 100644
--- a/app/controllers/admin_public_body_headings_controller.rb
+++ b/app/controllers/admin_public_body_headings_controller.rb
@@ -2,7 +2,7 @@ class AdminPublicBodyHeadingsController < AdminController
include TranslatableParams
- before_action :set_public_body_heading, :only => [:edit, :update, :destroy]
+ before_action :set_public_body_heading, only: [:edit, :update, :destroy]
def new
@public_body_heading = PublicBodyHeading.new
@@ -17,7 +17,7 @@ def create
redirect_to admin_categories_url
else
@public_body_heading.build_all_translations
- render :action => 'new'
+ render action: 'new'
end
end
end
@@ -33,7 +33,7 @@ def update
redirect_to edit_admin_heading_path(@public_body_heading)
else
@public_body_heading.build_all_translations
- render :action => 'edit'
+ render action: 'edit'
end
end
end
@@ -49,7 +49,7 @@ def reorder
if transaction[:success]
head :ok
else
- render :plain => transaction[:error], :status => :unprocessable_entity
+ render plain: transaction[:error], status: :unprocessable_entity
end
end
@@ -59,7 +59,7 @@ def reorder_categories
head :ok
return
else
- render :plain => transaction[:error], :status => :unprocessable_entity
+ render plain: transaction[:error], status: :unprocessable_entity
end
end
@@ -82,15 +82,15 @@ def reorder_headings(headings)
end
end
end
- { :success => error.nil?, :error => error }
+ { success: error.nil?, error: error }
end
def reorder_categories_for_heading(heading_id, categories)
error = nil
ActiveRecord::Base.transaction do
categories.each_with_index do |category_id, index|
- conditions = { :public_body_category_id => category_id,
- :public_body_heading_id => heading_id }
+ conditions = { public_body_category_id: category_id,
+ public_body_heading_id: heading_id }
link = PublicBodyCategoryLink.where(conditions).first
unless link
error = "Couldn't find PublicBodyCategoryLink for category #{category_id}, heading #{heading_id}"
@@ -103,7 +103,7 @@ def reorder_categories_for_heading(heading_id, categories)
end
end
end
- { :success => error.nil?, :error => error }
+ { success: error.nil?, error: error }
end
private
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 63aedfc923..03636b9ea8 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -23,8 +23,8 @@ def index
end
@info_requests = info_requests.order(created_at: :desc).paginate(
- :page => params[:page],
- :per_page => 100)
+ page: params[:page],
+ per_page: 100)
end
def show
@@ -76,7 +76,7 @@ def update
flash[:notice] = 'Request successfully updated.'
redirect_to admin_request_url(@info_request)
else
- render :action => 'edit'
+ render action: 'edit'
end
end
@@ -135,7 +135,7 @@ def generate_upload_url
user = User.find_user_by_email(email)
if not user
- user = User.new(:name => name, :email => email, :password => PostRedirect.generate_random_token)
+ user = User.new(name: name, email: email, password: PostRedirect.generate_random_token)
user.save!
end
@@ -148,16 +148,16 @@ def generate_upload_url
# Bejeeps, look, sometimes a URL is something that belongs in a controller, jesus.
# TODO: hammer this square peg into the round MVC hole
post_redirect = PostRedirect.new(
- :uri => upload_response_url(:url_title => @info_request.url_title),
- :user_id => user.id)
+ uri: upload_response_url(url_title: @info_request.url_title),
+ user_id: user.id)
post_redirect.save!
flash[:notice] = {
- :partial => "upload_email_message",
- :locals => {
- :name => name,
- :email => email,
- :url => confirm_url(:email_token => post_redirect.email_token)
+ partial: "upload_email_message",
+ locals: {
+ name: name,
+ email: email,
+ url: confirm_url(email_token: post_redirect.email_token)
}
}
redirect_to admin_request_url(@info_request)
@@ -197,7 +197,7 @@ def hide
).deliver_now
flash[:notice] = _("Your message to {{recipient_user_name}} has " \
"been sent",
- :recipient_user_name => @info_request.user.
+ recipient_user_name: @info_request.user.
name.html_safe)
else
flash[:notice] = _("This external request has been hidden")
diff --git a/app/controllers/admin_spam_addresses_controller.rb b/app/controllers/admin_spam_addresses_controller.rb
index 53e2e8c45c..92830fdc88 100644
--- a/app/controllers/admin_spam_addresses_controller.rb
+++ b/app/controllers/admin_spam_addresses_controller.rb
@@ -1,6 +1,6 @@
class AdminSpamAddressesController < AdminController
- before_action :set_spam_address, :only => [:destroy]
+ before_action :set_spam_address, only: [:destroy]
def index
@spam_addresses = SpamAddress.all
@@ -11,7 +11,7 @@ def create
@spam_address = SpamAddress.new(spam_address_params)
if @spam_address.save
notice = "#{ @spam_address.email } has been added to the spam addresses list"
- redirect_to admin_spam_addresses_path, :notice => notice
+ redirect_to admin_spam_addresses_path, notice: notice
else
@spam_addresses = SpamAddress.all
render :index
@@ -21,7 +21,7 @@ def create
def destroy
@spam_address.destroy
notice = "#{ @spam_address.email } has been removed from the spam addresses list"
- redirect_to admin_spam_addresses_path, :notice => notice
+ redirect_to admin_spam_addresses_path, notice: notice
end
private
diff --git a/app/controllers/admin_track_controller.rb b/app/controllers/admin_track_controller.rb
index d146388d1e..dbfe29ba88 100644
--- a/app/controllers/admin_track_controller.rb
+++ b/app/controllers/admin_track_controller.rb
@@ -6,7 +6,7 @@
class AdminTrackController < AdminController
- before_action :set_track_thing, :only => [:destroy]
+ before_action :set_track_thing, only: [:destroy]
def index
@query = params[:query]
@@ -17,7 +17,7 @@ def index
end
@admin_tracks =
track_things.order(created_at: :desc).
- paginate(:page => params[:page], :per_page => 100)
+ paginate(page: params[:page], per_page: 100)
@popular = ActiveRecord::Base.connection.select_all("select count(*) as count, title, info_request_id from track_things join info_requests on info_request_id = info_requests.id where info_request_id is not null group by info_request_id, title order by count desc limit 10;")
end
diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb
index ac7271496a..30a8de573a 100644
--- a/app/controllers/admin_user_controller.rb
+++ b/app/controllers/admin_user_controller.rb
@@ -36,12 +36,12 @@ def index
# so we need to requery in order to paginate
if !@roles.empty?
users = users.with_any_role(*@roles)
- users = User.where(:id => users.map { |user| user.id })
+ users = User.where(id: users.map { |user| user.id })
end
@admin_users =
users.order(@sort_options[@sort_order]).
- paginate(:page => params[:page], :per_page => 100)
+ paginate(page: params[:page], per_page: 100)
render action: :index
end
@@ -53,8 +53,8 @@ def show
@info_requests = @info_requests.not_embargoed
@comments = @admin_user.comments.not_embargoed
end
- @info_requests = @info_requests.paginate(:page => params[:page],
- :per_page => 100)
+ @info_requests = @info_requests.paginate(page: params[:page],
+ per_page: 100)
end
def edit
@@ -78,7 +78,7 @@ def update
redirect_to admin_user_url(@admin_user)
end
else
- render :action => 'edit'
+ render action: 'edit'
end
end
@@ -160,12 +160,12 @@ def clear_features
# and requirements are met
def check_role_authorisation
all_allowed = changed_role_ids.all? do |role_id|
- role = Role.where(:id => role_id).first
+ role = Role.where(id: role_id).first
role && @user.can_admin_role?(role.name.to_sym)
end
unless all_allowed
flash[:error] = "Not permitted to change roles"
- render :action => 'edit' and return false
+ render action: 'edit' and return false
end
end
@@ -177,7 +177,7 @@ def changed_role_ids
def check_role_requirements
role_names = Role.
- where(:id => params[:admin_user][:role_ids]).
+ where(id: params[:admin_user][:role_ids]).
pluck(:name).map { |role| role.to_sym }
missing_required = Hash.new { |h, k| h[k] = [] }
role_names.each do |role_name|
@@ -192,7 +192,7 @@ def check_role_requirements
missing_required.each do |key, value|
flash[:error] += " #{key} requires #{value.to_sentence}"
end
- render :action => 'edit' and return false
+ render action: 'edit' and return false
end
end
diff --git a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
index ec6fd9795e..b8588f8843 100644
--- a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
+++ b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
@@ -90,7 +90,7 @@ def draft_params
def draft_params_multiple_bodies
params.require(:alaveteli_pro_draft_info_request_batch).
- permit(:title, :body, :embargo_duration, :public_body_ids => [])
+ permit(:title, :body, :embargo_duration, public_body_ids: [])
end
def update_bodies_params
diff --git a/app/controllers/alaveteli_pro/info_requests_controller.rb b/app/controllers/alaveteli_pro/info_requests_controller.rb
index c3b51d4cfe..bbdeb30def 100644
--- a/app/controllers/alaveteli_pro/info_requests_controller.rb
+++ b/app/controllers/alaveteli_pro/info_requests_controller.rb
@@ -18,8 +18,8 @@ def index
request_summaries = @request_filter.results(current_user)
@page = params[:page] || 1
@per_page = 10
- @request_summaries = request_summaries.paginate :page => @page,
- :per_page => @per_page
+ @request_summaries = request_summaries.paginate page: @page,
+ per_page: @per_page
end
diff --git a/app/controllers/alaveteli_pro/payment_methods_controller.rb b/app/controllers/alaveteli_pro/payment_methods_controller.rb
index 0a53765565..770bd3cf75 100644
--- a/app/controllers/alaveteli_pro/payment_methods_controller.rb
+++ b/app/controllers/alaveteli_pro/payment_methods_controller.rb
@@ -21,7 +21,7 @@ def update
Stripe::StripeError => e
if send_exception_notifications?
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
flash[:error] = _('There was a problem updating your payment details. ' \
diff --git a/app/controllers/alaveteli_pro/public_bodies_controller.rb b/app/controllers/alaveteli_pro/public_bodies_controller.rb
index 417d74800b..c0f3182a27 100644
--- a/app/controllers/alaveteli_pro/public_bodies_controller.rb
+++ b/app/controllers/alaveteli_pro/public_bodies_controller.rb
@@ -5,8 +5,8 @@ class AlaveteliPro::PublicBodiesController < AlaveteliPro::BaseController
def index
query = params[:query] || ""
- xapian_results = typeahead_search(query, :model => PublicBody,
- :exclude_tags => [ 'defunct',
+ xapian_results = typeahead_search(query, model: PublicBody,
+ exclude_tags: [ 'defunct',
'not_apply' ])
results = xapian_results.present? ? xapian_results.results : []
# Exclude any bodies we can't make a request to (in addition to the ones
diff --git a/app/controllers/alaveteli_pro/subscriptions_controller.rb b/app/controllers/alaveteli_pro/subscriptions_controller.rb
index ab24d066de..234a9efc3e 100644
--- a/app/controllers/alaveteli_pro/subscriptions_controller.rb
+++ b/app/controllers/alaveteli_pro/subscriptions_controller.rb
@@ -77,7 +77,7 @@ def create
_('Coupon code has expired.')
else
if send_exception_notifications?
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
_('There was a problem submitting your payment. You ' \
@@ -171,7 +171,7 @@ def destroy
Stripe::APIConnectionError,
Stripe::StripeError => e
if send_exception_notifications?
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
flash[:error] = _('There was a problem cancelling your account. Please ' \
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 1b85464b1c..10908ddd7b 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -3,56 +3,56 @@ class ApiController < ApplicationController
before_action :check_api_key
before_action :check_external_request,
- :only => [:add_correspondence, :update_state]
+ only: [:add_correspondence, :update_state]
before_action :check_request_ownership,
- :only => [:add_correspondence, :update_state]
+ only: [:add_correspondence, :update_state]
def show_request
@request = InfoRequest.find(params[:id])
raise PermissionDenied if @request.public_body_id != @public_body.id
@request_data = {
- :id => @request.id,
- :url => make_url("request", @request.url_title),
- :title => @request.title,
- :created_at => @request.created_at,
- :updated_at => @request.updated_at,
- :status => @request.calculate_status,
- :public_body_url => make_url("body", @request.public_body.url_name),
- :request_email => @request.incoming_email,
- :request_text => @request.last_event_forming_initial_request.outgoing_message.body,
+ id: @request.id,
+ url: make_url("request", @request.url_title),
+ title: @request.title,
+ created_at: @request.created_at,
+ updated_at: @request.updated_at,
+ status: @request.calculate_status,
+ public_body_url: make_url("body", @request.public_body.url_name),
+ request_email: @request.incoming_email,
+ request_text: @request.last_event_forming_initial_request.outgoing_message.body,
}
if @request.user
@request_data[:requestor_url] = make_url("user", @request.user.url_name)
end
- render :json => @request_data
+ render json: @request_data
end
def create_request
json = ActiveSupport::JSON.decode(params[:request_json])
request = InfoRequest.new(
- :title => json["title"],
- :public_body_id => @public_body.id,
- :described_state => "waiting_response",
- :external_user_name => json["external_user_name"],
- :external_url => json["external_url"]
+ title: json["title"],
+ public_body_id: @public_body.id,
+ described_state: "waiting_response",
+ external_user_name: json["external_user_name"],
+ external_url: json["external_url"]
)
outgoing_message = OutgoingMessage.new(
- :status => 'ready',
- :message_type => 'initial_request',
- :body => json["body"],
- :last_sent_at => Time.zone.now,
- :what_doing => 'normal_sort',
- :info_request => request
+ status: 'ready',
+ message_type: 'initial_request',
+ body: json["body"],
+ last_sent_at: Time.zone.now,
+ what_doing: 'normal_sort',
+ info_request: request
)
request.outgoing_messages << outgoing_message
# Return an error if the request is invalid
# (Can this ever happen?)
if !request.valid?
- render :json => {
+ render json: {
'errors' => request.errors.full_messages
}
return
@@ -71,7 +71,7 @@ def create_request
request.set_described_state('waiting_response')
# Return the URL and ID number.
- render :json => {
+ render json: {
'url' => make_url("request", request.url_title),
'id' => request.id
}
@@ -107,7 +107,7 @@ def add_correspondence
end
if !errors.empty?
- render :json => { "errors" => errors }, :status => 500
+ render json: { "errors" => errors }, status: 500
return
end
@@ -115,12 +115,12 @@ def add_correspondence
# In the 'request' direction, i.e. what we (Alaveteli) regard as outgoing
outgoing_message = OutgoingMessage.new(
- :info_request => @request,
- :status => 'ready',
- :message_type => 'followup',
- :body => body,
- :last_sent_at => sent_at,
- :what_doing => 'normal_sort'
+ info_request: @request,
+ status: 'ready',
+ message_type: 'followup',
+ body: body,
+ last_sent_at: sent_at,
+ what_doing: 'normal_sort'
)
@request.outgoing_messages << outgoing_message
@request.save!
@@ -139,9 +139,9 @@ def add_correspondence
attachment_body = attachment.read
content_type = AlaveteliFileTypes.filename_and_content_to_mimetype(filename, attachment_body) || 'application/octet-stream'
attachment_hashes.push(
- :content_type => content_type,
- :body => attachment_body,
- :filename => filename
+ content_type: content_type,
+ body: attachment_body,
+ filename: filename
)
end
@@ -149,7 +149,7 @@ def add_correspondence
@request.receive(mail,
mail.encoded,
- { :override_stop_new_responses => true })
+ { override_stop_new_responses: true })
if new_state
# we've already checked above that the status is valid
@@ -163,7 +163,7 @@ def add_correspondence
@request.set_described_state(new_state)
end
end
- render :json => {
+ render json: {
'url' => make_url("request", @request.url_title),
}
end
@@ -182,14 +182,14 @@ def update_state
@request.set_described_state(new_state)
end
else
- render :json => {
+ render json: {
"errors" => ["'#{new_state}' is not a valid request state" ]
},
- :status => 500
+ status: 500
return
end
- render :json => {
+ render json: {
'url' => make_url("request", @request.url_title),
}
end
@@ -208,17 +208,17 @@ def body_request_events
@events = InfoRequestEvent.where(event_type_clause).
joins(:info_request).
where("public_body_id = ?", @public_body.id).
- includes([{:info_request => :user}, :outgoing_message]).
+ includes([{info_request: :user}, :outgoing_message]).
order(created_at: :desc)
if since_date_str
begin
since_date = Date.strptime(since_date_str, "%Y-%m-%d")
rescue ArgumentError
- render :json => {"errors" => [
+ render json: {"errors" => [
"Parameter since_date must be in format yyyy-mm-dd (not '#{since_date_str}')"
] },
- :status => 500
+ status: 500
return
end
@events = @events.where("info_request_events.created_at >= ?", since_date)
@@ -230,10 +230,10 @@ def body_request_events
begin
event = InfoRequestEvent.find(since_event_id)
rescue ActiveRecord::RecordNotFound
- render :json => {"errors" => [
+ render json: {"errors" => [
"Event ID #{since_event_id} not found"
] },
- :status => 500
+ status: 500
return
end
@events = @events.where("info_request_events.created_at > ?", event.created_at)
@@ -241,28 +241,28 @@ 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|
request = event.info_request
this_event = {
- :request_id => request.id,
- :event_id => event.id,
- :created_at => event.created_at.iso8601,
- :event_type => event.event_type,
- :request_url => request_url(request),
- :request_email => request.incoming_email,
- :title => request.title,
- :body => event.outgoing_message.body,
- :user_name => request.user_name,
+ request_id: request.id,
+ event_id: event.id,
+ created_at: event.created_at.iso8601,
+ event_type: event.event_type,
+ request_url: request_url(request),
+ request_email: request.incoming_email,
+ title: request.title,
+ body: event.outgoing_message.body,
+ user_name: request.user_name,
}
this_event[:user_url] = user_url(request.user) if request.user
@event_data.push(this_event)
end
- render :json => @event_data
+ render json: @event_data
else
raise ActiveRecord::RecordNotFound.new("Unrecognised feed type: #{feed_type}")
end
@@ -280,15 +280,15 @@ def check_api_key
def check_external_request
@request = InfoRequest.find_by_id(params[:id])
if @request.nil?
- render :json => { "errors" => ["Could not find request #{params[:id]}"] }, :status => 404
+ render json: { "errors" => ["Could not find request #{params[:id]}"] }, status: 404
elsif !@request.is_external?
- render :json => { "errors" => ["Request #{params[:id]} cannot be updated using the API"] }, :status => 403
+ render json: { "errors" => ["Request #{params[:id]} cannot be updated using the API"] }, status: 403
end
end
def check_request_ownership
if @request.public_body_id != @public_body.id
- render :json => { "errors" => ["You do not own request #{params[:id]}"] }, :status => 403
+ render json: { "errors" => ["You do not own request #{params[:id]}"] }, status: 403
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 1dd8e05821..9b0b463db7 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -24,7 +24,7 @@ class RouteNotFound < StandardError
end
# assign our own handler method for non-local exceptions
- rescue_from Exception, :with => :render_exception
+ rescue_from Exception, with: :render_exception
# Standard headers, footers and navigation for whole site
layout "default"
@@ -191,12 +191,12 @@ def render_exception(exception)
message << " " << backtrace.join("\n ")
Rails.logger.fatal("#{message}\n\n")
if send_exception_notifications?
- ExceptionNotifier.notify_exception(exception, :env => request.env)
+ ExceptionNotifier.notify_exception(exception, env: request.env)
end
@status = 500
end
respond_to do |format|
- format.html { render :template => "general/exception_caught", :status => @status }
+ format.html { render template: "general/exception_caught", status: @status }
format.any { head @status }
end
end
@@ -207,7 +207,7 @@ def render_hidden(template='request/hidden', opts = {})
raise ActiveRecord::RecordNotFound if @info_request && @info_request.embargo
response_code = opts.delete(:response_code) { 403 } # forbidden
- options = { :template => template, :status => response_code }.merge(opts)
+ options = { template: template, status: response_code }.merge(opts)
respond_to do |format|
format.html { render(options) }
@@ -363,18 +363,18 @@ def check_read_only
if !AlaveteliConfiguration::read_only.empty?
if feature_enabled?(:annotations)
flash[:notice] = {
- :partial => "general/read_only_annotations",
- :locals => {
- :site_name => site_name,
- :read_only => AlaveteliConfiguration.read_only
+ partial: "general/read_only_annotations",
+ locals: {
+ site_name: site_name,
+ read_only: AlaveteliConfiguration.read_only
}
}
else
flash[:notice] = {
- :partial => "general/read_only",
- :locals => {
- :site_name => site_name,
- :read_only => AlaveteliConfiguration.read_only
+ partial: "general/read_only",
+ locals: {
+ site_name: site_name,
+ read_only: AlaveteliConfiguration.read_only
}
}
end
@@ -411,11 +411,11 @@ def perform_search(models, query, sortby, collapse, per_page = 25, this_page = n
@page = this_page || get_search_page_from_params
result = ActsAsXapian::Search.new(models, @query,
- :offset => (@page - 1) * @per_page,
- :limit => @per_page,
- :sort_by_prefix => order,
- :sort_by_ascending => ascending,
- :collapse_by_prefix => collapse
+ offset: (@page - 1) * @per_page,
+ limit: @per_page,
+ sort_by_prefix: order,
+ sort_by_ascending: ascending,
+ collapse_by_prefix: collapse
)
result.results # Touch the results to load them, otherwise accessing them from the view
# might fail later if the database has subsequently been reopened.
@@ -431,8 +431,8 @@ def get_search_page_from_params
def typeahead_search(query, options)
@page = get_search_page_from_params
@per_page = options[:per_page] || 25
- options.merge!( :page => @page,
- :per_page => @per_page )
+ options.merge!( page: @page,
+ per_page: @per_page )
typeahead_search = TypeaheadSearch.new(query, options)
typeahead_search.xapian_search
end
@@ -472,7 +472,7 @@ def user_ip
# Returns a Hash
def sanitize_path(params)
if params.key?(:path)
- params.merge!(:path => Rack::Utils.escape(params[:path]))
+ params.merge!(path: Rack::Utils.escape(params[:path]))
end
end
@@ -480,7 +480,7 @@ def sanitize_path(params)
#
# Returns a Hash
def collect_locales
- @locales = { :current => AlaveteliLocalization.locale, :available => [] }
+ @locales = { current: AlaveteliLocalization.locale, available: [] }
AlaveteliLocalization.available_locales.each do |possible_locale|
if possible_locale == AlaveteliLocalization.locale
@locales[:current] = possible_locale
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index 533ee8a589..dd337ec6af 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -6,12 +6,12 @@
class CommentController < ApplicationController
before_action :build_comment, only: [:new]
- before_action :check_read_only, :only => [ :new ]
- before_action :find_info_request, :only => [ :new ]
- before_action :create_track_thing, :only => [ :new ]
- before_action :reject_unless_comments_allowed, :only => [ :new ]
- before_action :reject_if_user_banned, :only => [ :new ]
- before_action :set_in_pro_area, :only => [ :new ]
+ before_action :check_read_only, only: [ :new ]
+ before_action :find_info_request, only: [ :new ]
+ before_action :create_track_thing, only: [ :new ]
+ before_action :reject_unless_comments_allowed, only: [ :new ]
+ before_action :reject_if_user_banned, only: [ :new ]
+ before_action :set_in_pro_area, only: [ :new ]
def new
if params[:comment]
@@ -25,13 +25,13 @@ def new
# See if values were valid or not
if !params[:comment] || !@existing_comment.nil? || !@comment.valid? || params[:reedit]
@comment ||= @info_request.comments.new
- render :action => 'new'
+ render action: 'new'
return
end
# Show preview page, if it is a preview
if params[:preview].to_i == 1
- render :action => 'preview'
+ render action: 'preview'
return
end
@@ -111,7 +111,7 @@ def create_track_thing
# comment block.
def reject_unless_comments_allowed
unless feature_enabled?(:annotations) && @info_request.comments_allowed?
- redirect_to request_url(@info_request), :notice => "Comments are not allowed on this request"
+ redirect_to request_url(@info_request), notice: "Comments are not allowed on this request"
end
end
@@ -148,13 +148,13 @@ def block_spam_comments?
def handle_spam_comment(user)
if send_exception_notifications?
e = Exception.new("Possible spam annotation from user #{ user.id }")
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
if block_spam_comments?
flash.now[:error] = _("Sorry, we're currently unable to add your " \
"annotation. Please try again later.")
- render :action => 'new'
+ render action: 'new'
true
end
end
diff --git a/app/controllers/concerns/user_spam_check.rb b/app/controllers/concerns/user_spam_check.rb
index 8dd3eadfd0..cbadf9c83f 100644
--- a/app/controllers/concerns/user_spam_check.rb
+++ b/app/controllers/concerns/user_spam_check.rb
@@ -24,7 +24,7 @@ def handle_spam_user(user, &block)
true
elsif send_exception_notifications?
e = Exception.new(msg)
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
false
end
diff --git a/app/controllers/followups_controller.rb b/app/controllers/followups_controller.rb
index 463db9601d..19792378ed 100644
--- a/app/controllers/followups_controller.rb
+++ b/app/controllers/followups_controller.rb
@@ -12,9 +12,9 @@ class FollowupsController < ApplicationController
:set_refusal_advice,
:set_in_pro_area
- before_action :check_reedit, :only => [:preview, :create]
+ before_action :check_reedit, only: [:preview, :create]
- before_action :check_responses_allowed, :only => [:create]
+ before_action :check_responses_allowed, only: [:create]
def new
end
@@ -28,14 +28,14 @@ def create
send_followup
redirect_to request_url(@info_request) and return
end
- render :action => 'new'
+ render action: 'new'
end
def preview
@outgoing_message.info_request = @info_request
@internal_review = true if @outgoing_message.what_doing == 'internal_review'
unless @outgoing_message.valid?
- render :action => 'new'
+ render action: 'new'
return
end
end
@@ -45,7 +45,7 @@ def preview
def check_can_followup
unless @info_request.is_followupable?(@incoming_message)
@reason = @info_request.followup_bad_reason
- render :action => 'followup_bad'
+ render action: 'followup_bad'
return
end
end
@@ -57,7 +57,7 @@ def set_internal_review
def check_reedit
if params[:reedit]
- render :action => 'new'
+ render action: 'new'
return
end
end
@@ -72,10 +72,10 @@ def check_request_matches_incoming_message
def check_responses_allowed
if @info_request.allow_new_responses_from == "nobody"
- flash.now[:error] = { :partial => "followup_not_sent",
- :locals => {
- :help_contact_path => help_contact_path } }
- render :action => 'new'
+ flash.now[:error] = { partial: "followup_not_sent",
+ locals: {
+ help_contact_path: help_contact_path } }
+ render action: 'new'
return
end
end
@@ -90,7 +90,7 @@ def check_user_credentials
end
if authenticated? && !authenticated_user.can_make_followup?
@details = authenticated_user.can_fail_html
- render :template => 'user/banned'
+ render template: 'user/banned'
return
end
render_hidden if authenticated? && cannot?(:read, @info_request)
@@ -98,19 +98,19 @@ def check_user_credentials
def get_login_params(is_incoming, info_request)
if is_incoming
- { :web => _("To send a follow up message to {{authority_name}}",
- :authority_name => info_request.public_body.name),
- :email => _("Then you can write follow up message to {{authority_name}}.",
- :authority_name => info_request.public_body.name),
- :email_subject => _("Write your FOI follow up message to {{authority_name}}",
- :authority_name => info_request.public_body.name) }
+ { web: _("To send a follow up message to {{authority_name}}",
+ authority_name: info_request.public_body.name),
+ email: _("Then you can write follow up message to {{authority_name}}.",
+ authority_name: info_request.public_body.name),
+ email_subject: _("Write your FOI follow up message to {{authority_name}}",
+ authority_name: info_request.public_body.name) }
else
- { :web => _("To reply to {{authority_name}}.",
- :authority_name => info_request.public_body.name),
- :email => _("Then you can write your reply to {{authority_name}}.",
- :authority_name => info_request.public_body.name),
- :email_subject => _("Write a reply to {{authority_name}}",
- :authority_name => info_request.public_body.name) }
+ { web: _("To reply to {{authority_name}}.",
+ authority_name: info_request.public_body.name),
+ email: _("Then you can write your reply to {{authority_name}}.",
+ authority_name: info_request.public_body.name),
+ email_subject: _("Write a reply to {{authority_name}}",
+ authority_name: info_request.public_body.name) }
end
end
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index c06a8229c8..459859db7a 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -17,14 +17,14 @@ class GeneralController < ApplicationController
def frontpage
medium_cache
@locale = AlaveteliLocalization.locale
- successful_query = InfoRequestEvent.make_query_from_params( :latest_status => ['successful'] )
+ successful_query = InfoRequestEvent.make_query_from_params( latest_status: ['successful'] )
@request_events, @request_events_all_successful = InfoRequest.recent_requests
@track_thing = TrackThing.create_track_for_search_query(successful_query)
@number_of_requests = InfoRequest.is_searchable.count
@number_of_authorities = PublicBody.visible.count
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'),
- :title => _('Successful requests'),
- :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'),
+ title: _('Successful requests'),
+ has_json: true } ]
end
# Display blog entries
@@ -56,7 +56,7 @@ def get_blog_content
@data = XmlSimple.xml_in(content)
@channel = @data['channel'][0]
@blog_items = @channel.fetch('item') { [] }
- @feed_autodetect = [{:url => @feed_url, :title => "#{site_name} blog"}]
+ @feed_autodetect = [{url: @feed_url, title: "#{site_name} blog"}]
end
end
@twitter_user = AlaveteliConfiguration.twitter_username
@@ -70,7 +70,7 @@ def search_redirect
@query = nil
@page = 1
@advanced = !params[:advanced].nil?
- render :action => "search"
+ render action: "search"
else
query_parts = @query.split("/")
if !['bodies', 'requests', 'users', 'all'].include?(query_parts[-1])
@@ -132,7 +132,7 @@ def search
# structured query which should show newest first, rather than a free text search
# where we want most relevant as default.
begin
- dummy_query = ActsAsXapian::Search.new([InfoRequestEvent], @query, :limit => 1)
+ dummy_query = ActsAsXapian::Search.new([InfoRequestEvent], @query, limit: 1)
rescue => e
flash[:error] = "Your query was not quite right. #{e.message}"
redirect_to search_url("")
@@ -187,13 +187,13 @@ def search
end
# Spelling and highight words are same for all three queries
- @highlight_words = @request_for_spelling.words_to_highlight(:regex => true, :include_original => true)
+ @highlight_words = @request_for_spelling.words_to_highlight(regex: true, include_original: true)
if !(@request_for_spelling.spelling_correction =~ /[a-z]+:/)
@spelling_correction = @request_for_spelling.spelling_correction
end
@track_thing = TrackThing.create_track_for_search_query(@query, @variety_postfix)
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'), title: @track_thing.params[:title_in_rss], has_json: true } ]
end
# Handle requests for non-existent URLs - will be handled by ApplicationController::render_exception
diff --git a/app/controllers/health_checks_controller.rb b/app/controllers/health_checks_controller.rb
index 87a39ea59d..8710825e50 100644
--- a/app/controllers/health_checks_controller.rb
+++ b/app/controllers/health_checks_controller.rb
@@ -4,9 +4,9 @@ def index
@health_checks = HealthChecks.all
if HealthChecks.ok?
- render :action => :index, :layout => false
+ render action: :index, layout: false
else
- render :action => :index, :layout => false , :status => 500
+ render action: :index, layout: false , status: 500
end
end
diff --git a/app/controllers/info_request_batch_controller.rb b/app/controllers/info_request_batch_controller.rb
index c06aee89a9..d553bf9111 100644
--- a/app/controllers/info_request_batch_controller.rb
+++ b/app/controllers/info_request_batch_controller.rb
@@ -1,8 +1,8 @@
class InfoRequestBatchController < ApplicationController
- before_action :set_in_pro_area, :only => [:show]
- before_action :load_and_authorise_resource, :only => [:show]
- before_action :redirect_embargoed_requests_for_pro_users, :only => [:show]
- before_action :redirect_public_requests_from_pro_context, :only => [:show]
+ before_action :set_in_pro_area, only: [:show]
+ before_action :load_and_authorise_resource, only: [:show]
+ before_action :redirect_embargoed_requests_for_pro_users, only: [:show]
+ before_action :redirect_public_requests_from_pro_context, only: [:show]
def show
@per_page = 25
diff --git a/app/controllers/one_time_passwords_controller.rb b/app/controllers/one_time_passwords_controller.rb
index 1993ad3650..52d050d4ee 100644
--- a/app/controllers/one_time_passwords_controller.rb
+++ b/app/controllers/one_time_passwords_controller.rb
@@ -14,7 +14,7 @@ def create
if @user.save
redirect_to one_time_password_path,
- :notice => _('Two factor authentication enabled')
+ notice: _('Two factor authentication enabled')
else
flash.now[:error] = _('Two factor authentication could not be enabled')
render :show
@@ -24,7 +24,7 @@ def create
def update
if @user.increment!(:otp_counter)
redirect_to one_time_password_path,
- :notice => _('Two factor one time passcode updated')
+ notice: _('Two factor one time passcode updated')
else
flash.now[:error] = _('Could not update your two factor one time passcode')
render :show
@@ -36,7 +36,7 @@ def destroy
if @user.save
redirect_to one_time_password_path,
- :notice => _('Two factor authentication disabled')
+ notice: _('Two factor authentication disabled')
else
flash.now[:error] = _('Two factor authentication could not be disabled')
render :show
diff --git a/app/controllers/outgoing_messages/delivery_statuses_controller.rb b/app/controllers/outgoing_messages/delivery_statuses_controller.rb
index 597ee55469..4f3eefa77d 100644
--- a/app/controllers/outgoing_messages/delivery_statuses_controller.rb
+++ b/app/controllers/outgoing_messages/delivery_statuses_controller.rb
@@ -3,7 +3,7 @@ class OutgoingMessages::DeliveryStatusesController < ApplicationController
def show
@title = _('Delivery Status for Outgoing Message #{{id}}',
- :id => @outgoing_message.id)
+ id: @outgoing_message.id)
@delivery_status = @outgoing_message.delivery_status
@@ -11,7 +11,7 @@ def show
if @show_mail_server_logs
@mail_server_logs = @outgoing_message.mail_server_logs.map do |log|
- log.line(:redact => !@user.is_admin?)
+ log.line(redact: !@user.is_admin?)
end
end
end
diff --git a/app/controllers/password_changes_controller.rb b/app/controllers/password_changes_controller.rb
index 7bf4e8972a..78a3882671 100644
--- a/app/controllers/password_changes_controller.rb
+++ b/app/controllers/password_changes_controller.rb
@@ -7,11 +7,11 @@
class PasswordChangesController < ApplicationController
before_action :set_pretoken
before_action :set_pretoken_hash
- before_action :set_user_from_token, :only => [:edit, :update]
+ before_action :set_user_from_token, only: [:edit, :update]
def new
@email_field_options =
- @user ? { :disabled => true, :value => @user.email } : {}
+ @user ? { disabled: true, value: @user.email } : {}
end
def create
@@ -27,7 +27,7 @@ def create
flash[:error] = _("That doesn't look like a valid email address. " \
"Please check you have typed it correctly.")
@email_field_options =
- @user ? { :disabled => true, :value => email } : {}
+ @user ? { disabled: true, value: email } : {}
render :new
return
end
@@ -36,21 +36,20 @@ def create
if @password_change_user
post_redirect_attrs =
- { :post_params => {},
- :reason_params =>
- { :web => '',
- :email => _('Then you can change your password on {{site_name}}',
- :site_name => site_name),
- :email_subject => _('Change your password on {{site_name}}',
- :site_name => site_name) },
- :circumstance => 'change_password',
- :user => @password_change_user }
+ { post_params: {},
+ reason_params: { web: '',
+ email: _('Then you can change your password on {{site_name}}',
+ site_name: site_name),
+ email_subject: _('Change your password on {{site_name}}',
+ site_name: site_name) },
+ circumstance: 'change_password',
+ user: @password_change_user }
post_redirect = PostRedirect.new(post_redirect_attrs)
post_redirect.uri = edit_password_change_url(post_redirect.token,
@pretoken_hash)
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ url = confirm_url(email_token: post_redirect.email_token)
UserMailer.
confirm_login(@password_change_user, post_redirect.reason_params, url).
deliver_now
@@ -69,7 +68,7 @@ def edit
end
def update
- @pretoken_redirect = PostRedirect.find_by(:token => @pretoken) if @pretoken
+ @pretoken_redirect = PostRedirect.find_by(token: @pretoken) if @pretoken
if @password_change_user
@password_change_user.password = params[:password_change_user][:password]
@@ -90,7 +89,7 @@ def update
msg = _("Your password has been changed. " \
"You also have a new one time passcode which you'll " \
"need next time you want to change your password")
- redirect_to one_time_password_path, :notice => msg
+ redirect_to one_time_password_path, notice: msg
else
redirect_to SafeRedirect.new(@pretoken_redirect.uri).path,
notice: _('Your password has been changed.')
@@ -100,11 +99,11 @@ def update
msg = _("Your password has been changed. " \
"You also have a new one time passcode which you'll " \
"need next time you want to change your password")
- redirect_to one_time_password_path, :notice => msg
+ redirect_to one_time_password_path, notice: msg
else
msg = _('Your password has been changed.')
redirect_to show_user_profile_path(@password_change_user.url_name),
- :notice => msg
+ notice: msg
end
end
else
@@ -122,7 +121,7 @@ def set_pretoken
end
def set_pretoken_hash
- @pretoken_hash = @pretoken ? { :pretoken => @pretoken } : {}
+ @pretoken_hash = @pretoken ? { pretoken: @pretoken } : {}
end
def set_user_from_token
diff --git a/app/controllers/public_body_change_requests_controller.rb b/app/controllers/public_body_change_requests_controller.rb
index 523e97e992..64788ef137 100644
--- a/app/controllers/public_body_change_requests_controller.rb
+++ b/app/controllers/public_body_change_requests_controller.rb
@@ -1,5 +1,5 @@
class PublicBodyChangeRequestsController < ApplicationController
- before_action :catch_spam, :only => [:create]
+ before_action :catch_spam, only: [:create]
before_action :set_render_recaptcha
def new
@@ -14,7 +14,7 @@ def new
@title =
if @change_request.public_body
_('Ask us to update the email address for {{public_body_name}}',
- :public_body_name => @change_request.public_body.name)
+ public_body_name: @change_request.public_body.name)
else
_('Ask us to add an authority')
end
@@ -28,8 +28,8 @@ def create
verified =
if @render_recaptcha
recaptcha_args = {
- :model => @change_request,
- :message => _('There was an error with the reCAPTCHA. ' \
+ model: @change_request,
+ message: _('There was an error with the reCAPTCHA. ' \
'Please try again.')
}
@@ -40,9 +40,9 @@ def create
if verified && @change_request.save
@change_request.send_message
- redirect_to frontpage_url, :notice => @change_request.thanks_notice
+ redirect_to frontpage_url, notice: @change_request.thanks_notice
else
- render :action => 'new'
+ render action: 'new'
end
end
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 754a0561c7..494146eb4c 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -22,7 +22,7 @@ def show
end
if MySociety::Format.simplify_url_part(params[:url_name], 'body') != params[:url_name]
- redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently
+ redirect_to url_name: MySociety::Format.simplify_url_part(params[:url_name], 'body'), status: :moved_permanently
return
end
@@ -39,7 +39,7 @@ def show
# If found by historic name, or alternate locale name, redirect to new name
if @public_body.url_name != params[:url_name]
- redirect_to :url_name => @public_body.url_name
+ redirect_to url_name: @public_body.url_name
return
end
@@ -56,7 +56,7 @@ def show
@view = params[:view]
- query = InfoRequestEvent.make_query_from_params(params.merge(:latest_status => @view))
+ query = InfoRequestEvent.make_query_from_params(params.merge(latest_status: @view))
query += " requested_from:#{@public_body.url_name}"
# Use search query for this so can collapse and paginate easily
@@ -79,15 +79,15 @@ def show
@existing_track = TrackThing.find_existing(@user, @track_thing) if @user
- @follower_count = TrackThing.where(:public_body_id => @public_body.id).count
+ @follower_count = TrackThing.where(public_body_id: @public_body.id).count
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'),
- :title => @track_thing.params[:title_in_rss],
- :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'),
+ title: @track_thing.params[:title_in_rss],
+ has_json: true } ]
respond_to do |format|
- format.html { @has_json = true; render :template => "public_body/show" }
- format.json { render :json => @public_body.json_for_api }
+ format.html { @has_json = true; render template: "public_body/show" }
+ format.json { render json: @public_body.json_for_api }
end
end
@@ -101,13 +101,13 @@ def view_email
if params[:submitted_view_email]
if verify_recaptcha
flash.discard(:error)
- render :template => "public_body/view_email"
+ render template: "public_body/view_email"
return
end
flash.now[:error] = _('There was an error with the reCAPTCHA. ' \
'Please try again.')
end
- render :template => "public_body/view_email_captcha"
+ render template: "public_body/view_email_captcha"
end
end
@@ -131,15 +131,15 @@ def list
n_('Found {{count}} public authority',
'Found {{count}} public authorities',
@public_bodies.total_entries,
- :count => @public_bodies.total_entries)
+ count: @public_bodies.total_entries)
elsif @tag.size == 1
n_('Found {{count}} public authority beginning with ' \
'‘{{first_letter}}’',
'Found {{count}} public authorities beginning with ' \
'‘{{first_letter}}’',
@public_bodies.total_entries,
- :count => @public_bodies.total_entries,
- :first_letter => @tag)
+ count: @public_bodies.total_entries,
+ first_letter: @tag)
else
category_name = PublicBodyCategory.get.by_tag[@tag]
if category_name.nil?
@@ -148,27 +148,27 @@ def list
'Found {{count}} public authorities matching the tag ' \
'‘{{tag_name}}’',
@public_bodies.total_entries,
- :count => @public_bodies.total_entries,
- :tag_name => @tag)
+ count: @public_bodies.total_entries,
+ tag_name: @tag)
else
n_('Found {{count}} public authority in the category ' \
'‘{{category_name}}’',
'Found {{count}} public authorities in the category ' \
'‘{{category_name}}’',
@public_bodies.total_entries,
- :count => @public_bodies.total_entries,
- :category_name => category_name)
+ count: @public_bodies.total_entries,
+ category_name: category_name)
end
end
- render :template => 'public_body/list'
+ render template: 'public_body/list'
end
end
# Used so URLs like /local/islington work, for use e.g. writing to a local paper.
def list_redirect
@tag = params[:tag]
- redirect_to list_public_bodies_url(:tag => @tag)
+ redirect_to list_public_bodies_url(tag: @tag)
end
# GET /body/all-authorities.csv
@@ -191,8 +191,8 @@ def search_typeahead
query = params[:query]
return head :bad_request unless query
flash[:search_params] = params.slice(:query, :bodies, :page)
- @xapian_requests = typeahead_search(query, :model => PublicBody)
- render :partial => "public_body/search_ahead"
+ @xapian_requests = typeahead_search(query, model: PublicBody)
+ render partial: "public_body/search_ahead"
end
end
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
index 166639a82d..9913f6f721 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -30,9 +30,9 @@ def create
def new
@title = if @comment
_("Report annotation on request: {{title}}",
- :title => @info_request.title)
+ title: @info_request.title)
else
- _("Report request: {{title}}", :title => @info_request.title)
+ _("Report request: {{title}}", title: @info_request.title)
end
return if authenticated?
@@ -56,7 +56,7 @@ def set_info_request
def set_comment
@comment = unless params[:comment_id].blank?
- @info_request.comments.where(:id => params[:comment_id]).first!
+ @info_request.comments.where(id: params[:comment_id]).first!
end
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 82de89a3cc..0c7cf6ff5a 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -10,13 +10,13 @@ class RequestController < ApplicationController
skip_before_action :html_response, only: [:show, :select_authorities]
before_action :check_read_only, only: [:new, :upload_response]
- before_action :set_render_recaptcha, :only => [ :new ]
- before_action :redirect_numeric_id_to_url_title, :only => [:show]
+ before_action :set_render_recaptcha, only: [ :new ]
+ before_action :redirect_numeric_id_to_url_title, only: [:show]
before_action :set_info_request, only: [:show]
- before_action :redirect_embargoed_requests_for_pro_users, :only => [:show]
- before_action :redirect_public_requests_from_pro_context, :only => [:show]
- before_action :redirect_new_form_to_pro_version, :only => [:select_authority, :new]
- before_action :set_in_pro_area, :only => [:select_authority, :show]
+ before_action :redirect_embargoed_requests_for_pro_users, only: [:show]
+ before_action :redirect_public_requests_from_pro_context, only: [:show]
+ before_action :redirect_new_form_to_pro_version, only: [:select_authority, :new]
+ before_action :set_in_pro_area, only: [:select_authority, :show]
helper_method :state_transitions_empty?
@@ -40,7 +40,7 @@ def select_authority
if !params[:query].nil?
query = params[:query]
flash[:search_params] = params.slice(:query, :bodies, :page)
- @xapian_requests = typeahead_search(query, :model => PublicBody)
+ @xapian_requests = typeahead_search(query, model: PublicBody)
end
medium_cache
end
@@ -92,11 +92,11 @@ def show
# Track corresponding to this page
@track_thing = TrackThing.create_track_for_request(@info_request)
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'), title: @track_thing.params[:title_in_rss], has_json: true } ]
respond_to do |format|
- format.html { @has_json = true; render :template => 'request/show' }
- format.json { render :json => @info_request.json_for_api(true) }
+ format.html { @has_json = true; render template: 'request/show' }
+ format.json { render json: @info_request.json_for_api(true) }
end
end
end
@@ -129,9 +129,9 @@ def similar
return render_hidden if cannot?(:read, @info_request)
@xapian_object = ActsAsXapian::Similar.new([InfoRequestEvent],
@info_request.info_request_events,
- :offset => (@page - 1) * @per_page,
- :limit => @per_page,
- :collapse_by_prefix => 'request_collapse')
+ offset: (@page - 1) * @per_page,
+ limit: @per_page,
+ collapse_by_prefix: 'request_collapse')
@matches_estimated = @xapian_object.matches_estimated
@show_no_more_than = (@matches_estimated > MAX_RESULTS) ? MAX_RESULTS : @matches_estimated
end
@@ -145,7 +145,7 @@ def list
@per_page = PER_PAGE
@max_results = MAX_RESULTS
if @view == "recent"
- return redirect_to request_list_all_url(:action => "list", :view => "all", :page => @page), :status => :moved_permanently
+ return redirect_to request_list_all_url(action: "list", view: "all", page: @page), status: :moved_permanently
end
# Later pages are very expensive to load
@@ -153,16 +153,16 @@ def list
raise ActiveRecord::RecordNotFound.new("Sorry. No pages after #{MAX_RESULTS / PER_PAGE}.")
end
- @filters = params.merge(:latest_status => @view)
+ @filters = params.merge(latest_status: @view)
if (@page > 1)
- @title = _("Browse and search requests (page {{count}})", :count => @page)
+ @title = _("Browse and search requests (page {{count}})", count: @page)
else
@title = _('Browse and search requests')
end
@track_thing = TrackThing.create_track_for_search_query(InfoRequestEvent.make_query_from_params(@filters))
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'), title: @track_thing.params[:title_in_rss], has_json: true } ]
# Don't let robots go more than 20 pages in
@no_crawl = true if @page > 20
@@ -183,7 +183,7 @@ def new
if !@user.nil? && params[:submitted_new_request].nil?
@undescribed_requests = @user.get_undescribed_requests
if @undescribed_requests.size > 1
- render :action => 'new_please_describe'
+ render action: 'new_please_describe'
return
end
end
@@ -199,7 +199,7 @@ def new
user_exceeded_limit = authenticated_user.exceeded_limit?(:info_requests)
if !user_exceeded_limit
@details = authenticated_user.can_fail_html
- render :template => 'user/banned'
+ render template: 'user/banned'
return
end
# User did exceed limit
@@ -209,7 +209,7 @@ def new
# First time we get to the page, just display it
if params[:submitted_new_request].nil? || params[:reedit]
if user_exceeded_limit
- render :template => 'user/rate_limited'
+ render template: 'user/rate_limited'
return
end
return render_new_compose
@@ -236,7 +236,7 @@ def new
# Maybe we lost the address while they're writing it
unless @info_request.public_body.is_requestable?
- render :action => "new_#{ @info_request.public_body.not_requestable_reason }"
+ render action: "new_#{ @info_request.public_body.not_requestable_reason }"
return
end
@@ -247,7 +247,7 @@ def new
# describing the reason it is invalid.
@info_request.errors.delete(:outgoing_messages)
- render :action => 'new'
+ render action: 'new'
return
end
@@ -255,7 +255,7 @@ def new
return render_new_preview if params[:preview].to_i == 1
if user_exceeded_limit
- render :template => 'user/rate_limited'
+ render template: 'user/rate_limited'
return
end
@@ -288,10 +288,10 @@ def new
if send_exception_notifications?
e = Exception.new("Possible blocked non-spam (recaptcha) from #{@info_request.user_id}: #{@info_request.title}")
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
- render :action => 'new'
+ render action: 'new'
return
end
end
@@ -331,7 +331,7 @@ def new
end
end
- redirect_to show_request_path(:url_title => @info_request.url_title)
+ redirect_to show_request_path(url_title: @info_request.url_title)
end
# Used for links from polymorphic URLs e.g. in Atom feeds - just redirect to
@@ -342,12 +342,12 @@ def show_request_event
raise ActiveRecord::RecordNotFound
end
if @info_request_event.is_incoming_message?
- redirect_to incoming_message_url(@info_request_event.incoming_message), :status => :moved_permanently
+ redirect_to incoming_message_url(@info_request_event.incoming_message), status: :moved_permanently
elsif @info_request_event.is_outgoing_message?
- redirect_to outgoing_message_url(@info_request_event.outgoing_message), :status => :moved_permanently
+ redirect_to outgoing_message_url(@info_request_event.outgoing_message), status: :moved_permanently
else
# TODO: maybe there are better URLs for some events than this
- redirect_to request_url(@info_request_event.info_request), :status => :moved_permanently
+ redirect_to request_url(@info_request_event.info_request), status: :moved_permanently
end
end
@@ -373,11 +373,11 @@ def upload_response
if !@info_request.public_body.is_foi_officer?(@user)
domain_required = @info_request.public_body.foi_officer_domain_required
if domain_required.nil?
- render :template => 'user/wrong_user_unknown_email'
+ render template: 'user/wrong_user_unknown_email'
return
end
@reason_params[:user_name] = "an email @" + domain_required
- render :template => 'user/wrong_user'
+ render template: 'user/wrong_user'
return
end
end
@@ -401,11 +401,11 @@ def upload_response
@info_request.
receive(mail,
mail.encoded,
- :override_stop_new_responses => true)
+ override_stop_new_responses: true)
flash[:notice] = _("Thank you for responding to this FOI request! " \
"Your response has been published below, and a " \
"link to your response has been emailed to {{user_name}}.",
- :user_name => @info_request.user.name.html_safe)
+ user_name: @info_request.user.name.html_safe)
redirect_to request_url(@info_request)
return
end
@@ -425,9 +425,9 @@ def search_typeahead
@query << params[:q].to_s
@xapian_requests = typeahead_search(@query,
- { :model => InfoRequestEvent,
- :per_page => @per_page })
- render :partial => "request/search_ahead"
+ { model: InfoRequestEvent,
+ per_page: @per_page })
+ render partial: "request/search_ahead"
end
def download_entire_request
@@ -455,7 +455,7 @@ def download_entire_request
make_request_zip(@info_request, cache_file_path)
File.chmod(0644, cache_file_path)
end
- send_file(cache_file_path, :filename => "#{@info_request.url_title}.zip")
+ send_file(cache_file_path, filename: "#{@info_request.url_title}.zip")
end
end
end
@@ -573,7 +573,7 @@ def make_request_summary_file(info_request)
@render_to_file = true
assign_variables_for_show_template(info_request)
if HTMLtoPDFConverter.exist?
- html_output = render_to_string(:template => 'request/show')
+ html_output = render_to_string(template: 'request/show')
tmp_input = Tempfile.new(['foihtml2pdf-input', '.html'])
tmp_input.write(html_output)
tmp_input.close
@@ -581,8 +581,8 @@ def make_request_summary_file(info_request)
command = HTMLtoPDFConverter.new(tmp_input, tmp_output)
output = command.run
if !output.nil?
- file_info = { :filename => 'correspondence.pdf',
- :data => File.open(tmp_output.path).read }
+ file_info = { filename: 'correspondence.pdf',
+ data: File.open(tmp_output.path).read }
done = true
else
logger.error("Could not convert info request #{info_request.id} to PDF with command '#{command}'")
@@ -594,10 +594,10 @@ def make_request_summary_file(info_request)
logger.warn("No HTML -> PDF converter found")
end
if !done
- file_info = { :filename => 'correspondence.txt',
- :data => render_to_string(:template => 'request/show',
- :layout => false,
- :formats => [:text]) }
+ file_info = { filename: 'correspondence.txt',
+ data: render_to_string(template: 'request/show',
+ layout: false,
+ formats: [:text]) }
end
file_info
end
@@ -641,9 +641,9 @@ def render_new_compose
# non-standard arrangement.
message_params =
if params[:outgoing_message]
- { :outgoing_message => params[:outgoing_message] }
+ { outgoing_message: params[:outgoing_message] }
else
- { :outgoing_message => {} }
+ { outgoing_message: {} }
end
message_params[:outgoing_message][:body] ||= params[:body] if params[:body]
@@ -653,9 +653,9 @@ def render_new_compose
message_params = ActionController::Parameters.new(message_params)
permitted = message_params.
- permit(:outgoing_message => [:body, :default_letter, :what_doing])
+ permit(outgoing_message: [:body, :default_letter, :what_doing])
- @outgoing_message = OutgoingMessage.new(:info_request => @info_request)
+ @outgoing_message = OutgoingMessage.new(info_request: @info_request)
if permitted[:outgoing_message][:body]
@outgoing_message.body = permitted[:outgoing_message][:body]
@@ -669,10 +669,10 @@ def render_new_compose
@outgoing_message.set_signature_name(@user.name) if !@user.nil?
if @info_request.public_body.is_requestable?
- render :action => 'new'
+ render action: 'new'
else
if @info_request.public_body.not_requestable_reason == 'bad_contact'
- render :action => 'new_bad_contact'
+ render action: 'new_bad_contact'
else
# if not requestable because defunct or not_apply, redirect to main page
# (which doesn't link to the /new/ URL)
@@ -686,16 +686,16 @@ def render_new_compose
def render_new_preview
if @outgoing_message.contains_email? || @outgoing_message.contains_postcode?
flash.now[:error] = {
- :partial => "preview_errors",
- :locals => {
- :contains_email => @outgoing_message.contains_email?,
- :contains_postcode => @outgoing_message.contains_postcode?,
- :help_link => help_privacy_path(:anchor => "email_address"),
- :user => @user
+ partial: "preview_errors",
+ locals: {
+ contains_email: @outgoing_message.contains_email?,
+ contains_postcode: @outgoing_message.contains_postcode?,
+ help_link: help_privacy_path(anchor: "email_address"),
+ user: @user
}
}
end
- render :action => 'preview'
+ render action: 'preview'
end
def set_render_recaptcha
@@ -710,7 +710,7 @@ def redirect_numeric_id_to_url_title
# We don't want to leak the title of embargoed or hidden requests, so
# don't even redirect on if the user can't access the request
return render_hidden if cannot?(:read, @info_request)
- redirect_to request_url(@info_request, :format => params[:format])
+ redirect_to request_url(@info_request, format: params[:format])
end
end
@@ -722,7 +722,7 @@ def redirect_embargoed_requests_for_pro_users
@info_request = InfoRequest.find_by_url_title!(params[:url_title])
if @info_request.is_actual_owning_user?(current_user) && @info_request.embargo
redirect_to show_alaveteli_pro_request_url(
- :url_title => @info_request.url_title)
+ url_title: @info_request.url_title)
end
end
end
@@ -775,13 +775,13 @@ def block_spam_subject?
def handle_spam_subject(user)
if send_exception_notifications?
e = Exception.new("Spam request from user #{ user.id }")
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
if block_spam_subject?
flash.now[:error] = _("Sorry, we're currently unable to send your " \
"request. Please try again later.")
- render :action => 'new'
+ render action: 'new'
true
end
end
@@ -807,7 +807,7 @@ def handle_blocked_ip(info_request)
if block_restricted_country_ips?
flash.now[:error] = _("Sorry, we're currently unable to send your " \
"request. Please try again later.")
- render :action => 'new'
+ render action: 'new'
true
end
end
diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb
index f7bf70ba42..0af3622dff 100644
--- a/app/controllers/request_game_controller.rb
+++ b/app/controllers/request_game_controller.rb
@@ -29,10 +29,10 @@ def play
if @missing == 0
flash.now[:notice] = {
- :partial => "request_game/game_over",
- :locals => {
- :helpus_url => help_credits_path(:anchor => "helpus"),
- :site_name => site_name
+ partial: "request_game/game_over",
+ locals: {
+ helpus_url: help_credits_path(anchor: "helpus"),
+ site_name: site_name
}
}
end
@@ -53,7 +53,7 @@ def show
)
return
end
- redirect_to show_request_url(:url_title => url_title)
+ redirect_to show_request_url(url_title: url_title)
end
def stop
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index a19531e855..3e5fad9a09 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -53,7 +53,7 @@ def other_country_message
end
# TODO: workaround the HTML validation in test suite
- render :plain => text
+ render plain: text
end
def hidden_user_explanation
@@ -95,26 +95,26 @@ def user_site_and_eu_site_msg(country_name, country_link)
_("Hello! You can make Freedom of Information requests within " \
"{{country_name}} at {{link_to_website}} and to EU " \
"institutions at {{link_to_asktheeu}}",
- :country_name => country_name,
- :link_to_website => country_link.html_safe,
- :link_to_asktheeu => ask_the_eu_link.html_safe)
+ country_name: country_name,
+ link_to_website: country_link.html_safe,
+ link_to_asktheeu: ask_the_eu_link.html_safe)
end
def user_site_msg(country_name, country_link)
_("Hello! You can make Freedom of Information requests within " \
"{{country_name}} at {{link_to_website}}",
- :country_name => country_name,
- :link_to_website => country_link.html_safe)
+ country_name: country_name,
+ link_to_website: country_link.html_safe)
end
def no_user_site_msg(country_name = nil)
if country_name
_("Hello! We have an important message for visitors outside {{country_name}}",
- :country_name => country_name,
- :url => "/help/alaveteli?country_name=#{CGI.escape(country_name)}")
+ country_name: country_name,
+ url: "/help/alaveteli?country_name=#{CGI.escape(country_name)}")
else
_("Hello! We have an important message for visitors in other countries",
- :url => "/help/alaveteli")
+ url: "/help/alaveteli")
end
end
@@ -123,15 +123,15 @@ def no_user_site_eu_msg(country_name = nil)
_("Hello! We have an important message for " \
"visitors outside {{country_name}}. You can also make Freedom of " \
"Information requests to EU institutions at {{link_to_asktheeu}}",
- :country_name => country_name,
- :url => "/help/alaveteli?country_name=#{CGI.escape(country_name)}",
- :link_to_asktheeu => ask_the_eu_link.html_safe)
+ country_name: country_name,
+ url: "/help/alaveteli?country_name=#{CGI.escape(country_name)}",
+ link_to_asktheeu: ask_the_eu_link.html_safe)
else
_("Hello! We have an important message for " \
"visitors in other countries. You can also make Freedom of " \
"Information requests to EU institutions at {{link_to_asktheeu}}",
- :url => "/help/alaveteli",
- :link_to_asktheeu => ask_the_eu_link.html_safe)
+ url: "/help/alaveteli",
+ link_to_asktheeu: ask_the_eu_link.html_safe)
end
end
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 165e4b79d1..5eb42e214e 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -23,7 +23,7 @@ def track_request
if AlaveteliConfiguration.enable_widgets && cookies[:widget_vote]
@info_request.
widget_votes.
- where(:cookie => cookies[:widget_vote]).
+ where(cookie: cookies[:widget_vote]).
destroy_all
end
@@ -46,7 +46,7 @@ def track_list
return atom_feed_internal if params[:feed] == 'feed'
if track_set || @track_thing.errors.any?
- redirect_to request_list_url(:view => @view)
+ redirect_to request_list_url(view: @view)
end
end
@@ -56,7 +56,7 @@ def track_public_body
raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
# If found by historic name, or alternate locale name, redirect to new name
if @public_body.url_name != params[:url_name]
- redirect_to track_public_body_url(:url_name => @public_body.url_name, :feed => params[:feed], :event_type => params[:event_type])
+ redirect_to track_public_body_url(url_name: @public_body.url_name, feed: params[:feed], event_type: params[:event_type])
return
end
@@ -127,8 +127,8 @@ def track_set
@existing_track = TrackThing.find_existing(@user, @track_thing)
if @existing_track
flash[:notice] =
- { :partial => 'track/already_tracking',
- :locals => { :track_thing_id => @existing_track.id } }
+ { partial: 'track/already_tracking',
+ locals: { track_thing_id: @existing_track.id } }
return true
end
end
@@ -142,11 +142,11 @@ def track_set
@track_thing.tracking_user_id = @user.id
if @track_thing.save
flash[:notice] =
- { :partial => 'track/track_set',
- :locals => {
- :user_receive_email_alerts => @user.receive_email_alerts,
- :user_url_name => @user.url_name,
- :track_thing_id => @track_thing.id } }
+ { partial: 'track/track_set',
+ locals: {
+ user_receive_email_alerts: @user.receive_email_alerts,
+ user_url_name: @user.url_name,
+ track_thing_id: @track_thing.id } }
return true
else
# this will most likely be tripped by a single error - probably track_query length
@@ -165,7 +165,7 @@ def atom_feed
if @track_thing.track_medium != 'feed'
raise "can only view feeds for feed tracks, not email ones"
end
- redirect_to do_track_url(@track_thing, 'feed'), :status => :moved_permanently
+ redirect_to do_track_url(@track_thing, 'feed'), status: :moved_permanently
end
def atom_feed_internal
@@ -177,21 +177,21 @@ def atom_feed_internal
# so set that as the default, regardless of content negotiation
request.format = params[:format] || 'xml'
respond_to do |format|
- format.json { render :json => @xapian_object.results.map { |r| r[:model].json_for_api(true,
+ format.json { render json: @xapian_object.results.map { |r| r[:model].json_for_api(true,
lambda do |t|
view_context.highlight_and_excerpt(
t,
@xapian_object.words_to_highlight(
- :regex => true,
- :include_original => true),
+ regex: true,
+ include_original: true),
150
)
end
) } }
- format.any { render :template => 'track/atom_feed',
- :formats => [:atom],
- :layout => false,
- :content_type => 'application/atom+xml' }
+ format.any { render template: 'track/atom_feed',
+ formats: [:atom],
+ layout: false,
+ content_type: 'application/atom+xml' }
end
end
@@ -245,7 +245,7 @@ def delete_all_type
flash[:notice] = _("You will no longer be emailed updates for those alerts")
TrackThing.
- where(:track_type => track_type, :tracking_user_id => user_id).
+ where(track_type: track_type, tracking_user_id: user_id).
destroy_all
redirect_to SafeRedirect.new(params[:r]).path
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 9b3101c4cd..545f32a679 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -14,10 +14,10 @@ class UserController < ApplicationController
]
layout :select_layout
- before_action :normalize_url_name, :only => :show
- before_action :work_out_post_redirect, :only => [ :signup ]
- before_action :set_request_from_foreign_country, :only => [ :signup ]
- before_action :set_in_pro_area, :only => [ :signup ]
+ before_action :normalize_url_name, only: :show
+ before_action :work_out_post_redirect, only: [ :signup ]
+ before_action :set_request_from_foreign_country, only: [ :signup ]
+ before_action :set_in_pro_area, only: [ :signup ]
# Normally we wouldn't be verifying the authenticity token on these actions
# anyway as there shouldn't be a user_id in the session when the before
@@ -25,7 +25,7 @@ class UserController < ApplicationController
# tries to sign in or sign up. There's little CSRF potential here as
# these actions only sign in or up users with valid credentials. The
# user_id in the session is not expected, and gives no extra privilege
- skip_before_action :verify_authenticity_token, :only => [:signin, :signup]
+ skip_before_action :verify_authenticity_token, only: [:signin, :signup]
# Show page about a user
def show
@@ -62,7 +62,7 @@ def show
# All tracks for the user
@track_things = TrackThing.
- where(:tracking_user_id => @display_user, :track_medium => 'email_daily').
+ where(tracking_user_id: @display_user, track_medium: 'email_daily').
order(created_at: :desc)
@track_things_grouped = @track_things.group_by(&:track_type)
# Requests you need to describe
@@ -71,7 +71,7 @@ def show
respond_to do |format|
format.html { @has_json = true }
- format.json { render :json => @display_user.json_for_api }
+ format.json { render json: @display_user.json_for_api }
end
end
@@ -104,16 +104,16 @@ def wall
# All tracks for the user
if @is_you
@track_things = TrackThing.
- where(:tracking_user_id => @display_user.id,
- :track_medium => 'email_daily').
+ where(tracking_user_id: @display_user.id,
+ track_medium: 'email_daily').
order(created_at: :desc)
@track_things.each do |track_thing|
# TODO: factor out of track_mailer.rb
xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], track_thing.track_query,
- :sort_by_prefix => 'described_at',
- :sort_by_ascending => true,
- :collapse_by_prefix => nil,
- :limit => 20)
+ sort_by_prefix: 'described_at',
+ sort_by_ascending: true,
+ collapse_by_prefix: nil,
+ limit: 20)
feed_results += xapian_object.results.map { |x| x[:model] }
end
end
@@ -124,7 +124,7 @@ def wall
respond_to do |format|
format.html { @has_json = true }
- format.json { render :json => @display_user.json_for_api }
+ format.json { render json: @display_user.json_for_api }
end
end
@@ -148,7 +148,7 @@ def signup
end
if error || !@user_signup.errors.empty?
# Show the form
- render :action => 'sign'
+ render action: 'sign'
else
if user_alreadyexists
already_registered_mail user_alreadyexists
@@ -216,7 +216,7 @@ def signchangeemail
)
unless params[:submitted_signchangeemail_do]
- render :action => 'signchangeemail'
+ render action: 'signchangeemail'
return
end
@@ -227,7 +227,7 @@ def signchangeemail
@signchangeemail.logged_in_user = @user
unless @signchangeemail.valid?
- render :action => 'signchangeemail'
+ render action: 'signchangeemail'
return
end
@@ -242,7 +242,7 @@ def signchangeemail
# it is important this screen looks the same as the one below, so
# you can't change to someone's email in order to tell if they are
# registered with that email on the site
- render :action => 'signchangeemail_confirm'
+ render action: 'signchangeemail_confirm'
return
end
@@ -259,7 +259,7 @@ def signchangeemail
circumstance: 'change_email'
)
- url = confirm_url(:email_token => post_redirect.email_token)
+ url = confirm_url(email_token: post_redirect.email_token)
UserMailer.
changeemail_confirm(
@user,
@@ -268,7 +268,7 @@ def signchangeemail
# it is important this screen looks the same as the one above, so
# you can't change to someone's email in order to tell if they are
# registered with that email on the site
- render :action => 'signchangeemail_confirm'
+ render action: 'signchangeemail_confirm'
return
end
@@ -280,7 +280,7 @@ def signchangeemail
# Now clear the circumstance
session[:user_circumstance] = nil
- flash[:notice] = _("You have now changed your email address used on {{site_name}}",:site_name=>site_name)
+ flash[:notice] = _("You have now changed your email address used on {{site_name}}",site_name: site_name)
redirect_to user_url(@user)
end
@@ -314,17 +314,17 @@ def set_profile_photo
end
# validate it
- @draft_profile_photo = ProfilePhoto.new(:data => file_content, :draft => true)
+ @draft_profile_photo = ProfilePhoto.new(data: file_content, draft: true)
unless @draft_profile_photo.valid?
# error page (uses @profile_photo's error fields in view to show errors)
- render :template => 'user/set_draft_profile_photo'
+ render template: 'user/set_draft_profile_photo'
return
end
@draft_profile_photo.save!
if params[:automatically_crop]
# no javascript, crop automatically
- @profile_photo = ProfilePhoto.new(:data => @draft_profile_photo.data, :draft => false)
+ @profile_photo = ProfilePhoto.new(data: @draft_profile_photo.data, draft: false)
@user.set_profile_photo(@profile_photo)
@draft_profile_photo.destroy
flash[:notice] = _("Thank you for updating your profile photo")
@@ -332,26 +332,26 @@ def set_profile_photo
return
end
- render :template => 'user/set_crop_profile_photo'
+ render template: 'user/set_crop_profile_photo'
return
elsif params[:submitted_crop_profile_photo].present?
# crop the draft photo according to jquery parameters and set it as the users photo
draft_profile_photo = ProfilePhoto.find(params[:draft_profile_photo_id])
- @profile_photo = ProfilePhoto.new(:data => draft_profile_photo.data, :draft => false,
- :x => params[:x], :y => params[:y], :w => params[:w], :h => params[:h])
+ @profile_photo = ProfilePhoto.new(data: draft_profile_photo.data, draft: false,
+ x: params[:x], y: params[:y], w: params[:w], h: params[:h])
@user.set_profile_photo(@profile_photo)
draft_profile_photo.destroy
if @user.get_about_me_for_html_display.empty?
- flash[:notice] = { :partial => "user/update_profile_photo" }
+ flash[:notice] = { partial: "user/update_profile_photo" }
redirect_to edit_profile_about_me_url
else
flash[:notice] = _("Thank you for updating your profile photo")
redirect_to user_url(@user)
end
else
- render :template => 'user/set_draft_profile_photo'
+ render template: 'user/set_draft_profile_photo'
end
end
@@ -373,8 +373,8 @@ def clear_profile_photo
# before they've cropped it
def get_draft_profile_photo
profile_photo = ProfilePhoto.find(params[:id])
- render :body => profile_photo.data,
- :content_type => 'image/png'
+ render body: profile_photo.data,
+ content_type: 'image/png'
end
# actual profile photo of a user
@@ -385,8 +385,8 @@ def get_profile_photo
raise ActiveRecord::RecordNotFound.new("user has no profile photo, url_name=" + params[:url_name])
end
- render :body => @display_user.profile_photo.data,
- :content_type => 'image/png'
+ render body: @display_user.profile_photo.data,
+ content_type: 'image/png'
end
# Change about me text on your profile page
@@ -439,7 +439,7 @@ def set_in_pro_area
def normalize_url_name
unless MySociety::Format.simplify_url_part(params[:url_name], 'user') == params[:url_name]
- redirect_to :url_name => MySociety::Format.simplify_url_part(params[:url_name], 'user'), :status => :moved_permanently
+ redirect_to url_name: MySociety::Format.simplify_url_part(params[:url_name], 'user'), status: :moved_permanently
end
end
@@ -500,14 +500,14 @@ def send_confirmation_mail(user)
post_redirect.user = user
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ url = confirm_url(email_token: post_redirect.email_token)
UserMailer.
confirm_login(
user,
post_redirect.reason_params,
url
).deliver_now
- render :action => 'confirm'
+ render action: 'confirm'
end
# If they register again
@@ -517,14 +517,14 @@ def already_registered_mail(user)
post_redirect.user = user
post_redirect.save!
- url = confirm_url(:email_token => post_redirect.email_token)
+ url = confirm_url(email_token: post_redirect.email_token)
UserMailer.
already_registered(
user,
post_redirect.reason_params,
url
).deliver_now
- render :action => 'confirm' # must be same as for send_confirmation_mail above to avoid leak of presence of email in db
+ render action: 'confirm' # must be same as for send_confirmation_mail above to avoid leak of presence of email in db
end
def assign_request_states(display_user)
@@ -550,12 +550,12 @@ def set_show_requests
if params[:user_query]
requests_query += " " + params[:user_query]
comments_query += " " + params[:user_query]
- @match_phrase = _("{{search_results}} matching '{{query}}'", :search_results => "", :query => params[:user_query])
+ @match_phrase = _("{{search_results}} matching '{{query}}'", search_results: "", query: params[:user_query])
unless params[:request_latest_status].blank?
requests_query << ' latest_status:' << params[:request_latest_status]
comments_query << ' latest_status:' << params[:request_latest_status]
- @match_phrase << _(" filtered by status: '{{status}}'", :status => params[:request_latest_status])
+ @match_phrase << _(" filtered by status: '{{status}}'", status: params[:request_latest_status])
end
end
@@ -572,7 +572,7 @@ def set_show_requests
# Track corresponding to this page
@track_thing = TrackThing.create_track_for_user(@display_user)
- @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
+ @feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'), title: @track_thing.params[:title_in_rss], has_json: true } ]
end
def current_user_is_display_user
@@ -591,12 +591,12 @@ def show_about_me?
# Redirects to front page later if nothing else specified
def generate_post_redirect_for_signup(redirect_to="/")
redirect_to = "/" if redirect_to.nil?
- PostRedirect.new(:uri => redirect_to,
- :post_params => {},
- :reason_params => {
- :web => "",
- :email => _("Then you can sign in to {{site_name}}", :site_name => site_name),
- :email_subject => _("Confirm your account on {{site_name}}", :site_name => site_name)
+ PostRedirect.new(uri: redirect_to,
+ post_params: {},
+ reason_params: {
+ web: "",
+ email: _("Then you can sign in to {{site_name}}", site_name: site_name),
+ email_subject: _("Confirm your account on {{site_name}}", site_name: site_name)
})
end
@@ -610,7 +610,7 @@ def handle_rate_limited_signup(user_ip, email_address)
msg = "Rate limited signup from #{ user_ip } email: " \
" #{ email_address }"
e = Exception.new(msg)
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
if block_rate_limited_ips?
@@ -618,7 +618,7 @@ def handle_rate_limited_signup(user_ip, email_address)
_("Sorry, we're currently unable to sign up new users, " \
"please try again later")
error = true
- render :action => 'sign'
+ render action: 'sign'
true
end
end
diff --git a/app/controllers/user_profile/about_me_controller.rb b/app/controllers/user_profile/about_me_controller.rb
index 981faaaeaa..a1987c9836 100644
--- a/app/controllers/user_profile/about_me_controller.rb
+++ b/app/controllers/user_profile/about_me_controller.rb
@@ -32,7 +32,7 @@ def update
flash[:notice] = _("You have now changed the text about you on your profile.")
redirect_to user_url(@user)
else
- flash[:notice] = { :partial => "update_profile_text" }
+ flash[:notice] = { partial: "update_profile_text" }
redirect_to set_profile_photo_url
end
else
@@ -52,7 +52,7 @@ def check_user_logged_in
def set_title
@title = _('Change the text about you on your profile at {{site_name}}',
- :site_name => site_name)
+ site_name: site_name)
end
def spam_about_me_text?(text, user)
@@ -68,7 +68,7 @@ def block_spam_about_me_text?
def handle_spam_about_me_text(user)
if send_exception_notifications?
e = Exception.new("Spam about me text from user #{ user.id }")
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
if block_spam_about_me_text?
diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb
index 850080334a..8584347fac 100644
--- a/app/controllers/users/confirmations_controller.rb
+++ b/app/controllers/users/confirmations_controller.rb
@@ -4,7 +4,7 @@ def confirm
post_redirect = PostRedirect.find_by_email_token(params[:email_token])
if post_redirect.nil? || !post_redirect.email_token_valid?
- render :template => 'user/bad_token'
+ render template: 'user/bad_token'
return
end
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb
index de26072db2..1b8f0252c7 100644
--- a/app/controllers/users/sessions_controller.rb
+++ b/app/controllers/users/sessions_controller.rb
@@ -1,9 +1,9 @@
class Users::SessionsController < UserController
include UserSpamCheck
- before_action :work_out_post_redirect, :only => [ :new, :create ]
- before_action :set_request_from_foreign_country, :only => [ :new, :create ]
- before_action :set_in_pro_area, :only => [ :new, :create ]
+ before_action :work_out_post_redirect, only: [ :new, :create ]
+ before_action :set_request_from_foreign_country, only: [ :new, :create ]
+ before_action :set_in_pro_area, only: [ :new, :create ]
# Normally we wouldn't be verifying the authenticity token on these actions
# anyway as there shouldn't be a user_id in the session when the before
@@ -11,7 +11,7 @@ class Users::SessionsController < UserController
# tries to sign in or sign up. There's little CSRF potential here as
# these actions only sign in or up users with valid credentials. The
# user_id in the session is not expected, and gives no extra privilege
- skip_before_action :verify_authenticity_token, :only => [:new, :create]
+ skip_before_action :verify_authenticity_token, only: [:new, :create]
def new
if @user
@@ -20,7 +20,7 @@ def new
return
end
- render :template => 'user/sign'
+ render template: 'user/sign'
end
def create
@@ -32,7 +32,7 @@ def create
if @post_redirect.nil? || @user_signin.errors.size > 0
# Failed to authenticate
clear_session_credentials
- render :template => 'user/sign'
+ render template: 'user/sign'
else
# Successful login
if @user_signin.email_confirmed
@@ -47,7 +47,7 @@ def create
sign_in(@user_signin, remember_me: params[:remember_me].present?)
if is_modal_dialog
- render :template => 'users/sessions/show'
+ render template: 'users/sessions/show'
else
do_post_redirect @post_redirect, @user_signin
end
diff --git a/app/controllers/widget_votes_controller.rb b/app/controllers/widget_votes_controller.rb
index 3ec63de86d..80be19f407 100644
--- a/app/controllers/widget_votes_controller.rb
+++ b/app/controllers/widget_votes_controller.rb
@@ -21,7 +21,7 @@ def create
end
@info_request.widget_votes.
- where(:cookie => cookie).
+ where(cookie: cookie).
first_or_create
end
@@ -42,7 +42,7 @@ def find_info_request
end
def check_prominence
- unless @info_request.prominence(:decorate => true).is_searchable?
+ unless @info_request.prominence(decorate: true).is_searchable?
head :forbidden
end
end
diff --git a/app/controllers/widgets_controller.rb b/app/controllers/widgets_controller.rb
index a7c4cc700d..0bf9a5c844 100644
--- a/app/controllers/widgets_controller.rb
+++ b/app/controllers/widgets_controller.rb
@@ -23,11 +23,11 @@ def show
unless @existing_track
@info_request.
widget_votes.
- where(:cookie => cookies[:widget_vote]).
+ where(cookie: cookies[:widget_vote]).
any?
end
- render :action => 'show', :layout => false
+ render action: 'show', layout: false
end
def new
@@ -47,7 +47,7 @@ def find_info_request
end
def check_prominence
- unless @info_request.prominence(:decorate => true).is_searchable?
+ unless @info_request.prominence(decorate: true).is_searchable?
head :forbidden
end
end
From eb5b669e4fc6721e773bd1f620d9ecddc92ae3c3 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 14:59:53 +0000
Subject: [PATCH 095/289] Style: HashSyntax RuboCop (spec controllers)
---
.../admin_censor_rule_controller_spec.rb | 278 +++---
.../admin_comment_controller_spec.rb | 74 +-
.../admin_general_controller_spec.rb | 13 +-
.../admin_holiday_imports_controller_spec.rb | 8 +-
.../admin_holidays_controller_spec.rb | 34 +-
.../admin_incoming_message_controller_spec.rb | 94 +-
...dmin_info_request_event_controller_spec.rb | 24 +-
.../admin_outgoing_message_controller_spec.rb | 46 +-
..._public_body_categories_controller_spec.rb | 377 ++++---
.../admin_public_body_controller_spec.rb | 315 +++---
...in_public_body_headings_controller_spec.rb | 270 ++---
.../admin_raw_email_controller_spec.rb | 26 +-
.../admin_request_controller_spec.rb | 82 +-
.../admin_spam_addresses_controller_spec.rb | 12 +-
.../controllers/admin_user_controller_spec.rb | 239 +++--
.../dashboard_controller_spec.rb | 4 +-
.../info_requests_controller_spec.rb | 4 +-
.../payment_methods_controller_spec.rb | 2 +-
.../alaveteli_pro/plans_controller_spec.rb | 6 +-
.../public_bodies_controller_spec.rb | 6 +-
.../subscriptions_controller_spec.rb | 12 +-
spec/controllers/api_controller_spec.rb | 192 ++--
.../attachments_controller_spec.rb | 105 +-
spec/controllers/comment_controller_spec.rb | 198 ++--
.../concerns/translatable_params_spec.rb | 64 +-
spec/controllers/followups_controller_spec.rb | 204 ++--
spec/controllers/general_controller_spec.rb | 64 +-
.../health_checks_controller_spec.rb | 6 +-
spec/controllers/help_controller_spec.rb | 48 +-
.../info_request_batch_controller_spec.rb | 20 +-
.../one_time_passwords_controller_spec.rb | 18 +-
.../delivery_statuses_controller_spec.rb | 2 +-
.../password_changes_controller_spec.rb | 180 ++--
...ic_body_change_requests_controller_spec.rb | 50 +-
.../public_body_controller_spec.rb | 124 +--
spec/controllers/reports_controller_spec.rb | 205 ++--
spec/controllers/request_controller_spec.rb | 924 +++++++++---------
.../request_game_controller_spec.rb | 8 +-
spec/controllers/services_controller_spec.rb | 2 +-
spec/controllers/track_controller_spec.rb | 210 ++--
spec/controllers/user_controller_spec.rb | 344 +++----
.../user_profile/about_me_controller_spec.rb | 115 ++-
.../users/confirmations_controller_spec.rb | 26 +-
.../users/sessions_controller_spec.rb | 134 +--
.../widget_votes_controller_spec.rb | 22 +-
spec/controllers/widgets_controller_spec.rb | 62 +-
46 files changed, 2614 insertions(+), 2639 deletions(-)
diff --git a/spec/controllers/admin_censor_rule_controller_spec.rb b/spec/controllers/admin_censor_rule_controller_spec.rb
index ecc56710a4..d99c311e2a 100644
--- a/spec/controllers/admin_censor_rule_controller_spec.rb
+++ b/spec/controllers/admin_censor_rule_controller_spec.rb
@@ -73,7 +73,7 @@
let(:info_request) { FactoryBot.create(:info_request) }
before do
- get :new, params: { :request_id => info_request.id }
+ get :new, params: { request_id: info_request.id }
end
it 'returns a successful response' do
@@ -108,7 +108,7 @@
let(:user) { FactoryBot.create(:user) }
before do
- get :new, params: { :user_id => user.id }
+ get :new, params: { user_id: user.id }
end
it 'returns a successful response' do
@@ -143,7 +143,7 @@
let(:public_body) { FactoryBot.create(:public_body) }
before do
- get :new, params: { :body_id => public_body.id }
+ get :new, params: { body_id: public_body.id }
end
it 'returns a successful response' do
@@ -187,7 +187,7 @@
end
def create_censor_rule
- post :create, params: { :censor_rule => censor_rule_params }
+ post :create, params: { censor_rule: censor_rule_params }
end
it 'sets the last_edit_editor to the current admin' do
@@ -269,32 +269,32 @@ def create_censor_rule
it 'sets the last_edit_editor to the current admin' do
post :create, params: {
- :request_id => info_request.id,
- :censor_rule => censor_rule_params
+ request_id: info_request.id,
+ censor_rule: censor_rule_params
}
expect(assigns[:censor_rule].last_edit_editor).to eq('*unknown*')
end
it 'finds an info request if the request_id param is supplied' do
post :create, params: {
- :request_id => info_request.id,
- :censor_rule => censor_rule_params
+ request_id: info_request.id,
+ censor_rule: censor_rule_params
}
expect(assigns[:info_request]).to eq(info_request)
end
it 'associates the info request with the new censor rule' do
post :create, params: {
- :request_id => info_request.id,
- :censor_rule => censor_rule_params
+ request_id: info_request.id,
+ censor_rule: censor_rule_params
}
expect(assigns[:censor_rule].info_request).to eq(info_request)
end
it 'sets the URL for the form to POST to' do
post :create, params: {
- :request_id => info_request.id,
- :censor_rule => censor_rule_params
+ request_id: info_request.id,
+ censor_rule: censor_rule_params
}
expect(assigns[:form_url]).
to eq(admin_request_censor_rules_path(info_request))
@@ -304,16 +304,16 @@ def create_censor_rule
it 'persists the censor rule' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
expect(assigns[:censor_rule]).to be_persisted
end
it 'confirms the censor rule is created' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
msg = 'Censor rule was successfully created.'
expect(flash[:notice]).to eq(msg)
@@ -322,15 +322,15 @@ def create_censor_rule
it 'calls expire_requests on the new censor_rule' do
allow(InfoRequest).to receive(:find).and_return(info_request)
censor_rule_spy = FactoryBot.build(:info_request_censor_rule,
- :info_request => info_request)
+ info_request: info_request)
allow(info_request.censor_rules).to receive(:build).
and_return(censor_rule_spy)
allow(censor_rule_spy).to receive(:expire_requests)
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
expect(censor_rule_spy).to have_received(:expire_requests)
@@ -338,8 +338,8 @@ def create_censor_rule
it 'redirects to the associated info request' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
expect(response).to redirect_to(
admin_request_path(assigns[:censor_rule].info_request)
@@ -355,16 +355,16 @@ def create_censor_rule
it 'does not persist the censor rule' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
expect(assigns[:censor_rule]).to be_new_record
end
it 'renders the form' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :request_id => info_request.id
+ censor_rule: censor_rule_params,
+ request_id: info_request.id
}
expect(response).to render_template('new')
end
@@ -377,7 +377,7 @@ def create_censor_rule
let(:user) { FactoryBot.create(:user) }
let(:censor_rule_params) do
- params = FactoryBot.attributes_for(:user_censor_rule, :user => user)
+ params = FactoryBot.attributes_for(:user_censor_rule, user: user)
# last_edit_editor gets set in the controller
params.delete(:last_edit_editor)
params
@@ -385,8 +385,8 @@ def create_censor_rule
def create_censor_rule
post :create, params: {
- :user_id => user.id,
- :censor_rule => censor_rule_params
+ user_id: user.id,
+ censor_rule: censor_rule_params
}
end
@@ -415,7 +415,7 @@ def create_censor_rule
it 'calls expire_requests on the new censor_rule' do
allow(User).to receive(:find) { user }
censor_rule = FactoryBot.build(:user_censor_rule,
- :user => user)
+ user: user)
allow(user.censor_rules).to receive(:build) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
@@ -441,16 +441,16 @@ def create_censor_rule
it 'does not persist the censor rule' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :user_id => user.id
+ censor_rule: censor_rule_params,
+ user_id: user.id
}
expect(assigns[:censor_rule]).to be_new_record
end
it 'renders the form' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :user_id => user.id
+ censor_rule: censor_rule_params,
+ user_id: user.id
}
expect(response).to render_template('new')
end
@@ -472,8 +472,8 @@ def create_censor_rule
before(:each) do
post :create, params: {
- :body_id => public_body.id,
- :censor_rule => censor_rule_params
+ body_id: public_body.id,
+ censor_rule: censor_rule_params
}
end
@@ -498,16 +498,16 @@ def create_censor_rule
it 'persists the censor rule' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
expect(assigns[:censor_rule]).to be_persisted
end
it 'confirms the censor rule is created' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
msg = 'Censor rule was successfully created.'
expect(flash[:notice]).to eq(msg)
@@ -516,13 +516,13 @@ def create_censor_rule
it 'calls expire_requests on the new censor_rule' do
allow(PublicBody).to receive(:find) { public_body }
censor_rule = FactoryBot.build(:public_body_censor_rule,
- :public_body => public_body)
+ public_body: public_body)
allow(public_body.censor_rules).to receive(:build) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
expect(censor_rule).to have_received(:expire_requests)
@@ -530,8 +530,8 @@ def create_censor_rule
it 'redirects to the associated public body' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
expect(response).to redirect_to(
admin_body_path(assigns[:censor_rule].public_body)
@@ -547,16 +547,16 @@ def create_censor_rule
it 'does not persist the censor rule' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
expect(assigns[:censor_rule]).to be_new_record
end
it 'renders the form' do
post :create, params: {
- :censor_rule => censor_rule_params,
- :body_id => public_body.id
+ censor_rule: censor_rule_params,
+ body_id: public_body.id
}
expect(response).to render_template('new')
end
@@ -573,17 +573,17 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:info_request_censor_rule) }
it 'returns a successful response' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to be_successful
end
it 'renders the correct template' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to render_template('edit')
end
it 'finds the correct censor rule to edit' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
@@ -594,17 +594,17 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:user_censor_rule) }
it 'returns a successful response' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to be_successful
end
it 'renders the correct template' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to render_template('edit')
end
it 'finds the correct censor rule to edit' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
@@ -615,17 +615,17 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:public_body_censor_rule) }
it 'returns a successful response' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to be_successful
end
it 'renders the correct template' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to render_template('edit')
end
it 'finds the correct censor rule to edit' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
@@ -636,17 +636,17 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:global_censor_rule) }
it 'returns a successful response' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to be_successful
end
it 'renders the correct template' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(response).to render_template('edit')
end
it 'finds the correct censor rule to edit' do
- get :edit, params: { :id => censor_rule.id }
+ get :edit, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
@@ -662,8 +662,8 @@ def create_censor_rule
it 'finds the correct censor rule to edit' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule]).to eq(censor_rule)
@@ -671,8 +671,8 @@ def create_censor_rule
it 'sets the last_edit_editor to the current admin' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule].last_edit_editor).to eq('*unknown*')
@@ -682,8 +682,8 @@ def create_censor_rule
it 'updates the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('different text')
@@ -691,8 +691,8 @@ def create_censor_rule
it 'confirms the censor rule is updated' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
msg = 'Censor rule was successfully updated.'
expect(flash[:notice]).to eq(msg)
@@ -702,8 +702,8 @@ def create_censor_rule
allow(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(censor_rule).to have_received(:expire_requests)
@@ -711,8 +711,8 @@ def create_censor_rule
it 'redirects to the censor rule index' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to redirect_to(admin_censor_rules_path)
@@ -728,8 +728,8 @@ def create_censor_rule
it 'does not update the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('some text to redact')
@@ -737,8 +737,8 @@ def create_censor_rule
it 'renders the form' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to render_template('edit')
@@ -754,8 +754,8 @@ def create_censor_rule
it 'finds the correct censor rule to edit' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule]).to eq(censor_rule)
@@ -763,8 +763,8 @@ def create_censor_rule
it 'sets the last_edit_editor to the current admin' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule].last_edit_editor).to eq('*unknown*')
@@ -774,8 +774,8 @@ def create_censor_rule
it 'updates the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('different text')
@@ -783,8 +783,8 @@ def create_censor_rule
it 'confirms the censor rule is updated' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
msg = 'Censor rule was successfully updated.'
expect(flash[:notice]).to eq(msg)
@@ -794,8 +794,8 @@ def create_censor_rule
allow(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(censor_rule).to have_received(:expire_requests)
@@ -803,8 +803,8 @@ def create_censor_rule
it 'redirects to the associated info request' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to redirect_to(
@@ -822,8 +822,8 @@ def create_censor_rule
it 'does not update the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('some text to redact')
@@ -831,8 +831,8 @@ def create_censor_rule
it 'renders the form' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to render_template('edit')
@@ -848,8 +848,8 @@ def create_censor_rule
it 'finds the correct censor rule to edit' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule]).to eq(censor_rule)
@@ -857,8 +857,8 @@ def create_censor_rule
it 'sets the last_edit_editor to the current admin' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule].last_edit_editor).to eq('*unknown*')
@@ -867,8 +867,8 @@ def create_censor_rule
context 'successfully saving the censor rule' do
it 'updates the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('different text')
@@ -876,8 +876,8 @@ def create_censor_rule
it 'confirms the censor rule is updated' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
msg = 'Censor rule was successfully updated.'
expect(flash[:notice]).to eq(msg)
@@ -887,8 +887,8 @@ def create_censor_rule
allow(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(censor_rule).to have_received(:expire_requests)
@@ -896,8 +896,8 @@ def create_censor_rule
it 'redirects to the associated info request' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to redirect_to(
@@ -914,8 +914,8 @@ def create_censor_rule
it 'does not update the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('some text to redact')
@@ -923,8 +923,8 @@ def create_censor_rule
it 'renders the form' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to render_template('edit')
@@ -940,8 +940,8 @@ def create_censor_rule
it 'finds the correct censor rule to edit' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule]).to eq(censor_rule)
@@ -949,8 +949,8 @@ def create_censor_rule
it 'sets the last_edit_editor to the current admin' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(assigns[:censor_rule].last_edit_editor).to eq('*unknown*')
@@ -960,8 +960,8 @@ def create_censor_rule
it 'updates the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('different text')
@@ -969,8 +969,8 @@ def create_censor_rule
it 'confirms the censor rule is updated' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
msg = 'Censor rule was successfully updated.'
expect(flash[:notice]).to eq(msg)
@@ -980,8 +980,8 @@ def create_censor_rule
allow(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(censor_rule).to have_received(:expire_requests)
@@ -989,8 +989,8 @@ def create_censor_rule
it 'redirects to the associated public body' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to redirect_to(
@@ -1008,8 +1008,8 @@ def create_censor_rule
it 'does not update the censor rule' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
censor_rule.reload
expect(censor_rule.text).to eq('some text to redact')
@@ -1017,8 +1017,8 @@ def create_censor_rule
it 'renders the form' do
put :update, params: {
- :id => censor_rule.id,
- :censor_rule => { :text => 'different text' }
+ id: censor_rule.id,
+ censor_rule: { text: 'different text' }
}
expect(response).to render_template('edit')
@@ -1037,18 +1037,18 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:global_censor_rule) }
it 'finds the correct censor rule to destroy' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
it 'confirms the censor rule is destroyed in all cases' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
msg = 'Censor rule was successfully destroyed.'
expect(flash[:notice]).to eq(msg)
end
it 'redirects to the censor rules index' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(response).to redirect_to(admin_censor_rules_path)
end
@@ -1059,12 +1059,12 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:info_request_censor_rule) }
it 'finds the correct censor rule to destroy' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
it 'confirms the censor rule is destroyed in all cases' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
msg = 'Censor rule was successfully destroyed.'
expect(flash[:notice]).to eq(msg)
end
@@ -1072,13 +1072,13 @@ def create_censor_rule
it 'calls expire_requests on the censor rule' do
expect(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(censor_rule).to have_received(:expire_requests)
end
it 'redirects to the associated info request' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(response).
to redirect_to(admin_request_path(censor_rule.info_request))
end
@@ -1090,12 +1090,12 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:user_censor_rule) }
it 'finds the correct censor rule to destroy' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
it 'confirms the censor rule is destroyed in all cases' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
msg = 'Censor rule was successfully destroyed.'
expect(flash[:notice]).to eq(msg)
end
@@ -1103,13 +1103,13 @@ def create_censor_rule
it 'calls expire_requests on the censor rule' do
expect(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(censor_rule).to have_received(:expire_requests)
end
it 'redirects to the associated info request' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(response).to redirect_to(admin_user_path(censor_rule.user))
end
@@ -1120,12 +1120,12 @@ def create_censor_rule
let(:censor_rule) { FactoryBot.create(:public_body_censor_rule) }
it 'finds the correct censor rule to destroy' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(assigns[:censor_rule]).to eq(censor_rule)
end
it 'confirms the censor rule is destroyed in all cases' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
msg = 'Censor rule was successfully destroyed.'
expect(flash[:notice]).to eq(msg)
end
@@ -1133,13 +1133,13 @@ def create_censor_rule
it 'calls expire_requests on the censor rule' do
expect(CensorRule).to receive(:find) { censor_rule }
allow(censor_rule).to receive(:expire_requests)
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(censor_rule).to have_received(:expire_requests)
end
it 'redirects to the associated public body' do
- delete :destroy, params: { :id => censor_rule.id }
+ delete :destroy, params: { id: censor_rule.id }
expect(response).
to redirect_to(admin_body_path(censor_rule.public_body))
end
diff --git a/spec/controllers/admin_comment_controller_spec.rb b/spec/controllers/admin_comment_controller_spec.rb
index 19812fbe24..4eb0bb4ed7 100644
--- a/spec/controllers/admin_comment_controller_spec.rb
+++ b/spec/controllers/admin_comment_controller_spec.rb
@@ -25,17 +25,17 @@
it 'assigns the query' do
sign_in admin_user
- get :index, params: { :query => 'hello' }
+ get :index, params: { query: 'hello' }
expect(assigns[:query]).to eq('hello')
end
it 'filters comments by the search query' do
Comment.destroy_all
- comment_1 = FactoryBot.create(:comment, :body => 'Hello world')
- comment_2 = FactoryBot.create(:comment, :body => 'Hi! hello world')
- comment_3 = FactoryBot.create(:comment, :body => 'xyz')
+ comment_1 = FactoryBot.create(:comment, body: 'Hello world')
+ comment_2 = FactoryBot.create(:comment, body: 'Hi! hello world')
+ comment_3 = FactoryBot.create(:comment, body: 'xyz')
sign_in admin_user
- get :index, params: { :query => 'hello' }
+ get :index, params: { query: 'hello' }
expect(assigns[:comments]).to eq([comment_2, comment_1])
end
@@ -94,13 +94,13 @@
it 'renders the edit template' do
sign_in admin_user
- get :edit, params: { :id => comment.id }
+ get :edit, params: { id: comment.id }
expect(response).to render_template('edit')
end
it 'gets the comment' do
sign_in admin_user
- get :edit, params: { :id => comment.id }
+ get :edit, params: { id: comment.id }
expect(assigns[:comment]).to eq(comment)
end
@@ -114,7 +114,7 @@
comment.info_request.create_embargo
expect {
sign_in admin_user
- get :edit, params: { :id => comment.id }
+ get :edit, params: { id: comment.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
@@ -126,7 +126,7 @@
with_feature_enabled(:alaveteli_pro) do
comment.info_request.create_embargo
sign_in pro_admin_user
- get :edit, params: { :id => comment.id }
+ get :edit, params: { id: comment.id }
expect(response).to render_template('edit')
end
end
@@ -138,25 +138,25 @@
let(:pro_admin_user) { FactoryBot.create(:pro_admin_user) }
let(:admin_user) { FactoryBot.create(:admin_user) }
let(:comment) { FactoryBot.create(:comment) }
- let(:atts) { FactoryBot.attributes_for(:comment, :body => 'I am new') }
+ let(:atts) { FactoryBot.attributes_for(:comment, body: 'I am new') }
context 'on valid data submission' do
it 'gets the comment' do
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
expect(assigns[:comment]).to eq(comment)
end
it 'updates the comment' do
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
expect(Comment.find(comment.id).body).to eq('I am new')
end
it 'logs the update event' do
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
most_recent_event = Comment.find(comment.id).info_request_events.last
expect(most_recent_event.event_type).to eq('edit_comment')
expect(most_recent_event.comment_id).to eq(comment.id)
@@ -165,13 +165,13 @@
context 'the attention_requested flag is the only change' do
let(:atts) do
FactoryBot.attributes_for(:comment,
- :body => comment.body,
- :attention_requested => true)
+ body: comment.body,
+ attention_requested: true)
end
before do
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
end
it 'logs the update event' do
@@ -182,9 +182,9 @@
it 'captures the old and new attention_requested values' do
most_recent_event = Comment.find(comment.id).info_request_events.last
expect(most_recent_event.params).
- to include(:old_attention_requested => false)
+ to include(old_attention_requested: false)
expect(most_recent_event.params).
- to include(:attention_requested => true)
+ to include(attention_requested: true)
end
it 'updates the comment' do
@@ -199,10 +199,10 @@
it 'logs a "hide_comment" event' do
atts = FactoryBot.attributes_for(:comment,
- :attention_requested => true,
- :visible => false)
+ attention_requested: true,
+ visible: false)
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
last_event = Comment.find(comment.id).info_request_events.last
expect(last_event.event_type).to eq('hide_comment')
@@ -214,11 +214,11 @@
it 'logs an "edit_comment" event' do
atts = FactoryBot.attributes_for(:comment,
- :attention_requested => true,
- :visible => false,
- :body => 'updated text')
+ attention_requested: true,
+ visible: false,
+ body: 'updated text')
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
last_event = Comment.find(comment.id).info_request_events.last
expect(last_event.event_type).to eq('edit_comment')
@@ -230,21 +230,21 @@
it 'shows a success notice' do
atts = FactoryBot.attributes_for(:comment,
- :attention_requested => true,
- :visible => false,
- :body => 'updated text')
+ attention_requested: true,
+ visible: false,
+ body: 'updated text')
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
expect(flash[:notice]).to eq("Comment successfully updated.")
end
it 'redirects to the request page' do
atts = FactoryBot.attributes_for(:comment,
- :attention_requested => true,
- :visible => false,
- :body => 'updated text')
+ attention_requested: true,
+ visible: false,
+ body: 'updated text')
sign_in admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
expect(response).to redirect_to(admin_request_path(comment.info_request))
end
end
@@ -255,8 +255,8 @@
with_feature_enabled(:alaveteli_pro) do
sign_in admin_user
put :update, params: {
- :id => comment.id,
- :comment => { :body => '' }
+ id: comment.id,
+ comment: { body: '' }
}
expect(response).to render_template('edit')
end
@@ -274,7 +274,7 @@
comment.info_request.create_embargo
expect {
sign_in admin_user
- put :update, params: { :id => comment.id }
+ put :update, params: { id: comment.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
@@ -286,7 +286,7 @@
with_feature_enabled(:alaveteli_pro) do
comment.info_request.create_embargo
sign_in pro_admin_user
- put :update, params: { :id => comment.id, :comment => atts }
+ put :update, params: { id: comment.id, comment: atts }
expect(Comment.find(comment.id).body).to eq('I am new')
end
end
diff --git a/spec/controllers/admin_general_controller_spec.rb b/spec/controllers/admin_general_controller_spec.rb
index 2d963f9983..8fd21e3564 100644
--- a/spec/controllers/admin_general_controller_spec.rb
+++ b/spec/controllers/admin_general_controller_spec.rb
@@ -54,7 +54,7 @@
it 'assigns messages sent to the holding pen to the view' do
undeliverable = FactoryBot.
create(:incoming_message,
- :info_request => InfoRequest.holding_pen_request)
+ info_request: InfoRequest.holding_pen_request)
sign_in admin_user
get :index
expect(assigns[:holding_pen_messages]).to eq([undeliverable])
@@ -65,8 +65,7 @@
it 'assigns public_request_tasks to true' do
undeliverable = FactoryBot.
create(:incoming_message,
- :info_request =>
- InfoRequest.holding_pen_request)
+ info_request: InfoRequest.holding_pen_request)
sign_in admin_user
get :index
expect(assigns[:public_request_tasks]).to be true
@@ -329,7 +328,7 @@
public_body.save!
public_body.reload
@second_public_body_version = public_body.versions.latest
- get :timeline, params: { :all => 1 }
+ get :timeline, params: { all: 1 }
end
it 'assigns an array of events in order of descending date to the view' do
@@ -347,8 +346,8 @@
before do
get :timeline, params: {
- :all => 1,
- :event_type => 'info_request_event'
+ all: 1,
+ event_type: 'info_request_event'
}
end
@@ -366,7 +365,7 @@
context 'when event_type is authority_change' do
before do
- get :timeline, params: { :all => 1, :event_type => 'authority_change' }
+ get :timeline, params: { all: 1, event_type: 'authority_change' }
end
it 'assigns an array of public body versions in order of descending
diff --git a/spec/controllers/admin_holiday_imports_controller_spec.rb b/spec/controllers/admin_holiday_imports_controller_spec.rb
index 8030aabbb7..e3f3786ba7 100644
--- a/spec/controllers/admin_holiday_imports_controller_spec.rb
+++ b/spec/controllers/admin_holiday_imports_controller_spec.rb
@@ -17,8 +17,8 @@
describe 'if the import is valid' do
it 'populates the import' do
- mock_import = double(HolidayImport, :valid? => true,
- :populate => nil)
+ mock_import = double(HolidayImport, valid?: true,
+ populate: nil)
allow(HolidayImport).to receive(:new).and_return(mock_import)
expect(mock_import).to receive(:populate)
get :new
@@ -70,7 +70,7 @@
describe 'if the import can be saved' do
before do
- mock_import = double(HolidayImport, :save => true)
+ mock_import = double(HolidayImport, save: true)
allow(HolidayImport).to receive(:new).and_return(mock_import)
post :create
end
@@ -88,7 +88,7 @@
describe 'if the import cannot be saved' do
before do
- mock_import = double(HolidayImport, :save => false)
+ mock_import = double(HolidayImport, save: false)
allow(HolidayImport).to receive(:new).and_return(mock_import)
post :create
end
diff --git a/spec/controllers/admin_holidays_controller_spec.rb b/spec/controllers/admin_holidays_controller_spec.rb
index 3f5d143caa..b00d57a4ba 100644
--- a/spec/controllers/admin_holidays_controller_spec.rb
+++ b/spec/controllers/admin_holidays_controller_spec.rb
@@ -5,9 +5,9 @@
describe 'GET index' do
before do
- @holiday_one = FactoryBot.create(:holiday, :day => Date.new(2010, 1, 1))
- @holiday_two = FactoryBot.create(:holiday, :day => Date.new(2011, 2, 2))
- @holiday_three = FactoryBot.create(:holiday, :day => Date.new(2011, 3, 3))
+ @holiday_one = FactoryBot.create(:holiday, day: Date.new(2010, 1, 1))
+ @holiday_two = FactoryBot.create(:holiday, day: Date.new(2011, 2, 2))
+ @holiday_three = FactoryBot.create(:holiday, day: Date.new(2011, 3, 3))
end
it 'gets a hash of holidays keyed by year' do
@@ -46,7 +46,7 @@
it 'renders the new form partial' do
get :new, xhr: true
- expect(response).to render_template(:partial => '_new_form')
+ expect(response).to render_template(partial: '_new_form')
end
end
@@ -64,7 +64,7 @@
'day(1i)' => '2010',
'day(2i)' => '1',
'day(3i)' => '1' }
- post :create, params: { :holiday => @holiday_params }
+ post :create, params: { holiday: @holiday_params }
end
it 'creates a new holiday' do
@@ -85,7 +85,7 @@
before do
allow_any_instance_of(Holiday).to receive(:save).and_return(false)
- post :create, params: { :holiday => @holiday_params }
+ post :create, params: { holiday: @holiday_params }
end
it 'renders the new template' do
@@ -104,7 +104,7 @@
describe 'when not using ajax' do
it 'renders the edit template' do
- get :edit, params: { :id => @holiday.id }
+ get :edit, params: { id: @holiday.id }
expect(response).to render_template('edit')
end
@@ -113,14 +113,14 @@
describe 'when using ajax' do
it 'renders the edit form partial' do
- get :edit, xhr: true, params: { :id => @holiday.id }
- expect(response).to render_template(:partial => '_edit_form')
+ get :edit, xhr: true, params: { id: @holiday.id }
+ expect(response).to render_template(partial: '_edit_form')
end
end
it 'gets the holiday in the id param' do
- get :edit, params: { :id => @holiday.id }
+ get :edit, params: { id: @holiday.id }
expect(assigns[:holiday]).to eq(@holiday)
end
@@ -129,11 +129,11 @@
describe 'PUT update' do
before do
- @holiday = FactoryBot.create(:holiday, :day => Date.new(2010, 1, 1),
- :description => "Test Holiday")
+ @holiday = FactoryBot.create(:holiday, day: Date.new(2010, 1, 1),
+ description: "Test Holiday")
put :update, params: {
- :id => @holiday.id,
- :holiday => { :description => 'New Test Holiday' }
+ id: @holiday.id,
+ holiday: { description: 'New Test Holiday' }
}
end
@@ -158,8 +158,8 @@
before do
allow_any_instance_of(Holiday).to receive(:update).and_return(false)
put :update, params: {
- :id => @holiday.id,
- :holiday => { :description => 'New Test Holiday' }
+ id: @holiday.id,
+ holiday: { description: 'New Test Holiday' }
}
end
@@ -174,7 +174,7 @@
before(:each) do
@holiday = FactoryBot.create(:holiday)
- delete :destroy, params: { :id => @holiday.id }
+ delete :destroy, params: { id: @holiday.id }
end
it 'finds the holiday to destroy' do
diff --git a/spec/controllers/admin_incoming_message_controller_spec.rb b/spec/controllers/admin_incoming_message_controller_spec.rb
index 9551d65bb0..4d21488a21 100644
--- a/spec/controllers/admin_incoming_message_controller_spec.rb
+++ b/spec/controllers/admin_incoming_message_controller_spec.rb
@@ -26,15 +26,15 @@
it 'asks the incoming message to destroy itself' do
allow(IncomingMessage).to receive(:find).and_return(@im)
expect(@im).to receive(:destroy)
- post :destroy, params: { :id => @im.id }
+ post :destroy, params: { id: @im.id }
end
it 'expires the file cache for the associated info_request' do
info_request = FactoryBot.create(:info_request)
allow(@im).to receive(:info_request).and_return(info_request)
allow(IncomingMessage).to receive(:find).and_return(@im)
- expect(@im.info_request).to receive(:expire).with(:preserve_database_cache => true)
- post :destroy, params: { :id => @im.id }
+ expect(@im.info_request).to receive(:expire).with(preserve_database_cache: true)
+ post :destroy, params: { id: @im.id }
end
context 'if the request is embargoed', feature: :alaveteli_pro do
@@ -78,8 +78,8 @@
allow(IncomingMessage).to receive(:find).and_return(incoming_message)
expect(previous_info_request).to receive(:expire)
post :redeliver, params: {
- :id => incoming_message.id,
- :url_title => destination_info_request.url_title
+ id: incoming_message.id,
+ url_title: destination_info_request.url_title
}
end
@@ -87,8 +87,8 @@
with_duplicate_xapian_job_creation do
post :redeliver, params: {
- :id => incoming_message.id,
- :url_title => destination_info_request.url_title
+ id: incoming_message.id,
+ url_title: destination_info_request.url_title
}
end
@@ -96,8 +96,8 @@
it 'shouldn\'t do anything if no message_id is supplied' do
post :redeliver, params: {
- :id => incoming_message.id,
- :url_title => ''
+ id: incoming_message.id,
+ url_title: ''
}
# It shouldn't delete this message
assert_equal IncomingMessage.exists?(incoming_message.id), true
@@ -145,12 +145,12 @@
end
it 'should be successful' do
- get :edit, params: { :id => @incoming.id }
+ get :edit, params: { id: @incoming.id }
expect(response).to be_successful
end
it 'should assign the incoming message to the view' do
- get :edit, params: { :id => @incoming.id }
+ get :edit, params: { id: @incoming.id }
expect(assigns[:incoming_message]).to eq(@incoming)
end
@@ -182,7 +182,7 @@
before do
sign_in(admin_user)
- @incoming = FactoryBot.create(:incoming_message, :prominence => 'normal')
+ @incoming = FactoryBot.create(:incoming_message, prominence: 'normal')
@default_params = {
id: @incoming.id,
incoming_message: {
@@ -258,9 +258,9 @@ def make_request(params=@default_params)
context 'if the incoming message is not valid' do
it 'should render the edit template' do
- make_request({:id => @incoming.id,
- :incoming_message => {:prominence => 'fantastic',
- :prominence_reason => 'dull'}})
+ make_request({id: @incoming.id,
+ incoming_message: {prominence: 'fantastic',
+ prominence_reason: 'dull'}})
expect(response).to render_template("edit")
end
@@ -295,12 +295,12 @@ def make_request(params=@default_params)
let(:request) { FactoryBot.create(:info_request) }
let(:spam1) { FactoryBot.create(
:incoming_message,
- :subject => "Buy a watch!1!!",
- :info_request => request) }
+ subject: "Buy a watch!1!!",
+ info_request: request) }
let(:spam2) { FactoryBot.create(
:incoming_message,
- :subject => "Best cheap w@tches!!1!",
- :info_request => request) }
+ subject: "Best cheap w@tches!!1!",
+ info_request: request) }
let(:spam_ids) { [spam1.id, spam2.id] }
before { sign_in(admin_user) }
@@ -309,29 +309,29 @@ def make_request(params=@default_params)
it "destroys the selected messages" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "Yes"
}
- expect(IncomingMessage.where(:id => spam_ids)).to be_empty
+ expect(IncomingMessage.where(id: spam_ids)).to be_empty
end
it 'expires the file cache for the associated info_request' do
allow(InfoRequest).to receive(:find).and_return(request)
- expect(request).to receive(:expire).with(:preserve_database_cache => true)
+ expect(request).to receive(:expire).with(preserve_database_cache: true)
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "Yes"
}
end
it "redirects back to the admin page for the request" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "Yes"
}
expect(response).to redirect_to(admin_request_url(request))
@@ -339,9 +339,9 @@ def make_request(params=@default_params)
it "sets a success message in flash" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "Yes"
}
expect(response).to redirect_to(admin_request_url(request))
@@ -350,12 +350,12 @@ def make_request(params=@default_params)
it "only destroys selected messages" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam2.id,
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam2.id,
+ commit: "Yes"
}
- expect(IncomingMessage.where(:id => spam_ids)).to eq([spam1])
+ expect(IncomingMessage.where(id: spam_ids)).to eq([spam1])
end
context "not all the messages can be destroyed" do
@@ -365,9 +365,9 @@ def make_request(params=@default_params)
allow(IncomingMessage).to receive(:where).and_return([spam1, spam2])
msg = "Incoming Messages #{spam2.id} could not be destroyed"
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "Yes"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "Yes"
}
expect(flash[:error]).to match(msg)
@@ -381,19 +381,19 @@ def make_request(params=@default_params)
it "does not destroy the messages" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.split(","),
- :commit => "No"
+ request_id: request.id,
+ ids: spam_ids.split(","),
+ commit: "No"
}
- expect(IncomingMessage.where(:id => spam_ids)).to match_array([spam1, spam2])
+ expect(IncomingMessage.where(id: spam_ids)).to match_array([spam1, spam2])
end
it "redirects back to the admin page for the request" do
post :bulk_destroy, params: {
- :request_id => request.id,
- :ids => spam_ids.join(","),
- :commit => "No"
+ request_id: request.id,
+ ids: spam_ids.join(","),
+ commit: "No"
}
expect(response).to redirect_to(admin_request_url(request))
diff --git a/spec/controllers/admin_info_request_event_controller_spec.rb b/spec/controllers/admin_info_request_event_controller_spec.rb
index cc1ff6fc98..d69ff903f9 100644
--- a/spec/controllers/admin_info_request_event_controller_spec.rb
+++ b/spec/controllers/admin_info_request_event_controller_spec.rb
@@ -10,12 +10,12 @@
describe 'when handling valid data' do
it 'gets the info request event' do
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
expect(assigns[:info_request_event]).to eq(info_request_event)
end
it 'sets the described and calculated states on the event' do
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
event = InfoRequestEvent.find(info_request_event.id)
expect(event.described_state).to eq('waiting_clarification')
expect(event.calculated_state).to eq('waiting_clarification')
@@ -27,40 +27,40 @@
info_request = info_request_event.info_request
travel_to(info_request.date_response_required_by) do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'normal_sort',
- :info_request_id => info_request.id,
- :body => "Here's the clarification.")
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'normal_sort',
+ info_request_id: info_request.id,
+ body: "Here's the clarification.")
outgoing_message.record_email_delivery(
'foi@example.com',
'example.id'
)
outgoing_message.save!
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
expect(info_request.reload.date_initial_request_last_sent_at).
to eq(Time.zone.now.to_date)
end
end
it 'shows a success notice' do
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
expect(flash[:notice]).
to eq('Old response marked as having been a request for clarification')
end
it 'redirects to the request admin page' do
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
expect(response).
to redirect_to(admin_request_url(info_request_event.info_request))
end
end
it 'raises an exception if the event is not a response' do
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
info_request_event = FactoryBot.create(:sent_event)
expect {
- put :update, params: { :id => info_request_event }
+ put :update, params: { id: info_request_event }
}.to raise_error(RuntimeError,
"can only mark responses as requires clarification")
end
diff --git a/spec/controllers/admin_outgoing_message_controller_spec.rb b/spec/controllers/admin_outgoing_message_controller_spec.rb
index f7a8e972fa..6ccf8cfc88 100644
--- a/spec/controllers/admin_outgoing_message_controller_spec.rb
+++ b/spec/controllers/admin_outgoing_message_controller_spec.rb
@@ -13,19 +13,19 @@
let(:outgoing) { info_request.outgoing_messages.first }
it 'should be successful' do
- get :edit, params: { :id => outgoing.id }
+ get :edit, params: { id: outgoing.id }
expect(response).to be_successful
end
it 'should assign the outgoing message to the view' do
- get :edit, params: { :id => outgoing.id }
+ get :edit, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to eq(outgoing)
end
context 'when the message is the initial outgoing message' do
it 'sets is_initial_message to true' do
- get :edit, params: { :id => outgoing.id }
+ get :edit, params: { id: outgoing.id }
expect(assigns[:is_initial_message]).to eq(true)
end
@@ -35,8 +35,8 @@
it 'sets is_initial_message to false' do
outgoing = FactoryBot.create(:new_information_followup,
- :info_request => info_request)
- get :edit, params: { :id => outgoing.id }
+ info_request: info_request)
+ get :edit, params: { id: outgoing.id }
expect(assigns[:is_initial_message]).to eq(false)
end
@@ -73,34 +73,34 @@
let(:info_request) { FactoryBot.create(:info_request) }
let(:outgoing) do
FactoryBot.create(:new_information_followup,
- :info_request => info_request)
+ info_request: info_request)
end
it 'finds the outgoing message' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to eq(outgoing)
end
context 'successfully destroying the message' do
it 'destroys the message' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to_not be_persisted
end
it 'logs an event on the info request' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(info_request.reload.last_event.event_type).
to eq('destroy_outgoing')
end
it 'informs the user' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(flash[:notice]).to eq('Outgoing message successfully destroyed.')
end
it 'redirects to the admin request page' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(response).to redirect_to(admin_request_url(info_request))
end
@@ -113,17 +113,17 @@
end
it 'does not destroy the message' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to be_persisted
end
it 'informs the user' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(flash[:error]).to eq('Could not destroy the outgoing message.')
end
it 'redirects to the outgoing message edit page' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(response).
to redirect_to(edit_admin_outgoing_message_path(outgoing))
end
@@ -134,13 +134,13 @@
it 'sets is_initial_message to true' do
outgoing = FactoryBot.create(:initial_request)
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:is_initial_message]).to eq(true)
end
it 'prevents the destruction of the message' do
outgoing = FactoryBot.create(:initial_request)
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to be_persisted
end
@@ -149,12 +149,12 @@
context 'when the message is not initial outgoing message' do
it 'sets is_initial_message to false' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:is_initial_message]).to eq(false)
end
it 'allows the destruction of the message' do
- delete :destroy, params: { :id => outgoing.id }
+ delete :destroy, params: { id: outgoing.id }
expect(assigns[:outgoing_message]).to_not be_persisted
end
@@ -254,7 +254,7 @@ def make_request(params = default_params)
info_request = FactoryBot.create(:info_request)
allow_any_instance_of(OutgoingMessage).to receive(:info_request) { info_request }
- outgoing = FactoryBot.create(:initial_request, :info_request => info_request)
+ outgoing = FactoryBot.create(:initial_request, info_request: info_request)
expect(info_request).to receive(:expire)
@@ -280,10 +280,10 @@ def make_request(params = default_params)
context 'if the incoming message is not valid' do
it 'should render the edit template' do
- make_request({:id => outgoing.id,
- :outgoing_message => {:prominence => 'fantastic',
- :prominence_reason => 'dull',
- :body => 'Some information please'}})
+ make_request({id: outgoing.id,
+ outgoing_message: {prominence: 'fantastic',
+ prominence_reason: 'dull',
+ body: 'Some information please'}})
expect(response).to render_template("edit")
end
diff --git a/spec/controllers/admin_public_body_categories_controller_spec.rb b/spec/controllers/admin_public_body_categories_controller_spec.rb
index 41c4c294a4..3af79ee4af 100644
--- a/spec/controllers/admin_public_body_categories_controller_spec.rb
+++ b/spec/controllers/admin_public_body_categories_controller_spec.rb
@@ -33,8 +33,8 @@
heading = FactoryBot.create(:public_body_heading)
with_heading = FactoryBot.create(:public_body_category)
- PublicBodyCategoryLink.create!(:public_body_heading_id => heading.id,
- :public_body_category_id => with_heading.id)
+ PublicBodyCategoryLink.create!(public_body_heading_id: heading.id,
+ public_body_category_id: with_heading.id)
get :index
@@ -88,11 +88,11 @@
before(:each) do
PublicBodyCategory.destroy_all
- @params = { :category_tag => 'new_test_category',
- :translations_attributes => {
- 'en' => { :locale => 'en',
- :title => 'New Category',
- :description => 'New category for testing stuff' }
+ @params = { category_tag: 'new_test_category',
+ translations_attributes: {
+ 'en' => { locale: 'en',
+ title: 'New Category',
+ description: 'New category for testing stuff' }
} }
end
@@ -100,23 +100,23 @@
PublicBodyCategory.destroy_all
expect {
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
}.to change { PublicBodyCategory.count }.from(0).to(1)
end
it 'can create a category when the default locale is an underscore locale' do
AlaveteliLocalization.set_locales('es en_GB', 'en_GB')
post :create, params: {
- :public_body_category => {
- :title => 'New Category en_GB',
- :description => 'test',
- :category_tag => 'new_test_category'
+ public_body_category: {
+ title: 'New Category en_GB',
+ description: 'test',
+ category_tag: 'new_test_category'
}
}
expect(
PublicBodyCategory.
- find_by(:title => 'New Category en_GB').
+ find_by(title: 'New Category en_GB').
translations.
first.
locale
@@ -128,21 +128,21 @@
params = FactoryBot.attributes_for(:public_body_category)
post :create, params: {
- :public_body_category => @params,
- :headings => { "heading_#{ heading.id }" => heading.id }
+ public_body_category: @params,
+ headings: { "heading_#{ heading.id }" => heading.id }
}
- category = PublicBodyCategory.where(:title => @params[:translations_attributes]['en'][:title]).first
+ category = PublicBodyCategory.where(title: @params[:translations_attributes]['en'][:title]).first
expect(category.public_body_headings).to eq([heading])
end
it 'notifies the admin that the category was created' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
expect(flash[:notice]).to eq('Category was successfully created.')
end
it 'redirects to the categories index' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
expect(response).to redirect_to(admin_categories_path)
end
@@ -152,27 +152,27 @@
before(:each) do
PublicBodyCategory.destroy_all
- @params = { :category_tag => 'new_test_category',
- :translations_attributes => {
- 'en' => { :locale => 'en',
- :title => 'New Category',
- :description => 'New category for testing stuff' },
- 'es' => { :locale => 'es',
- :title => 'Mi Nuevo Category',
- :description => 'ES Description' }
+ @params = { category_tag: 'new_test_category',
+ translations_attributes: {
+ 'en' => { locale: 'en',
+ title: 'New Category',
+ description: 'New category for testing stuff' },
+ 'es' => { locale: 'es',
+ title: 'Mi Nuevo Category',
+ description: 'ES Description' }
} }
end
it 'saves the category' do
expect {
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
}.to change { PublicBodyCategory.count }.from(0).to(1)
end
it 'saves the default locale translation' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
- category = PublicBodyCategory.where(:title => 'New Category').first
+ category = PublicBodyCategory.where(title: 'New Category').first
AlaveteliLocalization.with_locale(:en) do
expect(category.title).to eq('New Category')
@@ -180,9 +180,9 @@
end
it 'saves the alternative locale translation' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
- category = PublicBodyCategory.where(:title => 'New Category').first
+ category = PublicBodyCategory.where(title: 'New Category').first
AlaveteliLocalization.with_locale(:es) do
expect(category.title).to eq('Mi Nuevo Category')
@@ -194,14 +194,14 @@
context 'on failure' do
it 'renders the form if creating the record was unsuccessful' do
- post :create, params: { :public_body_category => { :title => '' } }
+ post :create, params: { public_body_category: { title: '' } }
expect(response).to render_template('new')
end
it 'is rebuilt with the given params' do
post :create, params: {
- :public_body_category => {
- :title => 'Need a description'
+ public_body_category: {
+ title: 'Need a description'
}
}
expect(assigns(:public_body_category).title).to eq('Need a description')
@@ -212,24 +212,24 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :category_tag => 'new_test_category',
- :translations_attributes => {
- 'en' => { :locale => 'en',
- :title => 'Need a description',
- :description => nil },
- 'es' => { :locale => 'es',
- :title => 'Mi Nuevo Category',
- :description => 'ES Description' }
+ @params = { category_tag: 'new_test_category',
+ translations_attributes: {
+ 'en' => { locale: 'en',
+ title: 'Need a description',
+ description: nil },
+ 'es' => { locale: 'es',
+ title: 'Mi Nuevo Category',
+ description: 'ES Description' }
} }
end
it 'is rebuilt with the default locale translation' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
expect(assigns(:public_body_category).title).to eq('Need a description')
end
it 'is rebuilt with the alternative locale translation' do
- post :create, params: { :public_body_category => @params }
+ post :create, params: { public_body_category: @params }
AlaveteliLocalization.with_locale(:es) do
expect(assigns(:public_body_category).title).to eq('Mi Nuevo Category')
@@ -252,17 +252,17 @@
end
it 'responds successfully' do
- get :edit, params: { :id => @category.id }
+ get :edit, params: { id: @category.id }
expect(response).to be_successful
end
it 'finds the requested category' do
- get :edit, params: { :id => @category.id }
+ get :edit, params: { id: @category.id }
expect(assigns[:public_body_category]).to eq(@category)
end
it 'builds new translations if the body does not already have a translation in the specified locale' do
- get :edit, params: { :id => @category.id }
+ get :edit, params: { id: @category.id }
expect(assigns[:public_body_category].translations.map(&:locale)).to include(:fr)
end
@@ -270,19 +270,19 @@
# FIXME: I wanted to call PublicBody.destroy_all here so that we
# have a known DB state, but the constraints were preventing the
# deletion of the fixture data
- FactoryBot.create(:public_body, :tag_string => 'wont_be_found')
+ FactoryBot.create(:public_body, tag_string: 'wont_be_found')
- category = FactoryBot.create(:public_body_category, :category_tag => 'spec')
- expected_bodies = [FactoryBot.create(:public_body, :tag_string => 'spec'),
- FactoryBot.create(:public_body, :tag_string => 'spec')]
+ category = FactoryBot.create(:public_body_category, category_tag: 'spec')
+ expected_bodies = [FactoryBot.create(:public_body, tag_string: 'spec'),
+ FactoryBot.create(:public_body, tag_string: 'spec')]
- get :edit, params: { :id => category.id }
+ get :edit, params: { id: category.id }
expect(assigns(:tagged_public_bodies).sort).to eq(expected_bodies.sort)
end
it 'renders the edit template' do
- get :edit, params: { :id => @category.id }
+ get :edit, params: { id: @category.id }
expect(response).to render_template('edit')
end
@@ -294,9 +294,9 @@
@heading = FactoryBot.create(:public_body_heading)
@category = FactoryBot.create(:public_body_category)
link = FactoryBot.create(:public_body_category_link,
- :public_body_category => @category,
- :public_body_heading => @heading,
- :category_display_order => 0)
+ public_body_category: @category,
+ public_body_heading: @heading,
+ category_display_order: 0)
@tag = @category.category_tag
AlaveteliLocalization.with_locale('es') do
@category.title = 'Los category'
@@ -304,23 +304,23 @@
@category.save!
end
- @params = { :category_tag => @category.category_tag,
- :translations_attributes => {
- 'en' => { :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en) },
- 'es' => { :id => @category.translation_for(:es).id,
- :locale => 'es',
- :title => @category.title(:es),
- :description => @category.description(:es) }
+ @params = { category_tag: @category.category_tag,
+ translations_attributes: {
+ 'en' => { id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en) },
+ 'es' => { id: @category.translation_for(:es).id,
+ locale: 'es',
+ title: @category.title(:es),
+ description: @category.description(:es) }
} }
end
it 'finds the category to update' do
post :update, params: {
- :id => @category.id,
- :public_body_category => @params
+ id: @category.id,
+ public_body_category: @params
}
expect(assigns(:public_body_category)).to eq(@category)
end
@@ -329,16 +329,15 @@
# FIXME: I wanted to call PublicBody.destroy_all here so that we
# have a known DB state, but the constraints were preventing the
# deletion of the fixture data
- FactoryBot.create(:public_body, :tag_string => 'wont_be_found')
+ FactoryBot.create(:public_body, tag_string: 'wont_be_found')
- category = FactoryBot.create(:public_body_category, :category_tag => 'spec')
- expected_bodies = [FactoryBot.create(:public_body, :tag_string => 'spec'),
- FactoryBot.create(:public_body, :tag_string => 'spec')]
+ category = FactoryBot.create(:public_body_category, category_tag: 'spec')
+ expected_bodies = [FactoryBot.create(:public_body, tag_string: 'spec'),
+ FactoryBot.create(:public_body, tag_string: 'spec')]
post :update, params: {
- :id => category.id,
- :public_body_category =>
- category.serializable_hash.except(:title, :description)
+ id: category.id,
+ public_body_category: category.serializable_hash.except(:title, :description)
}
expect(assigns(:tagged_public_bodies)).to match_array(expected_bodies)
@@ -350,16 +349,16 @@
heading = FactoryBot.create(:public_body_heading)
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :title => 'Renamed'
+ id: @category.translation_for(:en).id,
+ title: 'Renamed'
}
}
},
- :headings => { "heading_#{ heading.id }" => heading.id }
+ headings: { "heading_#{ heading.id }" => heading.id }
}
category = PublicBodyCategory.find(@category.id)
@@ -369,11 +368,11 @@
context 'when the category has associated bodies' do
it 'does not save edits to category_tag' do
- body = FactoryBot.create(:public_body, :tag_string => @tag)
+ body = FactoryBot.create(:public_body, tag_string: @tag)
post :update, params: {
- :id => @category.id,
- :public_body_category => { :category_tag => 'Renamed' }
+ id: @category.id,
+ public_body_category: { category_tag: 'Renamed' }
}
category = PublicBodyCategory.find(@category.id)
@@ -381,24 +380,24 @@
end
it 'notifies the user that the category_tag could not be updated' do
- body = FactoryBot.create(:public_body, :tag_string => @tag)
+ body = FactoryBot.create(:public_body, tag_string: @tag)
msg = %Q(There are authorities associated with this category,
so the tag can't be renamed).squish
post :update, params: {
- :id => @category.id,
- :public_body_category => { :category_tag => 'Renamed' }
+ id: @category.id,
+ public_body_category: { category_tag: 'Renamed' }
}
expect(flash[:error]).to eq(msg)
end
it 'renders the edit action' do
- body = FactoryBot.create(:public_body, :tag_string => @tag)
+ body = FactoryBot.create(:public_body, tag_string: @tag)
post :update, params: {
- :id => @category.id,
- :public_body_category => { :category_tag => 'Renamed' }
+ id: @category.id,
+ public_body_category: { category_tag: 'Renamed' }
}
expect(response).to render_template('edit')
@@ -409,12 +408,12 @@
context 'on success' do
before(:each) do
- @params = { :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ @params = { id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :title => 'Renamed'
+ id: @category.translation_for(:en).id,
+ title: 'Renamed'
}
}
}
@@ -438,11 +437,11 @@
end
it 'saves edits to category_tag if the category has no associated bodies' do
- category = FactoryBot.create(:public_body_category, :category_tag => 'empty')
+ category = FactoryBot.create(:public_body_category, category_tag: 'empty')
post :update, params: {
- :id => category.id,
- :public_body_category => { :category_tag => 'Renamed' }
+ id: category.id,
+ public_body_category: { category_tag: 'Renamed' }
}
category = PublicBodyCategory.find(category.id)
@@ -453,8 +452,8 @@
AlaveteliLocalization.set_locales('es en_GB', 'en_GB')
post :update, params: {
- :id => @category.id,
- :public_body_category => { :name => 'Category en_GB' }
+ id: @category.id,
+ public_body_category: { name: 'Category en_GB' }
}
expect(
@@ -469,20 +468,20 @@
it "saves edits to a public body category in another locale" do
expect(@category.title(:es)).to eq('Los category')
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en)
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en)
},
'es' => {
- :id => @category.translation_for(:es).id,
- :locale => 'es',
- :title => 'Renamed',
- :description => 'ES Description'
+ id: @category.translation_for(:es).id,
+ locale: 'es',
+ title: 'Renamed',
+ description: 'ES Description'
}
}
}
@@ -498,19 +497,19 @@
@category.reload
put :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en)
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en)
},
'es' => {
- :locale => "es",
- :title => "Example Public Body Category ES",
- :description => @category.description(:es)
+ locale: "es",
+ title: "Example Public Body Category ES",
+ description: @category.description(:es)
}
}
}
@@ -530,24 +529,24 @@
@category.reload
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en)
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en)
},
'es' => {
- :locale => "es",
- :title => "Example Public Body Category ES",
- :description => 'ES Description'
+ locale: "es",
+ title: "Example Public Body Category ES",
+ description: 'ES Description'
},
'fr' => {
- :locale => "fr",
- :title => "Example Public Body Category FR",
- :description => 'FR Description'
+ locale: "fr",
+ title: "Example Public Body Category FR",
+ description: 'FR Description'
}
}
}
@@ -567,22 +566,22 @@
it 'updates an existing translation and adds a third translation' do
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
- 'en' => { :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en) },
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
+ 'en' => { id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en) },
# Update existing translation
- 'es' => { :id => @category.translation_for(:es).id,
- :locale => "es",
- :title => "Renamed Example Public Body Category ES",
- :description => @category.description },
+ 'es' => { id: @category.translation_for(:es).id,
+ locale: "es",
+ title: "Renamed Example Public Body Category ES",
+ description: @category.description },
# Add new translation
- 'fr' => { :locale => "fr",
- :title => "Example Public Body Category FR",
- :description => @category.description }
+ 'fr' => { locale: "fr",
+ title: "Example Public Body Category FR",
+ description: @category.description }
}
}
}
@@ -601,14 +600,14 @@
it "redirects to the edit page after a successful update" do
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => @category.title(:en),
- :description => @category.description(:en)
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: @category.title(:en),
+ description: @category.description(:en)
}
}
}
@@ -623,14 +622,14 @@
it 'renders the form if creating the record was unsuccessful' do
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => '',
- :description => @category.description(:en)
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: '',
+ description: @category.description(:en)
}
}
}
@@ -640,14 +639,14 @@
it 'is rebuilt with the given params' do
post :update, params: {
- :id => @category.id,
- :public_body_category => {
- :translations_attributes => {
+ id: @category.id,
+ public_body_category: {
+ translations_attributes: {
'en' => {
- :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => 'Need a description',
- :description => ''
+ id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: 'Need a description',
+ description: ''
}
}
}
@@ -660,31 +659,31 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :category_tag => 'new_test_category',
- :translations_attributes => {
- 'en' => { :id => @category.translation_for(:en).id,
- :locale => 'en',
- :title => 'Need a description',
- :description => '' },
- 'es' => { :id => @category.translation_for(:es).id,
- :locale => 'es',
- :title => 'Mi Nuevo Category',
- :description => 'ES Description' }
+ @params = { category_tag: 'new_test_category',
+ translations_attributes: {
+ 'en' => { id: @category.translation_for(:en).id,
+ locale: 'en',
+ title: 'Need a description',
+ description: '' },
+ 'es' => { id: @category.translation_for(:es).id,
+ locale: 'es',
+ title: 'Mi Nuevo Category',
+ description: 'ES Description' }
} }
end
it 'is rebuilt with the default locale translation' do
post :update, params: {
- :id => @category.id,
- :public_body_category => @params
+ id: @category.id,
+ public_body_category: @params
}
expect(assigns(:public_body_category).title(:en)).to eq('Need a description')
end
it 'is rebuilt with the alternative locale translation' do
post :update, params: {
- :id => @category.id,
- :public_body_category => @params
+ id: @category.id,
+ public_body_category: @params
}
AlaveteliLocalization.with_locale(:es) do
@@ -704,7 +703,7 @@
category = FactoryBot.create(:public_body_category)
expect {
- post :destroy, params: { :id => category.id }
+ post :destroy, params: { id: category.id }
}.to change { PublicBodyCategory.count }.from(1).to(0)
end
@@ -712,23 +711,23 @@
PublicBodyCategory.destroy_all
tag = 'empty'
- authority = FactoryBot.create(:public_body, :tag_string => tag)
- category = FactoryBot.create(:public_body_category, :category_tag => tag)
+ authority = FactoryBot.create(:public_body, tag_string: tag)
+ category = FactoryBot.create(:public_body_category, category_tag: tag)
expect {
- post :destroy, params: { :id => category.id }
+ post :destroy, params: { id: category.id }
}.to change { PublicBodyCategory.count }.from(1).to(0)
end
it 'notifies the admin that the category was destroyed' do
category = FactoryBot.create(:public_body_category)
- post :destroy, params: { :id => category.id }
+ post :destroy, params: { id: category.id }
expect(flash[:notice]).to eq('Category was successfully destroyed.')
end
it 'redirects to the categories index' do
category = FactoryBot.create(:public_body_category)
- post :destroy, params: { :id => category.id }
+ post :destroy, params: { id: category.id }
expect(response).to redirect_to(admin_categories_path)
end
diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb
index 2f05087ff9..485f27f6fc 100644
--- a/spec/controllers/admin_public_body_controller_spec.rb
+++ b/spec/controllers/admin_public_body_controller_spec.rb
@@ -10,12 +10,12 @@
end
it "searches for 'humpa'" do
- get :index, params: { :query => "humpa" }
+ get :index, params: { query: "humpa" }
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
end
it "searches for 'humpa' in another locale" do
- get :index, params: { :query => "humpa", :locale => "es" }
+ get :index, params: { query: "humpa", locale: "es" }
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
end
@@ -24,19 +24,19 @@
describe 'GET #show' do
let(:public_body) { FactoryBot.create(:public_body) }
let(:info_request) { FactoryBot.create(:info_request,
- :public_body => public_body) }
+ public_body: public_body) }
let(:admin_user) { FactoryBot.create(:admin_user) }
let(:pro_admin_user) { FactoryBot.create(:pro_admin_user) }
it "returns successfully" do
sign_in admin_user
- get :show, params: { :id => public_body.id }
+ get :show, params: { id: public_body.id }
expect(response).to be_successful
end
it "sets a using_admin flag" do
sign_in admin_user
- get :show, params: { :id => public_body.id}
+ get :show, params: { id: public_body.id}
expect(session[:using_admin]).to eq(1)
end
@@ -46,7 +46,7 @@
public_body.save!
end
sign_in admin_user
- get :show, params: { :id => public_body.id, :locale => "es" }
+ get :show, params: { id: public_body.id, locale: "es" }
expect(assigns[:public_body].name).to eq 'El Public Body'
end
@@ -54,7 +54,7 @@
not a pro admin user' do
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => public_body.id }
+ get :show, params: { id: public_body.id }
expect(assigns[:info_requests].include?(info_request)).to be false
end
@@ -65,7 +65,7 @@
with_feature_enabled(:alaveteli_pro) do
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => public_body.id }
+ get :show, params: { id: public_body.id }
expect(assigns[:info_requests].include?(info_request)).to be false
end
end
@@ -76,7 +76,7 @@
with_feature_enabled(:alaveteli_pro) do
info_request.create_embargo
sign_in pro_admin_user
- get :show, params: { :id => public_body.id }
+ get :show, params: { id: public_body.id }
expect(assigns[:info_requests].include?(info_request)).to be true
end
end
@@ -116,7 +116,7 @@
it 'should populate the name, email address and last edit comment on the public body' do
change_request = FactoryBot.create(:add_body_request)
- get :new, params: { :change_request_id => change_request.id }
+ get :new, params: { change_request_id: change_request.id }
expect(assigns[:public_body].name).to eq(change_request.public_body_name)
expect(assigns[:public_body].request_email).to eq(change_request.public_body_email)
expect(assigns[:public_body].last_edit_comment).to match('Notes: Please')
@@ -124,7 +124,7 @@
it 'should assign a default response text to the view' do
change_request = FactoryBot.create(:add_body_request)
- get :new, params: { :change_request_id => change_request.id }
+ get :new, params: { change_request_id: change_request.id }
expect(assigns[:change_request_user_response]).to match("Thanks for your suggestion to add A New Body")
end
@@ -137,11 +137,11 @@
context 'on success' do
before(:each) do
- @params = { :public_body => { :name => 'New Quango',
- :short_name => 'nq',
- :request_email => 'newquango@localhost',
- :tag_string => 'spec',
- :last_edit_comment => 'From test code' } }
+ @params = { public_body: { name: 'New Quango',
+ short_name: 'nq',
+ request_email: 'newquango@localhost',
+ tag_string: 'spec',
+ last_edit_comment: 'From test code' } }
end
it 'creates a new body in the default locale' do
@@ -177,15 +177,15 @@
context 'on success for multiple locales' do
before(:each) do
- @params = { :public_body => { :name => 'New Quango',
- :short_name => 'nq',
- :request_email => 'newquango@localhost',
- :tag_string => 'spec',
- :last_edit_comment => 'From test code',
- :translations_attributes => {
- 'es' => { :locale => 'es',
- :name => 'Los Quango',
- :short_name => 'lq' }
+ @params = { public_body: { name: 'New Quango',
+ short_name: 'nq',
+ request_email: 'newquango@localhost',
+ tag_string: 'spec',
+ last_edit_comment: 'From test code',
+ translations_attributes: {
+ 'es' => { locale: 'es',
+ name: 'Los Quango',
+ short_name: 'lq' }
} } }
end
@@ -227,9 +227,9 @@
it 'renders the form if creating the record was unsuccessful' do
post :create, params: {
- :public_body => {
- :name => '',
- :translations_attributes => {}
+ public_body: {
+ name: '',
+ translations_attributes: {}
}
}
expect(response).to render_template('new')
@@ -237,10 +237,10 @@
it 'is rebuilt with the given params' do
post :create, params: {
- :public_body => {
- :name => '',
- :request_email => 'newquango@localhost',
- :translations_attributes => {}
+ public_body: {
+ name: '',
+ request_email: 'newquango@localhost',
+ translations_attributes: {}
}
}
expect(assigns(:public_body).request_email).to eq('newquango@localhost')
@@ -251,11 +251,11 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :public_body => { :name => '',
- :request_email => 'newquango@localhost',
- :translations_attributes => {
- 'es' => { :locale => 'es',
- :name => 'Los Quango' }
+ @params = { public_body: { name: '',
+ request_email: 'newquango@localhost',
+ translations_attributes: {
+ 'es' => { locale: 'es',
+ name: 'Los Quango' }
} } }
end
@@ -282,17 +282,16 @@
@change_request = FactoryBot.create(:add_body_request)
post :create,
params: {
- :public_body => {
- :name => "New Quango",
- :short_name => "",
- :tag_string => "blah",
- :request_email => 'newquango@localhost',
- :last_edit_comment => 'From test code'
+ public_body: {
+ name: "New Quango",
+ short_name: "",
+ tag_string: "blah",
+ request_email: 'newquango@localhost',
+ last_edit_comment: 'From test code'
},
- :change_request_id => @change_request.id,
- :subject => 'Adding a new body',
- :response =>
- 'The URL will be [Authority URL will be inserted here]'
+ change_request_id: @change_request.id,
+ subject: 'Adding a new body',
+ response: 'The URL will be [Authority URL will be inserted here]'
}
end
@@ -324,27 +323,27 @@
end
it 'responds successfully' do
- get :edit, params: { :id => @body.id }
+ get :edit, params: { id: @body.id }
expect(response).to be_successful
end
it 'finds the requested body' do
- get :edit, params: { :id => @body.id }
+ get :edit, params: { id: @body.id }
expect(assigns[:public_body]).to eq(@body)
end
it 'builds new translations if the body does not already have a translation in the specified locale' do
- get :edit, params: { :id => @body.id }
+ get :edit, params: { id: @body.id }
expect(assigns[:public_body].translations.map(&:locale)).to include(:fr)
end
it 'renders the edit template' do
- get :edit, params: { :id => @body.id }
+ get :edit, params: { id: @body.id }
expect(response).to render_template('edit')
end
it "edits a public body in another locale" do
- get :edit, params: { :id => 3, :locale => :en }
+ get :edit, params: { id: 3, locale: :en }
# When editing a body, the controller returns all available translations
expect(assigns[:public_body].find_translation_by_locale("es").name).to eq('El Department for Humpadinking')
@@ -358,16 +357,16 @@
before do
@change_request = FactoryBot.create(:update_body_request)
get :edit, params: {
- :id => @change_request.public_body_id,
- :change_request_id => @change_request.id
+ id: @change_request.public_body_id,
+ change_request_id: @change_request.id
}
end
it 'should populate the email address and last edit comment on the public body' do
change_request = FactoryBot.create(:update_body_request)
get :edit, params: {
- :id => change_request.public_body_id,
- :change_request_id => change_request.id
+ id: change_request.public_body_id,
+ change_request_id: change_request.id
}
expect(assigns[:public_body].request_email).to eq(@change_request.public_body_email)
expect(assigns[:public_body].last_edit_comment).to match('Notes: Please')
@@ -389,16 +388,16 @@
@body.save!
end
- @params = { :id => @body.id,
- :public_body => { :name => 'Renamed',
- :short_name => @body.short_name,
- :request_email => @body.request_email,
- :tag_string => @body.tag_string,
- :last_edit_comment => 'From test code',
- :translations_attributes => {
- 'es' => { :id => @body.translation_for(:es).id,
- :locale => 'es',
- :title => @body.name(:es) }
+ @params = { id: @body.id,
+ public_body: { name: 'Renamed',
+ short_name: @body.short_name,
+ request_email: @body.request_email,
+ tag_string: @body.tag_string,
+ last_edit_comment: 'From test code',
+ translations_attributes: {
+ 'es' => { id: @body.translation_for(:es).id,
+ locale: 'es',
+ title: @body.name(:es) }
} } }
end
@@ -432,14 +431,14 @@
it 'saves edits to a public body heading in another locale' do
expect(@body.name(:es)).to eq('Los Quango')
post :update, params: {
- :id => @body.id,
- :public_body => {
- :name => @body.name(:en),
- :translations_attributes => {
+ id: @body.id,
+ public_body: {
+ name: @body.name(:en),
+ translations_attributes: {
'es' => {
- :id => @body.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed'
+ id: @body.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed'
}
}
}
@@ -455,13 +454,13 @@
@body.reload
put :update, params: {
- :id => @body.id,
- :public_body => {
- :name => @body.name(:en),
- :translations_attributes => {
+ id: @body.id,
+ public_body: {
+ name: @body.name(:en),
+ translations_attributes: {
'es' => {
- :locale => "es",
- :name => "Example Public Body ES"
+ locale: "es",
+ name: "Example Public Body ES"
}
}
}
@@ -479,9 +478,9 @@
it 'creates a new translation for the default locale' do
AlaveteliLocalization.set_locales('es en_GB', 'en_GB')
put :update, params: {
- :id => @body.id,
- :public_body => {
- :name => "Example Public Body en_GB"
+ id: @body.id,
+ public_body: {
+ name: "Example Public Body en_GB"
}
}
@@ -494,17 +493,17 @@
@body.reload
post :update, params: {
- :id => @body.id,
- :public_body => {
- :name => @body.name(:en),
- :translations_attributes => {
+ id: @body.id,
+ public_body: {
+ name: @body.name(:en),
+ translations_attributes: {
'es' => {
- :locale => "es",
- :name => "Example Public Body ES"
+ locale: "es",
+ name: "Example Public Body ES"
},
'fr' => {
- :locale => "fr",
- :name => "Example Public Body FR"
+ locale: "fr",
+ name: "Example Public Body FR"
}
}
}
@@ -524,17 +523,17 @@
it 'updates an existing translation and adds a third translation' do
post :update, params: {
- :id => @body.id,
- :public_body => {
- :name => @body.name(:en),
- :translations_attributes => {
+ id: @body.id,
+ public_body: {
+ name: @body.name(:en),
+ translations_attributes: {
# Update existing translation
- 'es' => { :id => @body.translation_for(:es).id,
- :locale => "es",
- :name => "Renamed Example Public Body ES" },
+ 'es' => { id: @body.translation_for(:es).id,
+ locale: "es",
+ name: "Renamed Example Public Body ES" },
# Add new translation
- 'fr' => { :locale => "fr",
- :name => "Example Public Body FR" }
+ 'fr' => { locale: "fr",
+ name: "Example Public Body FR" }
}
}
}
@@ -557,10 +556,10 @@
it 'renders the form if creating the record was unsuccessful' do
post :update, params: {
- :id => @body.id,
- :public_body => {
- :name => '',
- :translations_attributes => {}
+ id: @body.id,
+ public_body: {
+ name: '',
+ translations_attributes: {}
}
}
expect(response).to render_template('edit')
@@ -568,11 +567,11 @@
it 'is rebuilt with the given params' do
post :update, params: {
- :id => @body.id,
- :public_body => {
- :name => '',
- :request_email => 'updated@localhost',
- :translations_attributes => {}
+ id: @body.id,
+ public_body: {
+ name: '',
+ request_email: 'updated@localhost',
+ translations_attributes: {}
}
}
expect(assigns(:public_body).request_email).to eq('updated@localhost')
@@ -583,12 +582,12 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :id => @body.id,
- :public_body => { :name => '',
- :translations_attributes => {
- 'es' => { :id => @body.translation_for(:es).id,
- :locale => 'es',
- :name => 'Mi Nuevo Body' }
+ @params = { id: @body.id,
+ public_body: { name: '',
+ translations_attributes: {
+ 'es' => { id: @body.translation_for(:es).id,
+ locale: 'es',
+ name: 'Mi Nuevo Body' }
} } }
end
@@ -612,16 +611,16 @@
before do
@change_request = FactoryBot.create(:update_body_request)
post :update, params: {
- :id => @change_request.public_body_id,
- :public_body => {
- :name => "New Quango",
- :short_name => "",
- :request_email => 'newquango@localhost',
- :last_edit_comment => 'From test code'
+ id: @change_request.public_body_id,
+ public_body: {
+ name: "New Quango",
+ short_name: "",
+ request_email: 'newquango@localhost',
+ last_edit_comment: 'From test code'
},
- :change_request_id => @change_request.id,
- :subject => 'Body update',
- :response => 'Done.'
+ change_request_id: @change_request.id,
+ subject: 'Body update',
+ response: 'Done.'
}
end
@@ -646,14 +645,14 @@
it "does not destroy a public body that has associated requests" do
id = public_bodies(:humpadink_public_body).id
n = PublicBody.count
- post :destroy, params: { :id => id }
- expect(response).to redirect_to(:controller=>'admin_public_body', :action=>'show', :id => id)
+ post :destroy, params: { id: id }
+ expect(response).to redirect_to(controller: 'admin_public_body', action: 'show', id: id)
expect(PublicBody.count).to eq(n)
end
it "destroys a public body" do
n = PublicBody.count
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(response).to redirect_to admin_bodies_path
expect(PublicBody.count).to eq(n - 1)
end
@@ -706,7 +705,7 @@
end
it 'should handle a nil csv file param' do
- post :import_csv, params: { :commit => 'Dry run' }
+ post :import_csv, params: { commit: 'Dry run' }
expect(response).to be_successful
end
@@ -714,8 +713,8 @@
it 'should assign the original filename to the view' do
post :import_csv, params: {
- :csv_file => @file_object,
- :commit => 'Dry run'
+ csv_file: @file_object,
+ commit: 'Dry run'
}
expect(assigns[:original_csv_file]).to eq('fake-authority-type.csv')
end
@@ -728,16 +727,16 @@
expect(@controller).to receive(:retrieve_csv_data).with('csv_upload-2046-12-31-394')
post :import_csv,
params: {
- :temporary_csv_file => 'csv_upload-2046-12-31-394',
- :original_csv_file => 'original_contents.txt',
- :commit => 'Dry run'
+ temporary_csv_file: 'csv_upload-2046-12-31-394',
+ original_csv_file: 'original_contents.txt',
+ commit: 'Dry run'
}
end
it 'should raise an error on an invalid temp file name' do
- params = { :temporary_csv_file => 'bad_name',
- :original_csv_file => 'original_contents.txt',
- :commit => 'Dry run'}
+ params = { temporary_csv_file: 'bad_name',
+ original_csv_file: 'original_contents.txt',
+ commit: 'Dry run'}
expected_error = "Invalid filename in upload_csv: bad_name"
expect {
post :import_csv, params: params
@@ -746,9 +745,9 @@
it 'should raise an error if the temp file does not exist' do
temp_name = "csv_upload-20461231-394"
- params = { :temporary_csv_file => temp_name,
- :original_csv_file => 'original_contents.txt',
- :commit => 'Dry run'}
+ params = { temporary_csv_file: temp_name,
+ original_csv_file: 'original_contents.txt',
+ commit: 'Dry run'}
expected_error = "Missing file in upload_csv: csv_upload-20461231-394"
expect {
post :import_csv, params: params
@@ -757,8 +756,8 @@
it 'should assign the temporary filename to the view' do
post :import_csv, params: {
- :csv_file => @file_object,
- :commit => 'Dry run'
+ csv_file: @file_object,
+ commit: 'Dry run'
}
temporary_filename = assigns[:temporary_csv_file]
expect(temporary_filename).to match(/csv_upload-#{Time.zone.now.strftime("%Y%m%d")}-\d{1,5}/)
@@ -792,9 +791,9 @@ def setup_emergency_credentials(username, password)
it "disallows non-authenticated users to do anything" do
@request.env["HTTP_AUTHORIZATION"] = ""
n = PublicBody.count
- post :destroy, params: { :id => 3 }
+ post :destroy, params: { id: 3 }
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
expect(PublicBody.count).to eq(n)
expect(session[:using_admin]).to eq(nil)
end
@@ -804,7 +803,7 @@ def setup_emergency_credentials(username, password)
config['SKIP_ADMIN_AUTH'] = true
@request.env["HTTP_AUTHORIZATION"] = ""
n = PublicBody.count
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(PublicBody.count).to eq(n - 1)
expect(session[:using_admin]).to eq(1)
end
@@ -813,9 +812,9 @@ def setup_emergency_credentials(username, password)
setup_emergency_credentials('biz', 'fuz')
n = PublicBody.count
basic_auth_login(@request, "baduser", "badpassword")
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
expect(PublicBody.count).to eq(n)
expect(session[:using_admin]).to eq(nil)
end
@@ -825,12 +824,12 @@ def setup_emergency_credentials(username, password)
n = PublicBody.count
basic_auth_login(@request, "biz", "fuz")
post :show, params: {
- :id => public_bodies(:humpadink_public_body).id,
- :emergency => 1
+ id: public_bodies(:humpadink_public_body).id,
+ emergency: 1
}
expect(session[:using_admin]).to eq(1)
n = PublicBody.count
- post :destroy, params: {:id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: {id: public_bodies(:forlorn_public_body).id }
expect(session[:using_admin]).to eq(1)
expect(PublicBody.count).to eq(n - 1)
end
@@ -840,11 +839,11 @@ def setup_emergency_credentials(username, password)
allow(AlaveteliConfiguration).to receive(:disable_emergency_user).and_return(true)
n = PublicBody.count
basic_auth_login(@request, "biz", "fuz")
- post :show, params: { :id => public_bodies(:humpadink_public_body).id,
- :emergency => 1 }
+ post :show, params: { id: public_bodies(:humpadink_public_body).id,
+ emergency: 1 }
expect(session[:using_admin]).to eq(nil)
n = PublicBody.count
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(session[:using_admin]).to eq(nil)
expect(PublicBody.count).to eq(n)
end
@@ -853,7 +852,7 @@ def setup_emergency_credentials(username, password)
sign_in users(:admin_user)
@request.env["HTTP_AUTHORIZATION"] = ""
n = PublicBody.count
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(PublicBody.count).to eq(n - 1)
expect(session[:using_admin]).to eq(1)
end
@@ -862,9 +861,9 @@ def setup_emergency_credentials(username, password)
sign_in users(:robin_user)
@request.env["HTTP_AUTHORIZATION"] = ""
n = PublicBody.count
- post :destroy, params: { :id => public_bodies(:forlorn_public_body).id }
+ post :destroy, params: { id: public_bodies(:forlorn_public_body).id }
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
expect(PublicBody.count).to eq(n)
expect(session[:using_admin]).to eq(nil)
end
@@ -874,15 +873,15 @@ def setup_emergency_credentials(username, password)
it 'returns the emergency account name for someone who logged in with the emergency account' do
setup_emergency_credentials('biz', 'fuz')
basic_auth_login(@request, "biz", "fuz")
- post :show, params: { :id => public_bodies(:humpadink_public_body).id,
- :emergency => 1 }
+ post :show, params: { id: public_bodies(:humpadink_public_body).id,
+ emergency: 1 }
expect(controller.send(:admin_current_user)).to eq('biz')
end
it 'returns the current user url_name for a superuser' do
sign_in users(:admin_user)
@request.env["HTTP_AUTHORIZATION"] = ""
- post :show, params: { :id => public_bodies(:humpadink_public_body).id }
+ post :show, params: { id: public_bodies(:humpadink_public_body).id }
expect(controller.send(:admin_current_user)).to eq(users(:admin_user).url_name)
end
@@ -891,7 +890,7 @@ def setup_emergency_credentials(username, password)
config['SKIP_ADMIN_AUTH'] = true
@request.env["HTTP_AUTHORIZATION"] = ""
@request.env["REMOTE_USER"] = "i_am_admin"
- post :show, params: { :id => public_bodies(:humpadink_public_body).id }
+ post :show, params: { id: public_bodies(:humpadink_public_body).id }
expect(controller.send(:admin_current_user)).to eq("i_am_admin")
end
diff --git a/spec/controllers/admin_public_body_headings_controller_spec.rb b/spec/controllers/admin_public_body_headings_controller_spec.rb
index bf8cf3621a..613d705ed3 100644
--- a/spec/controllers/admin_public_body_headings_controller_spec.rb
+++ b/spec/controllers/admin_public_body_headings_controller_spec.rb
@@ -37,27 +37,27 @@
before(:each) do
PublicBodyHeading.destroy_all
- @params = { :translations_attributes => {
- 'en' => { :locale => 'en',
- :name => 'New Heading' }
+ @params = { translations_attributes: {
+ 'en' => { locale: 'en',
+ name: 'New Heading' }
} }
end
it 'creates a new heading in the default locale' do
expect {
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
}.to change { PublicBodyHeading.count }.from(0).to(1)
end
it 'can create a heading when the default locale is an underscore locale' do
AlaveteliLocalization.set_locales('es en_GB', 'en_GB')
post :create, params: {
- :public_body_heading => { :name => 'New Heading en_GB' }
+ public_body_heading: { name: 'New Heading en_GB' }
}
expect(
PublicBodyHeading.
- find_by(:name => 'New Heading en_GB').
+ find_by(name: 'New Heading en_GB').
translations.
first.
locale
@@ -65,12 +65,12 @@
end
it 'notifies the admin that the heading was created' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
expect(flash[:notice]).to eq('Heading was successfully created.')
end
it 'redirects to the categories index' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
expect(response).to redirect_to(admin_categories_path)
end
@@ -80,24 +80,24 @@
before(:each) do
PublicBodyHeading.destroy_all
- @params = { :translations_attributes => {
- 'en' => { :locale => 'en',
- :name => 'New Heading' },
- 'es' => { :locale => 'es',
- :name => 'Mi Nuevo Heading' }
+ @params = { translations_attributes: {
+ 'en' => { locale: 'en',
+ name: 'New Heading' },
+ 'es' => { locale: 'es',
+ name: 'Mi Nuevo Heading' }
} }
end
it 'saves the heading' do
expect {
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
}.to change { PublicBodyHeading.count }.from(0).to(1)
end
it 'saves the default locale translation' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
- heading = PublicBodyHeading.where(:name => 'New Heading').first
+ heading = PublicBodyHeading.where(name: 'New Heading').first
AlaveteliLocalization.with_locale(:en) do
expect(heading.name).to eq('New Heading')
@@ -105,9 +105,9 @@
end
it 'saves the alternative locale translation' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
- heading = PublicBodyHeading.where(:name => 'New Heading').first
+ heading = PublicBodyHeading.where(name: 'New Heading').first
AlaveteliLocalization.with_locale(:es) do
expect(heading.name).to eq('Mi Nuevo Heading')
@@ -119,14 +119,14 @@
context 'on failure' do
it 'renders the form if creating the record was unsuccessful' do
- post :create, params: { :public_body_heading => { :name => '' } }
+ post :create, params: { public_body_heading: { name: '' } }
expect(response).to render_template('new')
end
it 'is rebuilt with the given params' do
post :create,
params: {
- :public_body_heading => { :name => 'Need a description' }
+ public_body_heading: { name: 'Need a description' }
}
expect(assigns(:public_body_heading).name).to eq('Need a description')
end
@@ -136,21 +136,21 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :translations_attributes => {
- 'en' => { :locale => 'en',
- :name => 'Need a description' },
- 'es' => { :locale => 'es',
- :name => 'Mi Nuevo Heading' }
+ @params = { translations_attributes: {
+ 'en' => { locale: 'en',
+ name: 'Need a description' },
+ 'es' => { locale: 'es',
+ name: 'Mi Nuevo Heading' }
} }
end
it 'is rebuilt with the default locale translation' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
expect(assigns(:public_body_heading).name).to eq('Need a description')
end
it 'is rebuilt with the alternative locale translation' do
- post :create, params: { :public_body_heading => @params }
+ post :create, params: { public_body_heading: @params }
AlaveteliLocalization.with_locale(:es) do
expect(assigns(:public_body_heading).name).to eq('Mi Nuevo Heading')
@@ -172,22 +172,22 @@
end
it 'responds successfully' do
- get :edit, params: { :id => @heading.id }
+ get :edit, params: { id: @heading.id }
expect(response).to be_successful
end
it 'finds the requested heading' do
- get :edit, params: { :id => @heading.id }
+ get :edit, params: { id: @heading.id }
expect(assigns[:public_body_heading]).to eq(@heading)
end
it 'builds new translations if the body does not already have a translation in the specified locale' do
- get :edit, params: { :id => @heading.id }
+ get :edit, params: { id: @heading.id }
expect(assigns[:public_body_heading].translations.map(&:locale)).to include(:fr)
end
it 'renders the edit template' do
- get :edit, params: { :id => @heading.id }
+ get :edit, params: { id: @heading.id }
expect(response).to render_template('edit')
end
@@ -201,20 +201,20 @@
@heading.name = 'Los heading'
@heading.save!
end
- @params = { :translations_attributes => {
- 'en' => { :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en) },
- 'es' => { :id => @heading.translation_for(:es).id,
- :locale => 'es',
- :title => @heading.name(:es) }
+ @params = { translations_attributes: {
+ 'en' => { id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en) },
+ 'es' => { id: @heading.translation_for(:es).id,
+ locale: 'es',
+ title: @heading.name(:es) }
} }
end
it 'finds the heading to update' do
post :update, params: {
- :id => @heading.id,
- :public_body_category => @params
+ id: @heading.id,
+ public_body_category: @params
}
expect(assigns(:public_body_heading)).to eq(@heading)
end
@@ -222,11 +222,11 @@
context 'on success' do
before(:each) do
- @params = { :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
- 'en' => { :id => @heading.translation_for(:en).id,
- :name => 'Renamed' }
+ @params = { id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
+ 'en' => { id: @heading.translation_for(:en).id,
+ name: 'Renamed' }
}
}
}
@@ -247,9 +247,9 @@
AlaveteliLocalization.set_locales('es en_GB', 'en_GB')
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :name => 'Heading en_GB'
+ id: @heading.id,
+ public_body_heading: {
+ name: 'Heading en_GB'
}
}
@@ -269,18 +269,18 @@
it 'saves edits to a public body heading in another locale' do
expect(@heading.name(:es)).to eq('Los heading')
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en)
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en)
},
'es' => {
- :id => @heading.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed'
+ id: @heading.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed'
}
}
}
@@ -296,17 +296,17 @@
@heading.reload
put :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en)
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en)
},
'es' => {
- :locale => "es",
- :name => "Example Public Body Heading ES"
+ locale: "es",
+ name: "Example Public Body Heading ES"
}
}
}
@@ -326,21 +326,21 @@
@heading.reload
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en)
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en)
},
'es' => {
- :locale => "es",
- :name => "Example Public Body Heading ES"
+ locale: "es",
+ name: "Example Public Body Heading ES"
},
'fr' => {
- :locale => "fr",
- :name => "Example Public Body Heading FR"
+ locale: "fr",
+ name: "Example Public Body Heading FR"
}
}
}
@@ -360,19 +360,19 @@
it 'updates an existing translation and adds a third translation' do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
- 'en' => { :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en) },
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
+ 'en' => { id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en) },
# Update existing translation
- 'es' => { :id => @heading.translation_for(:es).id,
- :locale => "es",
- :name => "Renamed Example Public Body Heading ES" },
+ 'es' => { id: @heading.translation_for(:es).id,
+ locale: "es",
+ name: "Renamed Example Public Body Heading ES" },
# Add new translation
- 'fr' => { :locale => "fr",
- :name => "Example Public Body Heading FR" }
+ 'fr' => { locale: "fr",
+ name: "Example Public Body Heading FR" }
}
}
}
@@ -391,13 +391,13 @@
it "redirects to the edit page after a successful update" do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => @heading.name(:en)
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: @heading.name(:en)
}
}
}
@@ -412,13 +412,13 @@
it 'renders the form if creating the record was unsuccessful' do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => ''
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: ''
}
}
}
@@ -428,13 +428,13 @@
it 'is rebuilt with the given params' do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => {
- :translations_attributes => {
+ id: @heading.id,
+ public_body_heading: {
+ translations_attributes: {
'en' => {
- :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => 'Need a description'
+ id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: 'Need a description'
}
}
}
@@ -447,28 +447,28 @@
context 'on failure for multiple locales' do
before(:each) do
- @params = { :translations_attributes => {
- 'en' => { :id => @heading.translation_for(:en).id,
- :locale => 'en',
- :name => '' },
- 'es' => { :id => @heading.translation_for(:es).id,
- :locale => 'es',
- :name => 'Mi Nuevo Heading' }
+ @params = { translations_attributes: {
+ 'en' => { id: @heading.translation_for(:en).id,
+ locale: 'en',
+ name: '' },
+ 'es' => { id: @heading.translation_for(:es).id,
+ locale: 'es',
+ name: 'Mi Nuevo Heading' }
} }
end
it 'is rebuilt with the default locale translation' do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => @params
+ id: @heading.id,
+ public_body_heading: @params
}
expect(assigns(:public_body_heading).name(:en)).to eq('')
end
it 'is rebuilt with the alternative locale translation' do
post :update, params: {
- :id => @heading.id,
- :public_body_heading => @params
+ id: @heading.id,
+ public_body_heading: @params
}
AlaveteliLocalization.with_locale(:es) do
@@ -488,7 +488,7 @@
heading = FactoryBot.create(:public_body_heading)
expect {
- post :destroy, params: { :id => heading.id }
+ post :destroy, params: { id: heading.id }
}.to change { PublicBodyHeading.count }.from(1).to(0)
end
@@ -499,24 +499,24 @@
heading = FactoryBot.create(:public_body_heading)
category = FactoryBot.create(:public_body_category)
link = FactoryBot.create(:public_body_category_link,
- :public_body_category => category,
- :public_body_heading => heading,
- :category_display_order => 0)
+ public_body_category: category,
+ public_body_heading: heading,
+ category_display_order: 0)
expect {
- post :destroy, params: { :id => heading.id }
+ post :destroy, params: { id: heading.id }
}.to change { PublicBodyHeading.count }.from(1).to(0)
end
it 'notifies the admin that the heading was destroyed' do
heading = FactoryBot.create(:public_body_heading)
- post :destroy, params: { :id => heading.id }
+ post :destroy, params: { id: heading.id }
expect(flash[:notice]).to eq('Heading was successfully destroyed.')
end
it 'redirects to the categories index' do
heading = FactoryBot.create(:public_body_heading)
- post :destroy, params: { :id => heading.id }
+ post :destroy, params: { id: heading.id }
expect(response).to redirect_to(admin_categories_path)
end
@@ -527,9 +527,9 @@
render_views
before do
- @first = FactoryBot.create(:public_body_heading, :display_order => 0)
- @second = FactoryBot.create(:public_body_heading, :display_order => 1)
- @default_params = { :headings => [@second.id, @first.id] }
+ @first = FactoryBot.create(:public_body_heading, display_order: 0)
+ @second = FactoryBot.create(:public_body_heading, display_order: 1)
+ @default_params = { headings: [@second.id, @first.id] }
end
def make_request(params=@default_params)
@@ -553,7 +553,7 @@ def make_request(params=@default_params)
context 'when handling invalid input' do
before do
- @params = { :headings => [@second.id, @first.id, @second.id + 1]}
+ @params = { headings: [@second.id, @first.id, @second.id + 1]}
end
it 'should return an "unprocessable entity" status and an error message' do
@@ -579,16 +579,16 @@ def make_request(params=@default_params)
@heading = FactoryBot.create(:public_body_heading)
@first_category = FactoryBot.create(:public_body_category)
@first_link = FactoryBot.create(:public_body_category_link,
- :public_body_category => @first_category,
- :public_body_heading => @heading,
- :category_display_order => 0)
+ public_body_category: @first_category,
+ public_body_heading: @heading,
+ category_display_order: 0)
@second_category = FactoryBot.create(:public_body_category)
@second_link = FactoryBot.create(:public_body_category_link,
- :public_body_category => @second_category,
- :public_body_heading => @heading,
- :category_display_order => 1)
- @default_params = { :categories => [@second_category.id, @first_category.id],
- :id => @heading }
+ public_body_category: @second_category,
+ public_body_heading: @heading,
+ category_display_order: 1)
+ @default_params = { categories: [@second_category.id, @first_category.id],
+ id: @heading }
@old_order = [@first_category, @second_category]
@new_order = [@second_category, @first_category]
end
@@ -617,7 +617,7 @@ def make_request(params=@default_params)
before do
@new_category = FactoryBot.create(:public_body_category)
- @params = @default_params.merge(:categories => [@second_category.id,
+ @params = @default_params.merge(categories: [@second_category.id,
@first_category.id,
@new_category.id])
end
diff --git a/spec/controllers/admin_raw_email_controller_spec.rb b/spec/controllers/admin_raw_email_controller_spec.rb
index e81bb0e7a5..0c0ee7af1d 100644
--- a/spec/controllers/admin_raw_email_controller_spec.rb
+++ b/spec/controllers/admin_raw_email_controller_spec.rb
@@ -13,7 +13,7 @@
before { sign_in admin_user }
it 'renders the show template' do
- get :show, params: { :id => raw_email.id }
+ get :show, params: { id: raw_email.id }
end
context 'when showing a message with a "From" address in the holding pen' do
@@ -27,7 +27,7 @@
end
let(:public_body) do
- FactoryBot.create(:public_body, :request_email => 'body@example.uk')
+ FactoryBot.create(:public_body, request_email: 'body@example.uk')
end
let(:info_request) { info_request = FactoryBot.create(:info_request) }
@@ -39,7 +39,7 @@
let(:incoming_message) do
incoming_message = FactoryBot.create(
:plain_incoming_message,
- :info_request => InfoRequest.holding_pen_request,
+ info_request: InfoRequest.holding_pen_request,
)
incoming_message.raw_email.data = raw_email_data
incoming_message.raw_email.save!
@@ -49,20 +49,20 @@
let!(:info_request_event) do
FactoryBot.create(
:info_request_event,
- :event_type => 'response',
- :info_request => InfoRequest.holding_pen_request,
- :incoming_message => incoming_message,
- :params => {:rejected_reason => 'Too dull'}
+ event_type: 'response',
+ info_request: InfoRequest.holding_pen_request,
+ incoming_message: incoming_message,
+ params: {rejected_reason: 'Too dull'}
)
end
it 'assigns public bodies that match the "From" domain' do
- get :show, params: { :id => incoming_message.raw_email.id }
+ get :show, params: { id: incoming_message.raw_email.id }
expect(assigns[:public_bodies]).to eq [public_body]
end
it 'assigns guessed requests based on the hash' do
- get :show, params: { :id => incoming_message.raw_email.id }
+ get :show, params: { id: incoming_message.raw_email.id }
guess = InfoRequest::Guess.new(info_request, invalid_to, :idhash)
expect(assigns[:guessed_info_requests]).to eq([guess])
end
@@ -71,20 +71,20 @@
other_request =
FactoryBot.create(:incoming_message, subject: 'Basic Email').
info_request
- get :show, params: { :id => incoming_message.raw_email.id }
+ get :show, params: { id: incoming_message.raw_email.id }
guess = InfoRequest::Guess.new(other_request, 'Basic Email', :subject)
expect(assigns[:guessed_info_requests]).to include(guess)
end
it 'assigns a reason why the message is in the holding pen' do
- get :show, params: { :id => incoming_message.raw_email.id }
+ get :show, params: { id: incoming_message.raw_email.id }
expect(assigns[:rejected_reason]).to eq 'Too dull'
end
it 'assigns a default reason if no reason is given' do
info_request_event.params = {}
info_request_event.save!
- get :show, params: { :id => incoming_message.raw_email.id }
+ get :show, params: { id: incoming_message.raw_email.id }
expect(assigns[:rejected_reason]).to eq 'unknown reason'
end
@@ -96,7 +96,7 @@
before { sign_in admin_user }
it 'sends the email as an RFC-822 attachment' do
- get :show, params: { :id => raw_email.id, :format => 'eml' }
+ get :show, params: { id: raw_email.id, format: 'eml' }
expect(response.media_type).to eq('message/rfc822')
expect(response.body).to eq(raw_email.data)
end
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index 588cc62687..00c165ceae 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -51,13 +51,13 @@
context 'when passed a query' do
let!(:dog_request) { FactoryBot.create(:info_request,
- :title => 'A dog request') }
+ title: 'A dog request') }
let!(:cat_request) { FactoryBot.create(:info_request,
- :title => 'A cat request') }
+ title: 'A cat request') }
it 'assigns info requests with titles matching the query to the view
case insensitively' do
- get :index, params: { :query => 'Cat' }
+ get :index, params: { query: 'Cat' }
expect(assigns[:info_requests].include?(dog_request)).to be false
expect(assigns[:info_requests].include?(cat_request)).to be true
end
@@ -65,7 +65,7 @@
it 'does not include embargoed requests if the current user is an
admin user' do
cat_request.create_embargo
- get :index, params: { :query => 'cat' }
+ get :index, params: { query: 'cat' }
expect(assigns[:info_requests].include?(cat_request)).to be false
end
@@ -74,7 +74,7 @@
admin user' do
with_feature_enabled(:alaveteli_pro) do
cat_request.create_embargo
- get :index, params: { :query => 'cat' }
+ get :index, params: { query: 'cat' }
expect(assigns[:info_requests].include?(cat_request)).to be false
end
end
@@ -84,7 +84,7 @@
with_feature_enabled(:alaveteli_pro) do
cat_request.create_embargo
sign_in pro_admin_user
- get :index, params: { :query => 'cat' }
+ get :index, params: { query: 'cat' }
expect(assigns[:info_requests].include?(cat_request)).to be true
end
end
@@ -103,12 +103,12 @@
render_views
it "is successful" do
- get :show, params: { :id => info_request }
+ get :show, params: { id: info_request }
expect(response).to be_successful
end
it 'shows an external info request with no username' do
- get :show, params: { :id => external_request }
+ get :show, params: { id: external_request }
expect(response).to be_successful
end
@@ -142,7 +142,7 @@
before { sign_in(admin_user) }
it "is successful" do
- get :edit, params: { :id => info_request }
+ get :edit, params: { id: info_request }
expect(response).to be_successful
end
@@ -178,14 +178,14 @@
it "saves edits to a request" do
post :update, params: {
- :id => info_request,
- :info_request => {
- :title => "Renamed",
- :prominence => "normal",
- :described_state => "waiting_response",
- :awaiting_description => false,
- :allow_new_responses_from => 'anybody',
- :handle_rejected_responses => 'bounce'
+ id: info_request,
+ info_request: {
+ title: "Renamed",
+ prominence: "normal",
+ described_state: "waiting_response",
+ awaiting_description: false,
+ allow_new_responses_from: 'anybody',
+ handle_rejected_responses: 'bounce'
}
}
expect(request.flash[:notice]).to include('successful')
@@ -198,14 +198,14 @@
with(info_request.id).and_return(info_request)
expect(info_request).to receive(:expire)
post :update, params: {
- :id => info_request.id,
- :info_request => {
- :title => "Renamed",
- :prominence => "normal",
- :described_state => "waiting_response",
- :awaiting_description => false,
- :allow_new_responses_from => 'anybody',
- :handle_rejected_responses => 'bounce'
+ id: info_request.id,
+ info_request: {
+ title: "Renamed",
+ prominence: "normal",
+ described_state: "waiting_response",
+ awaiting_description: false,
+ allow_new_responses_from: 'anybody',
+ handle_rejected_responses: 'bounce'
}
}
end
@@ -250,19 +250,19 @@
allow(InfoRequest).to receive(:find).
with(info_request.id).and_return(info_request)
expect(info_request).to receive(:destroy)
- delete :destroy, params: { :id => info_request.id }
+ delete :destroy, params: { id: info_request.id }
end
it 'uses a different flash message to avoid trying to fetch a non existent user record' do
info_request = info_requests(:external_request)
- delete :destroy, params: { :id => info_request.id }
+ delete :destroy, params: { id: info_request.id }
expect(request.flash[:notice]).to include('external')
end
it 'redirects after destroying a request with incoming_messages' do
incoming_message = FactoryBot.create(:incoming_message_with_html_attachment,
- :info_request => info_request)
- delete :destroy, params: { :id => info_request.id }
+ info_request: info_request)
+ delete :destroy, params: { id: info_request.id }
expect(response).to redirect_to(admin_requests_url)
end
@@ -298,9 +298,9 @@
it "hides requests and sends a notification email that it has done so" do
post :hide, params: {
- :id => info_request.id,
- :explanation => "Foo",
- :reason => "vexatious"
+ id: info_request.id,
+ explanation: "Foo",
+ reason: "vexatious"
}
info_request.reload
expect(info_request.prominence).to eq("requester_only")
@@ -316,9 +316,9 @@
with(info_request.id).and_return(info_request)
expect(info_request).to receive(:expire)
post :hide, params: {
- :id => info_request.id,
- :explanation => "Foo",
- :reason => "vexatious"
+ id: info_request.id,
+ explanation: "Foo",
+ reason: "vexatious"
}
end
@@ -329,9 +329,9 @@
allow(InfoRequest).to receive(:find).with(@info_request.id).
and_return(@info_request)
- @default_params = { :id => @info_request.id,
- :explanation => 'Foo',
- :reason => 'vexatious' }
+ @default_params = { id: @info_request.id,
+ explanation: 'Foo',
+ reason: 'vexatious' }
end
def make_request(params=@default_params)
@@ -340,9 +340,9 @@ def make_request(params=@default_params)
it 'should redirect the the admin page for the request' do
make_request
- expect(response).to redirect_to(:controller => 'admin_request',
- :action => 'show',
- :id => @info_request.id)
+ expect(response).to redirect_to(controller: 'admin_request',
+ action: 'show',
+ id: @info_request.id)
end
it 'should set the request prominence to "requester_only"' do
diff --git a/spec/controllers/admin_spam_addresses_controller_spec.rb b/spec/controllers/admin_spam_addresses_controller_spec.rb
index 4a7c514a85..b26644c616 100644
--- a/spec/controllers/admin_spam_addresses_controller_spec.rb
+++ b/spec/controllers/admin_spam_addresses_controller_spec.rb
@@ -29,34 +29,34 @@
let(:spam_params) { FactoryBot.attributes_for(:spam_address) }
it 'creates a new spam address with the given parameters' do
- post :create, params: { :spam_address => spam_params }
+ post :create, params: { spam_address: spam_params }
expect(assigns(:spam_address).email).to eq(spam_params[:email])
expect(assigns(:spam_address)).to be_persisted
end
it 'redirects to the index action if successful' do
allow_any_instance_of(SpamAddress).to receive(:save).and_return(true)
- post :create, params: { :spam_address => spam_params }
+ post :create, params: { spam_address: spam_params }
expect(response).to redirect_to(admin_spam_addresses_path)
end
it 'notifies the admin the spam address has been created' do
allow_any_instance_of(SpamAddress).to receive(:save).and_return(true)
- post :create, params: { :spam_address => spam_params }
+ post :create, params: { spam_address: spam_params }
msg = "#{ spam_params[:email] } has been added to the spam addresses list"
expect(flash[:notice]).to eq(msg)
end
it 'renders the index action if the address could not be saved' do
allow_any_instance_of(SpamAddress).to receive(:save).and_return(false)
- post :create, params: { :spam_address => spam_params }
+ post :create, params: { spam_address: spam_params }
expect(response).to render_template('index')
end
it 'collects the spam addresses if the address could not be saved' do
3.times { FactoryBot.create(:spam_address) }
allow_any_instance_of(SpamAddress).to receive(:save).and_return(false)
- post :create, params: { :spam_address => spam_params }
+ post :create, params: { spam_address: spam_params }
expect(assigns(:spam_addresses)).to eq(SpamAddress.all)
end
@@ -66,7 +66,7 @@
before(:each) do
@spam = FactoryBot.create(:spam_address)
- delete :destroy, params: { :id => @spam.id }
+ delete :destroy, params: { id: @spam.id }
end
it 'finds the spam address to delete' do
diff --git a/spec/controllers/admin_user_controller_spec.rb b/spec/controllers/admin_user_controller_spec.rb
index 995333c6c2..4fe7e5a200 100644
--- a/spec/controllers/admin_user_controller_spec.rb
+++ b/spec/controllers/admin_user_controller_spec.rb
@@ -31,68 +31,68 @@
end
it 'assigns a custom sort order if valid' do
- get :index, params: { :sort_order => 'created_at_asc' }
+ get :index, params: { sort_order: 'created_at_asc' }
expect(assigns[:sort_order]).to eq('created_at_asc')
end
it 'uses the default sort order if a custom sort order is invalid' do
- get :index, params: { :sort_order => 'invalid' }
+ get :index, params: { sort_order: 'invalid' }
expect(assigns[:sort_order]).to eq('name_asc')
end
it 'sorts the records by name_asc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Bob')
- u2 = FactoryBot.create(:user, :name => 'Alice')
- get :index, params: { :sort_order => 'name_asc' }
+ u1 = FactoryBot.create(:user, name: 'Bob')
+ u2 = FactoryBot.create(:user, name: 'Alice')
+ get :index, params: { sort_order: 'name_asc' }
expect(assigns[:admin_users]).to eq([u2, u1])
end
it 'sorts the records by name_desc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Alice')
- u2 = FactoryBot.create(:user, :name => 'Bob')
- get :index, params: { :sort_order => 'name_desc' }
+ u1 = FactoryBot.create(:user, name: 'Alice')
+ u2 = FactoryBot.create(:user, name: 'Bob')
+ get :index, params: { sort_order: 'name_desc' }
expect(assigns[:admin_users]).to eq([u2, u1])
end
it 'sorts the records by created_at_asc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Bob')
- u2 = FactoryBot.create(:user, :name => 'Alice')
- get :index, params: { :sort_order => 'created_at_asc' }
+ u1 = FactoryBot.create(:user, name: 'Bob')
+ u2 = FactoryBot.create(:user, name: 'Alice')
+ get :index, params: { sort_order: 'created_at_asc' }
expect(assigns[:admin_users]).to eq([u1, u2])
end
it 'sorts the records by created_at_desc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Alice')
- u2 = FactoryBot.create(:user, :name => 'Bob')
- get :index, params: { :sort_order => 'created_at_desc' }
+ u1 = FactoryBot.create(:user, name: 'Alice')
+ u2 = FactoryBot.create(:user, name: 'Bob')
+ get :index, params: { sort_order: 'created_at_desc' }
expect(assigns[:admin_users]).to eq([u2, u1])
end
it 'sorts the records by updated_at_asc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Alice')
- u2 = FactoryBot.create(:user, :name => 'Bob')
+ u1 = FactoryBot.create(:user, name: 'Alice')
+ u2 = FactoryBot.create(:user, name: 'Bob')
u1.touch
- get :index, params: { :sort_order => 'updated_at_asc' }
+ get :index, params: { sort_order: 'updated_at_asc' }
expect(assigns[:admin_users]).to eq([u2, u1])
end
it 'sorts the records by updated_at_desc' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Bob')
- u2 = FactoryBot.create(:user, :name => 'Alice')
+ u1 = FactoryBot.create(:user, name: 'Bob')
+ u2 = FactoryBot.create(:user, name: 'Alice')
u1.touch
- get :index, params: { :sort_order => 'updated_at_desc' }
+ get :index, params: { sort_order: 'updated_at_desc' }
expect(assigns[:admin_users]).to eq([u1, u2])
end
it "assigns users matching a case-insensitive query to the view" do
- user = FactoryBot.create(:user, :name => 'Bob Smith')
- get :index, params: { :query => 'bob' }
+ user = FactoryBot.create(:user, name: 'Bob Smith')
+ get :index, params: { query: 'bob' }
expect(assigns[:admin_users].include?(user)).to be true
end
@@ -110,10 +110,10 @@
it 'searches and sorts the records' do
User.destroy_all
- u1 = FactoryBot.create(:user, :name => 'Alice Smith')
- u2 = FactoryBot.create(:user, :name => 'Bob Smith')
- u3 = FactoryBot.create(:user, :name => 'John Doe')
- get :index, params: { :query => 'smith', :sort_order => 'name_desc' }
+ u1 = FactoryBot.create(:user, name: 'Alice Smith')
+ u2 = FactoryBot.create(:user, name: 'Bob Smith')
+ u3 = FactoryBot.create(:user, name: 'John Doe')
+ get :index, params: { query: 'smith', sort_order: 'name_desc' }
expect(assigns[:admin_users]).to eq([u2, u1])
end
@@ -121,7 +121,7 @@
User.destroy_all
admin_user = FactoryBot.create(:admin_user)
user = FactoryBot.create(:user)
- get :index, params: { :roles => [ 'admin' ] }
+ get :index, params: { roles: [ 'admin' ] }
expect(assigns[:admin_users]).to eq([admin_user])
end
@@ -130,7 +130,7 @@
admin_user = FactoryBot.create(:admin_user)
pro_user = FactoryBot.create(:pro_user)
user = FactoryBot.create(:user)
- get :index, params: { :roles => [ 'admin', 'pro' ] }
+ get :index, params: { roles: [ 'admin', 'pro' ] }
expect(assigns[:admin_users]).to eq([admin_user, pro_user])
end
@@ -143,13 +143,13 @@
it "is successful" do
sign_in admin_user
- get :show, params: { :id => FactoryBot.create(:user) }
+ get :show, params: { id: FactoryBot.create(:user) }
expect(response).to be_successful
end
it "assigns the user's info requests to the view" do
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:info_requests]).to eq([info_request])
end
@@ -157,7 +157,7 @@
not a pro admin user' do
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:info_requests]).to eq([])
end
@@ -168,7 +168,7 @@
with_feature_enabled(:alaveteli_pro) do
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:info_requests]).to eq([])
end
end
@@ -178,7 +178,7 @@
with_feature_enabled(:alaveteli_pro) do
info_request.create_embargo
sign_in pro_admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:info_requests].include?(info_request)).to be true
end
end
@@ -186,20 +186,20 @@
end
it "assigns the user's comments to the view" do
- comment = FactoryBot.create(:comment, :info_request => info_request,
- :user => info_request.user)
+ comment = FactoryBot.create(:comment, info_request: info_request,
+ user: info_request.user)
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:comments]).to eq([comment])
end
it 'does not include comments on embargoed requests if the current user is
not a pro admin user' do
- comment = FactoryBot.create(:comment, :info_request => info_request,
- :user => info_request.user)
+ comment = FactoryBot.create(:comment, info_request: info_request,
+ user: info_request.user)
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:comments]).to eq([])
end
@@ -208,11 +208,11 @@
it 'does not include comments on embargoed requests if the current user is
not a pro admin user' do
with_feature_enabled(:alaveteli_pro) do
- comment = FactoryBot.create(:comment, :info_request => info_request,
- :user => info_request.user)
+ comment = FactoryBot.create(:comment, info_request: info_request,
+ user: info_request.user)
info_request.create_embargo
sign_in admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:comments]).to eq([])
end
end
@@ -220,11 +220,11 @@
it 'includes comments on embargoed requests if the current user is a
pro admin user' do
with_feature_enabled(:alaveteli_pro) do
- comment = FactoryBot.create(:comment, :info_request => info_request,
- :user => info_request.user)
+ comment = FactoryBot.create(:comment, info_request: info_request,
+ user: info_request.user)
info_request.create_embargo
sign_in pro_admin_user
- get :show, params: { :id => info_request.user }
+ get :show, params: { id: info_request.user }
expect(assigns[:comments]).to eq([comment])
end
end
@@ -245,15 +245,15 @@
user = FactoryBot.create(:user)
expect(user.can_make_batch_requests?).to be false
sign_in admin_user
- post :update, params: { :id => user.id,
- :admin_user => {
- :can_make_batch_requests => '1',
- :name => user.name,
- :email => user.email,
- :ban_text => user.ban_text,
- :about_me => user.about_me,
- :no_limit => user.no_limit,
- :confirmed_not_spam => user.confirmed_not_spam
+ post :update, params: { id: user.id,
+ admin_user: {
+ can_make_batch_requests: '1',
+ name: user.name,
+ email: user.email,
+ ban_text: user.ban_text,
+ about_me: user.about_me,
+ no_limit: user.no_limit,
+ confirmed_not_spam: user.confirmed_not_spam
}
}
expect(flash[:notice]).to eq('User successfully updated.')
@@ -264,17 +264,17 @@
it "should not allow an existing email address to be used" do
existing_email = 'donotreuse@localhost'
- FactoryBot.create(:user, :email => existing_email)
- user = FactoryBot.create(:user, :email => 'user1@localhost')
+ FactoryBot.create(:user, email: existing_email)
+ user = FactoryBot.create(:user, email: 'user1@localhost')
sign_in admin_user
- post :update, params: { :id => user.id,
- :admin_user => {
- :name => user.name,
- :email => existing_email,
- :ban_text => user.ban_text,
- :about_me => user.about_me,
- :no_limit => user.no_limit,
- :confirmed_not_spam => user.confirmed_not_spam
+ post :update, params: { id: user.id,
+ admin_user: {
+ name: user.name,
+ email: existing_email,
+ ban_text: user.ban_text,
+ about_me: user.about_me,
+ no_limit: user.no_limit,
+ confirmed_not_spam: user.confirmed_not_spam
}
}
user = User.find(user.id)
@@ -283,17 +283,17 @@
it "sets the user's roles" do
user = FactoryBot.create(:user)
- admin_role = Role.where(:name => 'admin').first
+ admin_role = Role.where(name: 'admin').first
expect(user.is_admin?).to be false
sign_in admin_user
- post :update, params: { :id => user.id,
- :admin_user => {
- :name => user.name,
- :ban_text => user.ban_text,
- :about_me => user.about_me,
- :role_ids => [ admin_role.id ],
- :no_limit => user.no_limit,
- :confirmed_not_spam => user.confirmed_not_spam
+ post :update, params: { id: user.id,
+ admin_user: {
+ name: user.name,
+ ban_text: user.ban_text,
+ about_me: user.about_me,
+ role_ids: [ admin_role.id ],
+ no_limit: user.no_limit,
+ confirmed_not_spam: user.confirmed_not_spam
}
}
user = User.find(user.id)
@@ -303,14 +303,13 @@
it "unsets the user's roles if no role ids are supplied" do
expect(admin_user.is_admin?).to be true
sign_in admin_user
- post :update, params: { :id => admin_user.id,
- :admin_user => {
- :name => admin_user.name,
- :ban_text => admin_user.ban_text,
- :about_me => admin_user.about_me,
- :no_limit => admin_user.no_limit,
- :confirmed_not_spam =>
- admin_user.confirmed_not_spam
+ post :update, params: { id: admin_user.id,
+ admin_user: {
+ name: admin_user.name,
+ ban_text: admin_user.ban_text,
+ about_me: admin_user.about_me,
+ no_limit: admin_user.no_limit,
+ confirmed_not_spam: admin_user.confirmed_not_spam
}
}
user = User.find(admin_user.id)
@@ -319,17 +318,17 @@
it 'does not set a role the setter cannot grant and revoke' do
user = FactoryBot.create(:user)
- pro_role = Role.where(:name => 'pro').first
+ pro_role = Role.where(name: 'pro').first
expect(user.is_pro?).to be false
sign_in admin_user
- post :update, params: { :id => user.id,
- :admin_user => {
- :name => user.name,
- :ban_text => user.ban_text,
- :about_me => user.about_me,
- :role_ids => [pro_role.id],
- :no_limit => user.no_limit,
- :confirmed_not_spam => user.confirmed_not_spam
+ post :update, params: { id: user.id,
+ admin_user: {
+ name: user.name,
+ ban_text: user.ban_text,
+ about_me: user.about_me,
+ role_ids: [pro_role.id],
+ no_limit: user.no_limit,
+ confirmed_not_spam: user.confirmed_not_spam
}
}
expect(flash[:error]).to eq("Not permitted to change roles")
@@ -342,14 +341,14 @@
role_id = Role.maximum(:id) + 1
expect(user.is_pro?).to be false
sign_in admin_user
- post :update, params: { :id => user.id,
- :admin_user => {
- :name => user.name,
- :ban_text => user.ban_text,
- :about_me => user.about_me,
- :role_ids => [role_id],
- :no_limit => user.no_limit,
- :confirmed_not_spam => user.confirmed_not_spam
+ post :update, params: { id: user.id,
+ admin_user: {
+ name: user.name,
+ ban_text: user.ban_text,
+ about_me: user.about_me,
+ role_ids: [role_id],
+ no_limit: user.no_limit,
+ confirmed_not_spam: user.confirmed_not_spam
}
}
user = User.find(user.id)
@@ -366,51 +365,51 @@
end
it 'redirects to the page the admin was previously on' do
- comment = FactoryBot.create(:visible_comment, :user => @user)
+ comment = FactoryBot.create(:visible_comment, user: @user)
post :modify_comment_visibility, params: {
- :id => @user.id,
- :comment_ids => comment.id,
- :hide_selected => 'hidden'
+ id: @user.id,
+ comment_ids: comment.id,
+ hide_selected: 'hidden'
}
expect(response).to redirect_to(admin_user_path(@user))
end
it 'sets the given comments visibility to hidden' do
- comments = FactoryBot.create_list(:visible_comment, 3, :user => @user)
+ comments = FactoryBot.create_list(:visible_comment, 3, user: @user)
comment_ids = comments.map(&:id)
post :modify_comment_visibility, params: {
- :id => @user.id,
- :comment_ids => comment_ids,
- :hide_selected => 'hidden'
+ id: @user.id,
+ comment_ids: comment_ids,
+ hide_selected: 'hidden'
}
Comment.find(comment_ids).each { |comment| expect(comment).not_to be_visible }
end
it 'sets the given comments visibility to visible' do
- comments = FactoryBot.create_list(:hidden_comment, 3, :user => @user)
+ comments = FactoryBot.create_list(:hidden_comment, 3, user: @user)
comment_ids = comments.map(&:id)
post :modify_comment_visibility, params: {
- :id => @user.id,
- :comment_ids => comment_ids,
- :unhide_selected => 'visible'
+ id: @user.id,
+ comment_ids: comment_ids,
+ unhide_selected: 'visible'
}
Comment.find(comment_ids).each { |comment| expect(comment).to be_visible }
end
it 'only modifes the given list of comments' do
- unaffected_comment = FactoryBot.create(:hidden_comment, :user => @user)
- affected_comment = FactoryBot.create(:hidden_comment, :user => @user)
+ unaffected_comment = FactoryBot.create(:hidden_comment, user: @user)
+ affected_comment = FactoryBot.create(:hidden_comment, user: @user)
post :modify_comment_visibility, params: {
- :id => @user.id,
- :comment_ids => affected_comment.id,
- :unhide_selected => 'visible'
+ id: @user.id,
+ comment_ids: affected_comment.id,
+ unhide_selected: 'visible'
}
expect(Comment.find(unaffected_comment.id)).not_to be_visible
@@ -418,14 +417,14 @@
end
it 'preserves the visibility if a comment is already of the requested visibility' do
- hidden_comment = FactoryBot.create(:hidden_comment, :user => @user)
- visible_comment = FactoryBot.create(:visible_comment, :user => @user)
+ hidden_comment = FactoryBot.create(:hidden_comment, user: @user)
+ visible_comment = FactoryBot.create(:visible_comment, user: @user)
comment_ids = [hidden_comment.id, visible_comment.id]
post :modify_comment_visibility, params: {
- :id => @user.id,
- :comment_ids => comment_ids,
- :unhide_selected => 'visible'
+ id: @user.id,
+ comment_ids: comment_ids,
+ unhide_selected: 'visible'
}
Comment.find(comment_ids).each { |c| expect(c).to be_visible }
diff --git a/spec/controllers/alaveteli_pro/dashboard_controller_spec.rb b/spec/controllers/alaveteli_pro/dashboard_controller_spec.rb
index d934c75a61..121f1a10b2 100644
--- a/spec/controllers/alaveteli_pro/dashboard_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/dashboard_controller_spec.rb
@@ -30,12 +30,12 @@
context 'if a page param is passed' do
it 'assigns @page a numerical page param' do
- get :index, params: { :page => 2 }
+ get :index, params: { page: 2 }
expect(assigns[:page]).to eq 2
end
it 'does not assign a non-numerical page param' do
- get :index, params: { :page => 'foo' }
+ get :index, params: { page: 'foo' }
expect(assigns[:page]).to eq 1
end
end
diff --git a/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb b/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb
index 6134ca5ece..8f7c8d1556 100644
--- a/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb
@@ -39,8 +39,8 @@
context 'when a search is passed' do
it 'applies the search' do
- get :index, params: { :alaveteli_pro_request_filter => {
- :search => 'foo'
+ get :index, params: { alaveteli_pro_request_filter: {
+ search: 'foo'
}
}
expect(assigns[:request_summaries].size).to eq 1
diff --git a/spec/controllers/alaveteli_pro/payment_methods_controller_spec.rb b/spec/controllers/alaveteli_pro/payment_methods_controller_spec.rb
index 352a12409e..ff00f0db3e 100644
--- a/spec/controllers/alaveteli_pro/payment_methods_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/payment_methods_controller_spec.rb
@@ -31,7 +31,7 @@
it 'redirects to the login form' do
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
end
diff --git a/spec/controllers/alaveteli_pro/plans_controller_spec.rb b/spec/controllers/alaveteli_pro/plans_controller_spec.rb
index d816a50bb9..3da26da3b0 100644
--- a/spec/controllers/alaveteli_pro/plans_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/plans_controller_spec.rb
@@ -56,7 +56,7 @@
it 'redirects to the login form' do
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
it 'sets in_pro_area' do
@@ -123,7 +123,7 @@
source: stripe_helper.generate_card_token)
Stripe::Subscription.create(customer: customer, plan: 'pro')
- user.create_pro_account(:stripe_customer_id => customer.id)
+ user.create_pro_account(stripe_customer_id: customer.id)
user.add_role(:pro)
get :show, params: { id: 'pro' }
end
@@ -149,7 +149,7 @@
Stripe::Subscription.create(customer: customer, plan: 'pro')
subscription.delete
- user.create_pro_account(:stripe_customer_id => customer.id)
+ user.create_pro_account(stripe_customer_id: customer.id)
get :show, params: { id: 'pro' }
end
diff --git a/spec/controllers/alaveteli_pro/public_bodies_controller_spec.rb b/spec/controllers/alaveteli_pro/public_bodies_controller_spec.rb
index 1b0837a2b4..6dfd96e264 100644
--- a/spec/controllers/alaveteli_pro/public_bodies_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/public_bodies_controller_spec.rb
@@ -4,7 +4,7 @@
describe "#index" do
let!(:pro_user) { FactoryBot.create(:pro_user) }
- let!(:body) { FactoryBot.create(:public_body, :name => 'example') }
+ let!(:body) { FactoryBot.create(:public_body, name: 'example') }
let!(:defunct_body) do
FactoryBot.create(:public_body, :defunct, name: 'defunct')
end
@@ -12,8 +12,8 @@
FactoryBot.create(:public_body, :not_apply, name: 'not_apply')
end
let!(:not_requestable_body) do
- FactoryBot.create(:public_body, :name => 'not_requestable',
- :request_email => 'blank')
+ FactoryBot.create(:public_body, name: 'not_requestable',
+ request_email: 'blank')
end
before do
diff --git a/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb b/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb
index e299a4f6bb..1d06dc62aa 100644
--- a/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb
+++ b/spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb
@@ -39,7 +39,7 @@
it 'redirects to the login form' do
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
end
@@ -197,7 +197,7 @@
customer =
Stripe::Customer.create(email: user.email,
source: stripe_helper.generate_card_token)
- user.create_pro_account(:stripe_customer_id => customer.id)
+ user.create_pro_account(stripe_customer_id: customer.id)
post :create, params: {
'stripe_token' => token,
@@ -472,7 +472,7 @@
context 'when invalid params are submitted' do
it 'redirects to the plan page if there is a plan' do
- post :create, params: { :plan_id => 'pro' }
+ post :create, params: { plan_id: 'pro' }
expect(response).to redirect_to(plan_path('pro'))
end
@@ -768,7 +768,7 @@
it 'redirects to the login form' do
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
end
@@ -900,7 +900,7 @@
it 'redirects to the login form' do
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
end
@@ -1102,7 +1102,7 @@
context 'when invalid params are submitted' do
it 'redirects to the plan page if there is a plan' do
- delete :destroy, params: { :id => 'unknown' }
+ delete :destroy, params: { id: 'unknown' }
expect(response).to redirect_to(subscriptions_path)
end
diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb
index 7b9114f876..c30297ff6a 100644
--- a/spec/controllers/api_controller_spec.rb
+++ b/spec/controllers/api_controller_spec.rb
@@ -15,7 +15,7 @@
it 'should check that an API key is given as a param' do
expect {
- post :create_request, params: { :request_json => @request_data.to_json }
+ post :create_request, params: { request_json: @request_data.to_json }
}.to raise_error ApplicationController::PermissionDenied
expect(InfoRequest.count).to eq(@number_of_requests)
end
@@ -23,8 +23,8 @@
it 'should check the API key' do
expect {
post :create_request, params: {
- :k => 'This is not really an API key',
- :request_json => @request_data.to_json
+ k: 'This is not really an API key',
+ request_json: @request_data.to_json
}
}.to raise_error ApplicationController::PermissionDenied
expect(InfoRequest.count).to eq(@number_of_requests)
@@ -34,8 +34,8 @@
def _create_request
post :create_request,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :request_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ request_json: {
'title' => 'Tell me about your chickens',
'body' => "Dear Sir,\n\nI should like to know about your " \
"chickens.\n\nYours in faith,\nBob\n",
@@ -52,7 +52,7 @@ def _create_request
it 'should create a new request from a POST' do
number_of_requests =
InfoRequest.
- where(:public_body_id => public_bodies(:geraldine_public_body).id).
+ where(public_body_id: public_bodies(:geraldine_public_body).id).
count
request_data = {
@@ -64,8 +64,8 @@ def _create_request
post :create_request,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :request_json => request_data.to_json
+ k: public_bodies(:geraldine_public_body).api_key,
+ request_json: request_data.to_json
}
expect(response).to be_successful
@@ -76,7 +76,7 @@ def _create_request
updated_count =
InfoRequest.
- where(:public_body_id => public_bodies(:geraldine_public_body).id).
+ where(public_body_id: public_bodies(:geraldine_public_body).id).
count
expect(updated_count).to eq(number_of_requests + 1)
@@ -103,7 +103,7 @@ def _create_request
# Initially it has no incoming messages
initial_count =
- IncomingMessage.where(:info_request_id => request_id).count
+ IncomingMessage.where(info_request_id: request_id).count
expect(initial_count).to eq(0)
# Now add one
@@ -111,9 +111,9 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
@@ -123,7 +123,7 @@ def _create_request
# And make sure it worked
expect(response).to be_successful
incoming_messages =
- IncomingMessage.where(:info_request_id => request_id)
+ IncomingMessage.where(info_request_id: request_id)
expect(incoming_messages.count).to eq(1)
incoming_message = incoming_messages[0]
@@ -137,7 +137,7 @@ def _create_request
# Initially it has one outgoing message
outgoing_messages =
- OutgoingMessage.where(:info_request_id => request_id).count
+ OutgoingMessage.where(info_request_id: request_id).count
expect(outgoing_messages).to eq(1)
# Add another, as a followup
@@ -145,9 +145,9 @@ def _create_request
followup_body = "Pls answer ASAP.\nkthxbye\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'request',
'sent_at' => sent_at,
'body' => followup_body
@@ -158,8 +158,8 @@ def _create_request
expect(response).to be_successful
followup_messages =
- OutgoingMessage.where(:info_request_id => request_id,
- :message_type => 'followup')
+ OutgoingMessage.where(info_request_id: request_id,
+ message_type: 'followup')
expect(followup_messages.size).to eq(1)
followup_message = followup_messages[0]
@@ -173,7 +173,7 @@ def _create_request
request_id = info_requests(:external_request).id
# Initially it has no incoming messages
- actual1 = IncomingMessage.where(:info_request_id => request_id).count
+ actual1 = IncomingMessage.where(info_request_id: request_id).count
expect(actual1).to eq(0)
# Now add one
@@ -181,10 +181,10 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :state => 'successful',
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ state: 'successful',
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
@@ -194,7 +194,7 @@ def _create_request
# And make sure it worked
expect(response).to be_successful
- actual2 = IncomingMessage.where(:info_request_id => request_id).count
+ actual2 = IncomingMessage.where(info_request_id: request_id).count
expect(actual2).to eq(1)
request = InfoRequest.find_by_id(request_id)
@@ -207,7 +207,7 @@ def _create_request
# Initially it has no incoming messages
initial_count =
- IncomingMessage.where(:info_request_id => request_id).count
+ IncomingMessage.where(info_request_id: request_id).count
expect(initial_count).to eq(0)
# Now add one
@@ -215,10 +215,10 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :state => 'random_string',
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ state: 'random_string',
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
@@ -232,7 +232,7 @@ def _create_request
])
incoming_messages =
- IncomingMessage.where(:info_request_id => request_id)
+ IncomingMessage.where(info_request_id: request_id)
expect(incoming_messages.count).to eq(0)
request = InfoRequest.find_by_id(request_id)
expect(request.described_state).to eq('waiting_response')
@@ -245,9 +245,9 @@ def _create_request
request_id = info_requests(:naughty_chicken_request).id
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'request',
'sent_at' => Time.zone.now.iso8601,
'body' => 'xxx'
@@ -270,9 +270,9 @@ def _create_request
post :add_correspondence,
params: {
- :k => public_bodies(:humpadink_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:humpadink_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'request',
'sent_at' => Time.zone.now.iso8601,
'body' => 'xxx'
@@ -295,9 +295,9 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
@@ -313,9 +313,9 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
@@ -328,14 +328,14 @@ def _create_request
it 'should not allow files to be attached to a followup' do
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => info_requests(:external_request).id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: info_requests(:external_request).id,
+ correspondence_json: {
'direction' => 'request',
'sent_at' => Time.zone.now.iso8601,
'body' => 'Are you joking, or are you serious?'
}.to_json,
- :attachments => [
+ attachments: [
fixture_file_upload('tfl.pdf')
]
}
@@ -351,7 +351,7 @@ def _create_request
request_id = info_requests(:external_request).id
# Initially it has no incoming messages
- actual1 = IncomingMessage.where(:info_request_id => request_id).count
+ actual1 = IncomingMessage.where(info_request_id: request_id).count
expect(actual1).to eq(0)
# Now add one
@@ -359,14 +359,14 @@ def _create_request
response_body = "Thank you for your request for information, which we are handling in accordance with the Freedom of Information Act 2000. You will receive a response within 20 working days or before the next full moon, whichever is sooner.\n\nYours sincerely,\nJohn Gandermulch,\nExample Council FOI Officer\n"
post :add_correspondence,
params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :correspondence_json => {
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ correspondence_json: {
'direction' => 'response',
'sent_at' => sent_at,
'body' => response_body
}.to_json,
- :attachments => [
+ attachments: [
fixture_file_upload('tfl.pdf')
]
}
@@ -374,7 +374,7 @@ def _create_request
# And make sure it worked
expect(response).to be_successful
- incoming_messages = IncomingMessage.where(:info_request_id => request_id)
+ incoming_messages = IncomingMessage.where(info_request_id: request_id)
expect(incoming_messages.count).to eq(1)
incoming_message = incoming_messages[0]
@@ -402,9 +402,9 @@ def _create_request
# Now accept an update
post :update_state, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :state => 'partially_successful'
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ state: 'partially_successful'
}
# It should have updated the status
@@ -430,9 +430,9 @@ def _create_request
# Now post an invalid update
post :update_state, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id,
- :state => 'random_string'
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id,
+ state: 'random_string'
}
# Check that the error has been raised...
@@ -449,8 +449,8 @@ def _create_request
allow(InfoRequest).to receive(:find_by_id).with(request_id).and_return(nil)
post :update_state, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id, :state => "successful"
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id, state: "successful"
}
expect(response.status).to eq(404)
@@ -461,8 +461,8 @@ def _create_request
request_id = info_requests(:naughty_chicken_request).id
post :update_state, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => request_id, :state => 'successful'
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: request_id, state: 'successful'
}
expect(response.status).to eq(403)
@@ -476,8 +476,8 @@ def _create_request
info_request = info_requests(:naughty_chicken_request)
get :show_request, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => info_request.id
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: info_request.id
}
expect(response).to be_successful
@@ -494,8 +494,8 @@ def _create_request
it 'should show information about an external request' do
info_request = info_requests(:external_request)
get :show_request, params: {
- :k => public_bodies(:geraldine_public_body).api_key,
- :id => info_request.id
+ k: public_bodies(:geraldine_public_body).api_key,
+ id: info_request.id
}
expect(response).to be_successful
@@ -510,9 +510,9 @@ def _create_request
it 'should show an Atom feed of new request events' do
get :body_request_events,
params: {
- :id => public_bodies(:geraldine_public_body).id,
- :k => public_bodies(:geraldine_public_body).api_key,
- :feed_type => 'atom'
+ id: public_bodies(:geraldine_public_body).id,
+ k: public_bodies(:geraldine_public_body).api_key,
+ feed_type: 'atom'
}
expect(response).to be_successful
@@ -528,9 +528,9 @@ def _create_request
it 'should show a JSON feed of new request events' do
get :body_request_events,
params: {
- :id => public_bodies(:geraldine_public_body).id,
- :k => public_bodies(:geraldine_public_body).api_key,
- :feed_type => 'json'
+ id: public_bodies(:geraldine_public_body).id,
+ k: public_bodies(:geraldine_public_body).api_key,
+ feed_type: 'json'
}
expect(response).to be_successful
@@ -550,9 +550,9 @@ def _create_request
it 'should honour the since_event_id parameter' do
get :body_request_events,
params: {
- :id => public_bodies(:geraldine_public_body).id,
- :k => public_bodies(:geraldine_public_body).api_key,
- :feed_type => 'json'
+ id: public_bodies(:geraldine_public_body).id,
+ k: public_bodies(:geraldine_public_body).api_key,
+ feed_type: 'json'
}
expect(response).to be_successful
@@ -561,10 +561,10 @@ def _create_request
get :body_request_events,
params: {
- :id => public_bodies(:geraldine_public_body).id,
- :k => public_bodies(:geraldine_public_body).api_key,
- :feed_type => 'json',
- :since_event_id => second_event_id
+ id: public_bodies(:geraldine_public_body).id,
+ k: public_bodies(:geraldine_public_body).api_key,
+ feed_type: 'json',
+ since_event_id: second_event_id
}
expect(response).to be_successful
expect(assigns[:event_data]).to eq([first_event])
@@ -573,10 +573,10 @@ def _create_request
it 'should honour the since_date parameter' do
get :body_request_events,
params: {
- :id => public_bodies(:humpadink_public_body).id,
- :k => public_bodies(:humpadink_public_body).api_key,
- :since_date => '2010-01-01',
- :feed_type => 'atom'
+ id: public_bodies(:humpadink_public_body).id,
+ k: public_bodies(:humpadink_public_body).api_key,
+ since_date: '2010-01-01',
+ feed_type: 'atom'
}
expect(response).to be_successful
@@ -588,10 +588,10 @@ def _create_request
get :body_request_events,
params: {
- :id => public_bodies(:humpadink_public_body).id,
- :k => public_bodies(:humpadink_public_body).api_key,
- :since_date => '2010-01-01',
- :feed_type => 'json'
+ id: public_bodies(:humpadink_public_body).id,
+ k: public_bodies(:humpadink_public_body).api_key,
+ since_date: '2010-01-01',
+ feed_type: 'json'
}
assigns[:events].each do |event|
expect(event.created_at).to be >= Date.new(2010, 1, 1)
@@ -607,9 +607,9 @@ def _create_request
before do
get :body_request_events,
params: {
- :id => public_bodies(:humpadink_public_body).id,
- :k => public_bodies(:humpadink_public_body).api_key,
- :feed_type => 'atom'
+ id: public_bodies(:humpadink_public_body).id,
+ k: public_bodies(:humpadink_public_body).api_key,
+ feed_type: 'atom'
}
end
@@ -626,10 +626,10 @@ def _create_request
# from the fixtures
get :body_request_events,
params: {
- :id => public_bodies(:humpadink_public_body).id,
- :k => public_bodies(:humpadink_public_body).api_key,
- :since_date => '2018-01-01',
- :feed_type => 'atom'
+ id: public_bodies(:humpadink_public_body).id,
+ k: public_bodies(:humpadink_public_body).api_key,
+ since_date: '2018-01-01',
+ feed_type: 'atom'
}
end
diff --git a/spec/controllers/attachments_controller_spec.rb b/spec/controllers/attachments_controller_spec.rb
index 5858755901..61c83a2235 100644
--- a/spec/controllers/attachments_controller_spec.rb
+++ b/spec/controllers/attachments_controller_spec.rb
@@ -76,20 +76,20 @@ def show(params = {})
# https://github.com/mysociety/alaveteli/issues/351
it "should return 404 for ugly URLs containing a request id that isn't an integer" do
ugly_id = "55195"
- expect { show(:id => ugly_id) }
+ expect { show(id: ugly_id) }
.to raise_error(ActiveRecord::RecordNotFound)
end
it "should return 404 when incoming message and request ids
don't match" do
- expect { show(:id => info_request.id + 1) }
+ expect { show(id: info_request.id + 1) }
.to raise_error(ActiveRecord::RecordNotFound)
end
it "should return 404 for ugly URLs contain a request id that isn't an
integer, even if the integer prefix refers to an actual request" do
ugly_id = "#{FactoryBot.create(:info_request).id}95"
- expect { show(:id => ugly_id) }
+ expect { show(id: ugly_id) }
.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -103,7 +103,7 @@ def show(params = {})
'interesting.pdf'
)
expect(attachment).to be_nil
- show(:part => 5)
+ show(part: 5)
expect(response.status).to eq(303)
new_location = response.header['Location']
expect(new_location)
@@ -114,11 +114,11 @@ def show(params = {})
info_request = FactoryBot.create(:info_request_with_html_attachment)
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 5,
- :file_name => 'interesting.html',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 5,
+ file_name: 'interesting.html',
+ skip_cache: 1
}
expect(response.body).to match('dull')
end
@@ -127,11 +127,11 @@ def show(params = {})
info_request = FactoryBot.create(:info_request_with_html_attachment)
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'http://trying.to.hack',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'http://trying.to.hack',
+ skip_cache: 1
}
expect(response.status).to eq(303)
end
@@ -140,11 +140,11 @@ def show(params = {})
info_request = FactoryBot.create(:info_request_with_html_attachment)
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.html',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.html',
+ skip_cache: 1
}
# Nokogiri adds the meta tag; see
@@ -165,17 +165,17 @@ def show(params = {})
it "censors attachments downloaded directly" do
info_request = FactoryBot.create(:info_request_with_html_attachment)
- info_request.censor_rules.create!(:text => 'dull',
- :replacement => "Mouse",
- :last_edit_editor => 'unknown',
- :last_edit_comment => 'none')
+ info_request.censor_rules.create!(text: 'dull',
+ replacement: "Mouse",
+ last_edit_editor: 'unknown',
+ last_edit_comment: 'none')
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.html',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.html',
+ skip_cache: 1
}
expect(response.media_type).to eq('text/html')
expect(response.body).to have_content "Mouse"
@@ -183,17 +183,17 @@ def show(params = {})
it "should censor with rules on the user (rather than the request)" do
info_request = FactoryBot.create(:info_request_with_html_attachment)
- info_request.user.censor_rules.create!(:text => 'dull',
- :replacement => "Mouse",
- :last_edit_editor => 'unknown',
- :last_edit_comment => 'none')
+ info_request.user.censor_rules.create!(text: 'dull',
+ replacement: "Mouse",
+ last_edit_editor: 'unknown',
+ last_edit_comment: 'none')
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.html',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.html',
+ skip_cache: 1
}
expect(response.media_type).to eq('text/html')
expect(response.body).to have_content "Mouse"
@@ -204,11 +204,11 @@ def show(params = {})
expect {
get :show,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.pdf',
- :skip_cache => 1
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.pdf',
+ skip_cache: 1
}
}.to raise_error ActiveRecord::RecordNotFound
end
@@ -271,11 +271,10 @@ def show(params = {})
let(:info_request) { FactoryBot.create(:info_request_with_incoming_attachments) }
def get_html_attachment(params = {})
- default_params = { :incoming_message_id =>
- info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.pdf.html' }
+ default_params = { incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.pdf.html' }
get :show_as_html, params: default_params.merge(params)
end
@@ -299,14 +298,14 @@ def get_html_attachment(params = {})
it "should return 404 for ugly URLs containing a request id that isn't an integer" do
ugly_id = "55195"
- expect { get_html_attachment(:id => ugly_id) }
+ expect { get_html_attachment(id: ugly_id) }
.to raise_error(ActiveRecord::RecordNotFound)
end
it "should return 404 for ugly URLs contain a request id that isn't an
integer, even if the integer prefix refers to an actual request" do
ugly_id = "#{FactoryBot.create(:info_request).id}95"
- expect { get_html_attachment(:id => ugly_id) }
+ expect { get_html_attachment(id: ugly_id) }
.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -315,10 +314,10 @@ def get_html_attachment(params = {})
expect {
get :show_as_html,
params: {
- :incoming_message_id => info_request.incoming_messages.first.id,
- :id => info_request.id,
- :part => 2,
- :file_name => 'interesting.pdf.html'
+ incoming_message_id: info_request.incoming_messages.first.id,
+ id: info_request.id,
+ part: 2,
+ file_name: 'interesting.pdf.html'
}
}.to raise_error ActiveRecord::RecordNotFound
end
diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb
index 4ba7b71b8b..c61a5335d9 100644
--- a/spec/controllers/comment_controller_spec.rb
+++ b/spec/controllers/comment_controller_spec.rb
@@ -14,11 +14,11 @@
it 'returns a 404 when the info request is embargoed' do
expect {
post :new, params: {
- :url_title => embargoed_request.url_title,
- :comment => { :body => "Some content" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 1
+ url_title: embargoed_request.url_title,
+ comment: { body: "Some content" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 1
}
}.to raise_error ActiveRecord::RecordNotFound
end
@@ -32,11 +32,11 @@
it 'returns a 404 when the info request is embargoed' do
expect {
post :new, params: {
- :url_title => embargoed_request.url_title,
- :comment => { :body => "Some content" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 1
+ url_title: embargoed_request.url_title,
+ comment: { body: "Some content" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 1
}
}.to raise_error ActiveRecord::RecordNotFound
end
@@ -49,11 +49,11 @@
it 'allows them to comment' do
post :new, params: {
- :url_title => embargoed_request.url_title,
- :comment => { :body => "Some content" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 1
+ url_title: embargoed_request.url_title,
+ comment: { body: "Some content" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 1
}
expect(response).to be_successful
end
@@ -63,11 +63,11 @@
it "should give an error and render 'new' template when body text is just some whitespace" do
post :new,
params: {
- :url_title => info_requests(:naughty_chicken_request).url_title,
- :comment => { :body => " " },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 1
+ url_title: info_requests(:naughty_chicken_request).url_title,
+ comment: { body: " " },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 1
}
expect(assigns[:comment].errors[:body]).not_to be_nil
expect(response).to render_template('new')
@@ -76,27 +76,26 @@
it "should show preview when input is good" do
post :new,
params: {
- :url_title => info_requests(:naughty_chicken_request).url_title,
- :comment => {
- :body =>
- "A good question, but why not also ask about nice chickens?"
- }, :type => 'request',
- :submitted_comment => 1,
- :preview => 1
+ url_title: info_requests(:naughty_chicken_request).url_title,
+ comment: {
+ body: "A good question, but why not also ask about nice chickens?"
+ }, type: 'request',
+ submitted_comment: 1,
+ preview: 1
}
expect(response).to render_template('preview')
end
it "should redirect to sign in page when input is good and nobody is logged in" do
- params = { :url_title => info_requests(:naughty_chicken_request).url_title,
- :comment => { :body => "A good question, but why not also ask about nice chickens?" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ params = { url_title: info_requests(:naughty_chicken_request).url_title,
+ comment: { body: "A good question, but why not also ask about nice chickens?" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
post :new, params: params
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
# post_redirect.post_params.should == params # TODO: get this working. there's a : vs '' problem amongst others
end
@@ -105,24 +104,23 @@
post :new,
params: {
- :url_title => info_requests(:naughty_chicken_request).url_title,
- :comment => {
- :body =>
- "A good question, but why not also ask about nice chickens?"
+ url_title: info_requests(:naughty_chicken_request).url_title,
+ comment: {
+ body: "A good question, but why not also ask about nice chickens?"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
- comment_array = Comment.where(:body => "A good question, but why not " \
+ comment_array = Comment.where(body: "A good question, but why not " \
"also ask about nice chickens?")
expect(comment_array.size).to eq(1)
comment = comment_array[0]
expect(ActionMailer::Base.deliveries.size).to eq(0)
- expect(response).to redirect_to(:controller => 'request', :action => 'show', :url_title => info_requests(:naughty_chicken_request).url_title)
+ expect(response).to redirect_to(controller: 'request', action: 'show', url_title: info_requests(:naughty_chicken_request).url_title)
end
it 'errors if the same comment is submitted twice' do
@@ -147,11 +145,11 @@
info_request = info_requests(:spam_1_request)
post :new, params: {
- :url_title => info_request.url_title,
- :comment => { :body => "I demand to be heard!" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ url_title: info_request.url_title,
+ comment: { body: "I demand to be heard!" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(response).to redirect_to(show_request_path(info_request.url_title))
@@ -164,11 +162,11 @@
info_request = info_requests(:fancy_dog_request)
post :new, params: {
- :url_title => info_request.url_title,
- :comment => { :body => "I demand to be heard!" },
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ url_title: info_request.url_title,
+ comment: { body: "I demand to be heard!" },
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(response).to redirect_to(show_request_path(info_request.url_title))
@@ -179,11 +177,11 @@
expected = "Updated text"
post :new,
params: {
- :url_title => info_requests(:naughty_chicken_request).url_title,
- :comment => { :body => expected },
- :type => 'request',
- :submitted_comment => 1,
- :reedit => 1
+ url_title: info_requests(:naughty_chicken_request).url_title,
+ comment: { body: expected },
+ type: 'request',
+ submitted_comment: 1,
+ reedit: 1
}
expect(assigns[:comment].body).to eq(expected)
expect(response).to render_template('new')
@@ -221,9 +219,9 @@
describe 'when handling a comment that looks like spam' do
let(:user) { FactoryBot.create(:user,
- :locale => 'en',
- :name => 'bob',
- :confirmed_not_spam => false) }
+ locale: 'en',
+ name: 'bob',
+ confirmed_not_spam: false) }
let(:body) { FactoryBot.create(:public_body) }
let(:request) { FactoryBot.create(:info_request) }
@@ -237,13 +235,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/spam annotation from user #{ user.id }/)
@@ -253,13 +251,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(flash[:error])
.to eq("Sorry, we're currently unable to add your annotation. Please try again later.")
@@ -269,13 +267,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(response).to render_template('new')
end
@@ -286,13 +284,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(response).to redirect_to show_request_path(request.url_title)
end
@@ -309,13 +307,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/spam annotation from user #{ user.id }/)
@@ -325,13 +323,13 @@
sign_in user
post :new,
params: {
- :url_title => request.url_title,
- :comment => {
- :body => "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
+ url_title: request.url_title,
+ comment: {
+ body: "[HD] Watch Jason Bourne Online free MOVIE Full-HD"
},
- :type => 'request',
- :submitted_comment => 1,
- :preview => 0
+ type: 'request',
+ submitted_comment: 1,
+ preview: 0
}
expect(response).to redirect_to show_request_path(request.url_title)
end
@@ -351,8 +349,8 @@
end
it 'should be successful' do
- get :new, params: { :url_title => @external_request.url_title,
- :type => 'request' }
+ get :new, params: { url_title: @external_request.url_title,
+ type: 'request' }
expect(response).to be_successful
end
@@ -369,8 +367,8 @@
it "sets @in_pro_area" do
sign_in pro_user
with_feature_enabled(:alaveteli_pro) do
- get :new, params: { :url_title => embargoed_request.url_title,
- :type => 'request' }
+ get :new, params: { url_title: embargoed_request.url_title,
+ type: 'request' }
expect(assigns[:in_pro_area]).to eq true
end
end
diff --git a/spec/controllers/concerns/translatable_params_spec.rb b/spec/controllers/concerns/translatable_params_spec.rb
index 1646e37251..d93dfcea44 100644
--- a/spec/controllers/concerns/translatable_params_spec.rb
+++ b/spec/controllers/concerns/translatable_params_spec.rb
@@ -5,24 +5,20 @@
describe '#translatable_params' do
- let(:keys) { { :translated_keys => [ :name, :locale ],
- :general_keys => [ :status ] } }
+ let(:keys) { { translated_keys: [ :name, :locale ],
+ general_keys: [ :status ] } }
it 'whitelists translatable_params' do
- params = { :name => 'Some name',
- :status => 'good',
- :id => 40,
- :translations_attributes =>
- { :en =>
- { :locale => 'en',
- :name => 'Other name',
- :bad => "value" } } }
- expected = { :name => 'Some name',
- :status => 'good',
- :translations_attributes =>
- { :en =>
- { :locale => 'en',
- :name => 'Other name' } } }
+ params = { name: 'Some name',
+ status: 'good',
+ id: 40,
+ translations_attributes: { en: { locale: 'en',
+ name: 'Other name',
+ bad: "value" } } }
+ expected = { name: 'Some name',
+ status: 'good',
+ translations_attributes: { en: { locale: 'en',
+ name: 'Other name' } } }
params = ActionController::Parameters.new(params)
expect(translatable_params(params, **keys)).
@@ -45,15 +41,15 @@
describe '#whitelist' do
- let(:keys) { { :translated_keys => [ :name, :locale ],
- :general_keys => [ :status ] } }
+ let(:keys) { { translated_keys: [ :name, :locale ],
+ general_keys: [ :status ] } }
it 'removes a non-whitelisted model param' do
- params = { :name => 'Some name',
- :status => 'good',
- :id => 40 }
- expected = { :name => 'Some name',
- :status => 'good' }
+ params = { name: 'Some name',
+ status: 'good',
+ id: 40 }
+ expected = { name: 'Some name',
+ status: 'good' }
params = ActionController::Parameters.new(params)
expect(
@@ -62,11 +58,9 @@
end
it 'allows id in the translation params' do
- params = { :translations_attributes =>
- { :en =>
- { :id => 40,
- :locale => 'en',
- :name => 'Other name' } } }
+ params = { translations_attributes: { en: { id: 40,
+ locale: 'en',
+ name: 'Other name' } } }
expected = ActionController::Parameters.new(params).permit!
params = params = ActionController::Parameters.new(params)
@@ -76,15 +70,11 @@
end
it 'removes a non-whitelisted translation param' do
- params = { :translations_attributes =>
- { :en =>
- { :locale => 'en',
- :name => 'Other name',
- :bad => "value" } } }
- expected = { :translations_attributes =>
- { :en =>
- { :locale => 'en',
- :name => 'Other name' } } }
+ params = { translations_attributes: { en: { locale: 'en',
+ name: 'Other name',
+ bad: "value" } } }
+ expected = { translations_attributes: { en: { locale: 'en',
+ name: 'Other name' } } }
params = ActionController::Parameters.new(params)
expect(
diff --git a/spec/controllers/followups_controller_spec.rb b/spec/controllers/followups_controller_spec.rb
index 9b1521c450..d29168a41d 100644
--- a/spec/controllers/followups_controller_spec.rb
+++ b/spec/controllers/followups_controller_spec.rb
@@ -4,7 +4,7 @@
render_views
let(:request_user) { FactoryBot.create(:user) }
- let(:request) { FactoryBot.create(:info_request_with_incoming, :user => request_user) }
+ let(:request) { FactoryBot.create(:info_request_with_incoming, user: request_user) }
let(:message_id) { request.incoming_messages[0].id }
let(:pro_user) { FactoryBot.create(:pro_user) }
@@ -14,7 +14,7 @@
it 'raises an ActiveRecord::RecordNotFound error for an embargoed request' do
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- get :new, params: { :request_id => embargoed_request.id }
+ get :new, params: { request_id: embargoed_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -27,7 +27,7 @@
it 'finds their own embargoed requests' do
embargoed_request = FactoryBot.create(:embargoed_request,
user: pro_user)
- get :new, params: { :request_id => embargoed_request.id }
+ get :new, params: { request_id: embargoed_request.id }
expect(response).to be_successful
end
@@ -42,7 +42,7 @@
it 'raises an ActiveRecord::RecordNotFound error for other embargoed requests' do
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- get :new, params: { :request_id => embargoed_request.id }
+ get :new, params: { request_id: embargoed_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -50,8 +50,8 @@
it "displays 'wrong user' message when not logged in as the request owner" do
sign_in FactoryBot.create(:user)
get :new, params: {
- :request_id => request.id,
- :incoming_message_id => message_id
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).to render_template('user/wrong_user')
end
@@ -59,27 +59,27 @@
it "does not allow follow ups to external requests" do
sign_in FactoryBot.create(:user)
external_request = FactoryBot.create(:external_request)
- get :new, params: { :request_id => external_request.id }
+ get :new, params: { request_id: external_request.id }
expect(response).to render_template('followup_bad')
expect(assigns[:reason]).to eq('external')
end
it "redirects to the signin page if not logged in" do
- get :new, params: { :request_id => request.id }
+ get :new, params: { request_id: request.id }
expect(response).
- to redirect_to(signin_url(:token => get_last_post_redirect.token))
+ to redirect_to(signin_url(token: get_last_post_redirect.token))
end
it "calls the message a followup if there is an incoming message" do
expected_reason = "To send a follow up message to #{request.public_body.name}"
- get :new, params: { :request_id => request.id,
- :incoming_message_id => message_id }
+ get :new, params: { request_id: request.id,
+ incoming_message_id: message_id }
expect(get_last_post_redirect.reason_params[:web]).to eq(expected_reason)
end
it "calls the message a reply if there is no incoming message" do
expected_reason = "To reply to #{request.public_body.name}."
- get :new, params: { :request_id => request.id }
+ get :new, params: { request_id: request.id }
expect(get_last_post_redirect.reason_params[:web]).to eq(expected_reason)
end
@@ -90,13 +90,13 @@
end
it "shows the followup form" do
- get :new, params: { :request_id => request.id }
+ get :new, params: { request_id: request.id }
expect(response).to render_template('new')
end
it "shows the followup form when replying to an incoming message" do
- get :new, params: { :request_id => request.id,
- :incoming_message_id => message_id }
+ get :new, params: { request_id: request.id,
+ incoming_message_id: message_id }
expect(response).to render_template('new')
end
@@ -112,20 +112,20 @@
end
it "offers the opportunity to reply to the main address" do
- get :new, params: { :request_id => request.id,
- :incoming_message_id => message_id }
+ get :new, params: { request_id: request.id,
+ incoming_message_id: message_id }
expect(response.body).
to have_css("div#other_recipients ul li",
- :text => "the main FOI contact address for")
+ text: "the main FOI contact address for")
end
it "offers an opportunity to reply to another address" do
get :new, params: {
- :request_id => request.id,
- :incoming_message_id => message_id
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response.body).
- to have_css("div#other_recipients ul li", :text => "Frob")
+ to have_css("div#other_recipients ul li", text: "Frob")
end
end
@@ -133,12 +133,12 @@
context "the request is hidden" do
let(:hidden_request) do
- FactoryBot.create(:info_request_with_incoming, :user => request_user,
- :prominence => "hidden")
+ FactoryBot.create(:info_request_with_incoming, user: request_user,
+ prominence: "hidden")
end
it "does not show the form, even to the request owner" do
- get :new, params: { :request_id => hidden_request.id }
+ get :new, params: { request_id: hidden_request.id }
expect(response).to render_template('request/hidden')
end
@@ -146,9 +146,9 @@
incoming_message_id = hidden_request.incoming_messages[0].id
expect do
get :new, params: {
- :request_id => hidden_request.id,
- :incoming_message_id => incoming_message_id,
- :format => 'json'
+ request_id: hidden_request.id,
+ incoming_message_id: incoming_message_id,
+ format: 'json'
}
end.to raise_error ActionController::UnknownFormat
end
@@ -162,7 +162,7 @@
it "does not allow follow ups to external requests" do
sign_in FactoryBot.create(:user)
external_request = FactoryBot.create(:external_request)
- get :new, params: { :request_id => external_request.id }
+ get :new, params: { request_id: external_request.id }
expect(response).to render_template('followup_bad')
expect(assigns[:reason]).to eq('external')
end
@@ -170,7 +170,7 @@
it 'the response code should be successful' do
sign_in FactoryBot.create(:user)
get :new, params: {
- :request_id => FactoryBot.create(:external_request).id
+ request_id: FactoryBot.create(:external_request).id
}
expect(response).to be_successful
end
@@ -186,7 +186,7 @@
it "sets @in_pro_area" do
sign_in pro_user
with_feature_enabled(:alaveteli_pro) do
- get :new, params: { :request_id => embargoed_request.id }
+ get :new, params: { request_id: embargoed_request.id }
expect(assigns[:in_pro_area]).to eq true
end
end
@@ -221,8 +221,8 @@
describe "POST #preview" do
let(:dummy_message) do
- { :body => "What a useless response! You suck.",
- :what_doing => 'normal_sort' }
+ { body: "What a useless response! You suck.",
+ what_doing: 'normal_sort' }
end
context "when not logged in" do
@@ -230,20 +230,20 @@
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "redirects to the signin page" do
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).
- to redirect_to(signin_url(:token => get_last_post_redirect.token))
+ to redirect_to(signin_url(token: get_last_post_redirect.token))
end
end
@@ -256,8 +256,8 @@
embargoed_request = FactoryBot.create(:embargoed_request,
user: pro_user)
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
expect(response).to be_successful
end
@@ -266,8 +266,8 @@
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -276,9 +276,9 @@
it "displays a wrong user message when not logged in as the request owner" do
sign_in FactoryBot.create(:user)
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).to render_template('user/wrong_user')
end
@@ -291,12 +291,12 @@
it "displays the edit form with an error when the message body is blank" do
post :preview, params: {
- :request_id => request.id,
- :outgoing_message => {
- :body => "",
- :what_doing => "normal_sort"
+ request_id: request.id,
+ outgoing_message: {
+ body: "",
+ what_doing: "normal_sort"
},
- :incoming_message_id => message_id
+ incoming_message_id: message_id
}
expect(response).to render_template("new")
@@ -305,20 +305,20 @@
it "shows a preview when input is good" do
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id,
- :preview => 1
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id,
+ preview: 1
}
expect(response).to render_template('preview')
end
it "allows re-editing of a preview" do
post :preview, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id,
- :reedit => "Re-edit this request"
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id,
+ reedit: "Re-edit this request"
}
expect(response).to render_template('new')
end
@@ -334,7 +334,7 @@
it "sets @in_pro_area" do
sign_in pro_user
with_feature_enabled(:alaveteli_pro) do
- get :new, params: { :request_id => embargoed_request.id }
+ get :new, params: { request_id: embargoed_request.id }
expect(assigns[:in_pro_area]).to eq true
end
end
@@ -345,8 +345,8 @@
describe "POST #create" do
let(:dummy_message) do
- { :body => "What a useless response! You suck.",
- :what_doing => 'normal_sort' }
+ { body: "What a useless response! You suck.",
+ what_doing: 'normal_sort' }
end
before(:each) do
@@ -382,20 +382,20 @@
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "redirects to the signin page" do
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).
- to redirect_to(signin_url(:token => get_last_post_redirect.token))
+ to redirect_to(signin_url(token: get_last_post_redirect.token))
end
end
@@ -407,10 +407,10 @@
it 'finds their own embargoed requests' do
embargoed_request = FactoryBot.create(:embargoed_request,
user: pro_user)
- expected_url = show_request_url(:url_title => embargoed_request.url_title)
+ expected_url = show_request_url(url_title: embargoed_request.url_title)
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
expect(response).to redirect_to(expected_url)
end
@@ -419,8 +419,8 @@
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => embargoed_request.id
+ outgoing_message: dummy_message,
+ request_id: embargoed_request.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -429,18 +429,18 @@
it "only allows the request owner to make a followup" do
sign_in FactoryBot.create(:user)
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).to render_template('user/wrong_user')
end
it "gives an error and renders 'show_response' when a body isn't given" do
post :create, params: {
- :outgoing_message => dummy_message.merge(:body => ''),
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message.merge(body: ''),
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(assigns[:outgoing_message].errors[:body]).
@@ -468,9 +468,9 @@ def send_request
it "updates the status for successful followup sends" do
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(request.reload.described_state).to eq('waiting_response')
@@ -504,9 +504,9 @@ def send_request
request.set_described_state('waiting_clarification')
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(request.reload.get_last_public_response_event.calculated_state).
@@ -515,34 +515,34 @@ def send_request
it "redirects to the request page" do
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(response).
- to redirect_to(show_request_url(:url_title => request.url_title))
+ to redirect_to(show_request_url(url_title: request.url_title))
end
it "displays the a confirmation once the message has been sent" do
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
expect(flash[:notice]).to eq('Your follow up message has been sent on its way.')
end
it "displays an error if the request has been closed to new responses" do
closed_request = FactoryBot.create(:info_request_with_incoming,
- :user => request_user,
- :allow_new_responses_from => "nobody")
+ user: request_user,
+ allow_new_responses_from: "nobody")
post :create,
params: {
- :outgoing_message => dummy_message,
- :request_id => closed_request.id,
- :incoming_message_id => closed_request.incoming_messages[0].id
+ outgoing_message: dummy_message,
+ request_id: closed_request.id,
+ incoming_message_id: closed_request.incoming_messages[0].id
}
deliveries = ActionMailer::Base.deliveries
expect(deliveries.size).to eq(0)
@@ -560,15 +560,15 @@ def send_request
before(:each) do
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
post :create, params: {
- :outgoing_message => dummy_message,
- :request_id => request.id,
- :incoming_message_id => message_id
+ outgoing_message: dummy_message,
+ request_id: request.id,
+ incoming_message_id: message_id
}
end
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index b057c6e1de..b5544fec0b 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -91,16 +91,16 @@
render_views
before do
- public_body = mock_model(PublicBody, :name => "Example Public Body",
- :url_name => 'example_public_body')
- info_request = mock_model(InfoRequest, :public_body => public_body,
- :title => 'Example Request',
- :url_title => 'example_request')
- info_request_event = mock_model(InfoRequestEvent, :created_at => Time.zone.now,
- :info_request => info_request,
- :described_at => Time.zone.now,
- :search_text_main => 'example text')
- xapian_result = double('xapian result', :results => [{:model => info_request_event}])
+ public_body = mock_model(PublicBody, name: "Example Public Body",
+ url_name: 'example_public_body')
+ info_request = mock_model(InfoRequest, public_body: public_body,
+ title: 'Example Request',
+ url_title: 'example_request')
+ info_request_event = mock_model(InfoRequestEvent, created_at: Time.zone.now,
+ info_request: info_request,
+ described_at: Time.zone.now,
+ search_text_main: 'example text')
+ xapian_result = double('xapian result', results: [{model: info_request_event}])
allow(controller).to receive(:perform_search).and_return(xapian_result)
end
@@ -159,7 +159,7 @@
describe 'when using locales' do
it "should use our test PO files rather than the application one" do
- get :frontpage, params: { :locale => 'es' }
+ get :frontpage, params: { locale: 'es' }
expect(response.body).to match /XOXO/
end
@@ -193,7 +193,7 @@
it "should render the front page successfully with post_redirect if post_params is not set" do
session[:post_redirect_token] = 'orphaned_token'
- get :frontpage, params: { :post_redirect => 1 }
+ get :frontpage, params: { post_redirect: 1 }
expect(response).to be_successful
end
@@ -226,12 +226,12 @@
end
it "should redirect from search query URL to pretty URL" do
- post :search_redirect, params: { :query => "mouse" } # query hidden in POST parameters
- expect(response).to redirect_to(:action => 'search', :combined => "mouse", :view => "all") # URL /search/:query/all
+ post :search_redirect, params: { query: "mouse" } # query hidden in POST parameters
+ expect(response).to redirect_to(action: 'search', combined: "mouse", view: "all") # URL /search/:query/all
end
it "should find info request when searching for '\"fancy dog\"'" do
- get :search, params: { :combined => '"fancy dog"' }
+ get :search, params: { combined: '"fancy dog"' }
expect(response).to render_template('search')
expect(assigns[:xapian_requests].matches_estimated).to eq(1)
expect(assigns[:xapian_requests].results.size).to eq(1)
@@ -241,7 +241,7 @@
end
it "should find public body and incoming message when searching for 'geraldine quango'" do
- get :search, params: { :combined => 'geraldine quango' }
+ get :search, params: { combined: 'geraldine quango' }
expect(response).to render_template('search')
expect(assigns[:xapian_requests].matches_estimated).to eq(1)
@@ -254,7 +254,7 @@
end
it "should filter results based on end of URL being 'all'" do
- get :search, params: { :combined => "bob/all" }
+ get :search, params: { combined: "bob/all" }
expect(assigns[:xapian_requests].results.map { |x| x[:model] }).to match_array([
info_request_events(:useless_outgoing_message_event),
info_request_events(:silly_outgoing_message_event),
@@ -266,25 +266,25 @@
end
it "should filter results based on end of URL being 'users'" do
- get :search, params: { :combined => "bob/users" }
+ get :search, params: { combined: "bob/users" }
expect(assigns[:xapian_requests]).to eq(nil)
expect(assigns[:xapian_users].results.map { |x| x[:model] }).to eq([users(:bob_smith_user)])
expect(assigns[:xapian_bodies]).to eq(nil)
end
it 'should highlight words for a user-only request' do
- get :search, params: { :combined => "bob/users" }
+ get :search, params: { combined: "bob/users" }
expect(assigns[:highlight_words]).to eq([/\b(bob)\w*\b/iu, /\b(bob)\b/iu])
end
it 'should show spelling corrections for a user-only request' do
- get :search, params: { :combined => "rob/users" }
+ get :search, params: { combined: "rob/users" }
expect(assigns[:spelling_correction]).to eq('bob')
expect(response.body).to include('did_you_mean')
end
it "should filter results based on end of URL being 'requests'" do
- get :search, params: { :combined => "bob/requests" }
+ get :search, params: { combined: "bob/requests" }
expect(assigns[:xapian_requests].results.map { |x|x[:model] }).to match_array([
info_request_events(:useless_outgoing_message_event),
info_request_events(:silly_outgoing_message_event),
@@ -296,7 +296,7 @@
end
it "should filter results based on end of URL being 'bodies'" do
- get :search, params: { :combined => "quango/bodies" }
+ get :search, params: { combined: "quango/bodies" }
expect(assigns[:xapian_requests]).to eq(nil)
expect(assigns[:xapian_users]).to eq(nil)
expect(assigns[:xapian_bodies].results.map { |x|x[:model] }).to eq([public_bodies(:geraldine_public_body)])
@@ -323,19 +323,19 @@
end
it 'should show "Browse all" link if there are no results for a search restricted to bodies' do
- get :search, params: { :combined => "noresultsshouldbefound/bodies" }
+ get :search, params: { combined: "noresultsshouldbefound/bodies" }
expect(response.body).to include('Browse all')
end
it "should show help when searching for nothing" do
- get :search_redirect, params: { :query => nil }
+ get :search_redirect, params: { query: nil }
expect(response).to render_template('search')
expect(assigns[:total_hits]).to be_nil
expect(assigns[:query]).to be_nil
end
it "should not show unconfirmed users" do
- get :search, params: { :combined => "unconfirmed/users" }
+ get :search, params: { combined: "unconfirmed/users" }
expect(response).to render_template('search')
expect(assigns[:xapian_users].results.map { |x|x[:model] }).to eq([])
end
@@ -346,41 +346,41 @@
u.save!
update_xapian_index
- get :search, params: { :combined => "unconfirmed/users" }
+ get :search, params: { combined: "unconfirmed/users" }
expect(response).to render_template('search')
expect(assigns[:xapian_users].results.map { |x|x[:model] }).to eq([u])
end
it "should show tracking links for requests-only searches" do
- get :search, params: { :combined => "bob/requests" }
+ get :search, params: { combined: "bob/requests" }
expect(response.body).to include('Track this search')
end
it 'should not show high page offsets as these are extremely slow to generate' do
expect {
- get :search, params: { :combined => 'bob/all', :page => 25 }
+ get :search, params: { combined: 'bob/all', page: 25 }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'should pass xapian error messages to flash and redirect to a blank search page' do
error_text = "Your query was not quite right. QueryParserError: Syntax: AND "
- get :search, params: { :combined => "test AND" }
+ get :search, params: { combined: "test AND" }
expect(flash[:error]).to eq(error_text)
- expect(response).to redirect_to(:action => 'search', :combined => "")
+ expect(response).to redirect_to(action: 'search', combined: "")
end
context "when passed a non-HTML request" do
it "raises unknown format error" do
expect do
- get :search, params: { :combined => '"fancy dog"', :format => :json }
+ get :search, params: { combined: '"fancy dog"', format: :json }
end.to raise_error ActionController::UnknownFormat
end
it "does not call the search" do
expect(controller).not_to receive(:perform_search)
begin
- get :search, params: { :combined => '"fancy dog"', :format => :json }
+ get :search, params: { combined: '"fancy dog"', format: :json }
rescue ActionController::UnknownFormat
# noop
end
diff --git a/spec/controllers/health_checks_controller_spec.rb b/spec/controllers/health_checks_controller_spec.rb
index b5f6aad67a..96a2aca8e0 100644
--- a/spec/controllers/health_checks_controller_spec.rb
+++ b/spec/controllers/health_checks_controller_spec.rb
@@ -5,20 +5,20 @@
describe 'GET index' do
it 'returns a 200 if all health checks pass' do
- allow(HealthChecks).to receive_messages(:ok? => true)
+ allow(HealthChecks).to receive_messages(ok?: true)
get :index
expect(response.status).to eq(200)
end
it 'returns a 500 if the health check fails' do
- allow(HealthChecks).to receive_messages(:ok? => false)
+ allow(HealthChecks).to receive_messages(ok?: false)
get :index
expect(response.status).to eq(500)
end
it 'does not render a layout' do
get :index
- expect(response).to render_template(:layout => false)
+ expect(response).to render_template(layout: false)
end
end
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index c816fa13b4..18810286c3 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -28,14 +28,14 @@
context 'when a url_title param is supplied' do
it 'assigns the info_request' do
- get :unhappy, params: { :url_title => info_request.url_title }
+ get :unhappy, params: { url_title: info_request.url_title }
expect(assigns[:info_request]).to eq info_request
end
it 'raises an ActiveRecord::RecordNotFound error if the InfoRequest
is not found' do
expect {
- get :unhappy, params: { :url_title => 'something_not_existing' }
+ get :unhappy, params: { url_title: 'something_not_existing' }
}.to raise_error ActiveRecord::RecordNotFound
end
@@ -43,7 +43,7 @@
is embargoed' do
info_request = FactoryBot.create(:embargoed_request)
expect {
- get :unhappy, params: { :url_title => info_request.url_title }
+ get :unhappy, params: { url_title: info_request.url_title }
}.to raise_error ActiveRecord::RecordNotFound
end
end
@@ -77,7 +77,7 @@
end
it 'should render the locale-specific template if available' do
- get :contact, params: { :locale => 'es' }
+ get :contact, params: { locale: 'es' }
expect(response.body).to match('contáctenos theme one')
end
@@ -136,14 +136,14 @@
it 'sends a contact message' do
post :contact, params: {
- :contact => {
- :name => 'Vinny Vanilli',
- :email => 'vinny@localhost',
- :subject => 'Why do I have such an ace name?',
- :comment => '',
- :message => "You really should know!!!\n\nVinny"
+ contact: {
+ name: 'Vinny Vanilli',
+ email: 'vinny@localhost',
+ subject: 'Why do I have such an ace name?',
+ comment: '',
+ message: "You really should know!!!\n\nVinny"
},
- :submitted_contact_form => 1
+ submitted_contact_form: 1
}
expect(response).to redirect_to(frontpage_path)
@@ -183,14 +183,14 @@
it 'has rudimentary spam protection' do
post :contact, params: {
- :contact => {
- :name => 'Vinny Vanilli',
- :email => 'vinny@localhost',
- :subject => 'Why do I have such an ace name?',
- :comment => 'I AM A SPAMBOT',
- :message => "You really should know!!!\n\nVinny"
+ contact: {
+ name: 'Vinny Vanilli',
+ email: 'vinny@localhost',
+ subject: 'Why do I have such an ace name?',
+ comment: 'I AM A SPAMBOT',
+ message: "You really should know!!!\n\nVinny"
},
- :submitted_contact_form => 1
+ submitted_contact_form: 1
}
expect(response).to redirect_to(frontpage_path)
@@ -208,13 +208,13 @@
it 'does not accept a form without a comment param' do
post :contact, params: {
- :contact => {
- :name => 'Vinny Vanilli',
- :email => 'vinny@localhost',
- :subject => 'Why do I have such an ace name?',
- :message => "You really should know!!!\n\nVinny"
+ contact: {
+ name: 'Vinny Vanilli',
+ email: 'vinny@localhost',
+ subject: 'Why do I have such an ace name?',
+ message: "You really should know!!!\n\nVinny"
},
- :submitted_contact_form => 1
+ submitted_contact_form: 1
}
expect(response).to redirect_to(frontpage_path)
end
diff --git a/spec/controllers/info_request_batch_controller_spec.rb b/spec/controllers/info_request_batch_controller_spec.rb
index 8533279e9c..97c73563da 100644
--- a/spec/controllers/info_request_batch_controller_spec.rb
+++ b/spec/controllers/info_request_batch_controller_spec.rb
@@ -6,11 +6,11 @@
let(:second_public_body) { FactoryBot.create(:public_body) }
let(:bodies) { [first_public_body, second_public_body] }
let!(:info_request_batch) do
- FactoryBot.create(:info_request_batch, :title => 'Matched title',
- :body => 'Matched body',
- :public_bodies => bodies)
+ FactoryBot.create(:info_request_batch, title: 'Matched title',
+ body: 'Matched body',
+ public_bodies: bodies)
end
- let(:params) { {:id => info_request_batch.id} }
+ let(:params) { {id: info_request_batch.id} }
let(:action) { get :show, params: params }
let(:pro_user) { FactoryBot.create(:pro_user) }
@@ -34,18 +34,18 @@
describe 'assigning @info_requests' do
context 'when the batch has been sent' do
let!(:first_request) do
- FactoryBot.create(:info_request, :info_request_batch => info_request_batch,
- :public_body => first_public_body)
+ FactoryBot.create(:info_request, info_request_batch: info_request_batch,
+ public_body: first_public_body)
end
let!(:second_request) do
- FactoryBot.create(:info_request, :info_request_batch => info_request_batch,
- :public_body => second_public_body)
+ FactoryBot.create(:info_request, info_request_batch: info_request_batch,
+ public_body: second_public_body)
end
let!(:hidden_request) do
- FactoryBot.create(:hidden_request, :info_request_batch => info_request_batch)
+ FactoryBot.create(:hidden_request, info_request_batch: info_request_batch)
end
let!(:backpage_request) do
- FactoryBot.create(:backpage_request, :info_request_batch => info_request_batch)
+ FactoryBot.create(:backpage_request, info_request_batch: info_request_batch)
end
before do
diff --git a/spec/controllers/one_time_passwords_controller_spec.rb b/spec/controllers/one_time_passwords_controller_spec.rb
index c9e5fa7a9d..84a98025c1 100644
--- a/spec/controllers/one_time_passwords_controller_spec.rb
+++ b/spec/controllers/one_time_passwords_controller_spec.rb
@@ -13,7 +13,7 @@
get :show
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
it 'assigns the signed in user' do
@@ -53,7 +53,7 @@
it 'redirects to the sign-in page without a signed in user' do
post :create
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
it 'assigns the signed in user' do
@@ -129,7 +129,7 @@
it 'redirects to the sign-in page without a signed in user' do
put :update
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
it 'assigns the signed in user' do
@@ -140,7 +140,7 @@
end
it 'regenerates the otp_code' do
- user = FactoryBot.create(:user, :otp_enabled => true)
+ user = FactoryBot.create(:user, otp_enabled: true)
expected = ROTP::HOTP.new(user.otp_secret_key).at(2)
sign_in user
put :update
@@ -148,21 +148,21 @@
end
it 'sets a successful notification message' do
- user = FactoryBot.create(:user, :otp_enabled => true)
+ user = FactoryBot.create(:user, otp_enabled: true)
sign_in user
put :update
expect(flash[:notice]).to eq('Two factor one time passcode updated')
end
it 'redirects back to #show on success' do
- user = FactoryBot.create(:user, :otp_enabled => true)
+ user = FactoryBot.create(:user, otp_enabled: true)
sign_in user
put :update
expect(response).to redirect_to(one_time_password_path)
end
it 'renders #show on failure' do
- user = FactoryBot.create(:user, :otp_enabled => true)
+ user = FactoryBot.create(:user, otp_enabled: true)
allow_any_instance_of(User).
to receive(:increment!).and_return(false)
sign_in user
@@ -171,7 +171,7 @@
end
it 'warns the user on failure' do
- user = FactoryBot.create(:user, :otp_enabled => true)
+ user = FactoryBot.create(:user, otp_enabled: true)
allow_any_instance_of(User).
to receive(:increment!).and_return(false)
sign_in user
@@ -200,7 +200,7 @@
user = FactoryBot.create(:user)
delete :destroy
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
it 'assigns the signed in user' do
diff --git a/spec/controllers/outgoing_messages/delivery_statuses_controller_spec.rb b/spec/controllers/outgoing_messages/delivery_statuses_controller_spec.rb
index 5b8496b99e..d791a9c6af 100644
--- a/spec/controllers/outgoing_messages/delivery_statuses_controller_spec.rb
+++ b/spec/controllers/outgoing_messages/delivery_statuses_controller_spec.rb
@@ -10,7 +10,7 @@
2015-11-22 00:37:00 [17619] 1a0IeK-0004aB-Na <= request@example.com U=alaveteli P=local S=3973 id=ogm-jh217mwec@example.com@localhost T="RE: An FOI Request about Potatoes 15" from for body@example.com body@example.com\n
EOF
lines.map do |line|
- mock_model(MailServerLog, line: line, :is_owning_user? => true)
+ mock_model(MailServerLog, line: line, is_owning_user?: true)
end
end
diff --git a/spec/controllers/password_changes_controller_spec.rb b/spec/controllers/password_changes_controller_spec.rb
index 48f9ec47b6..5da8077c59 100644
--- a/spec/controllers/password_changes_controller_spec.rb
+++ b/spec/controllers/password_changes_controller_spec.rb
@@ -5,7 +5,7 @@
describe 'GET new' do
it 'assigns the pretoken if supplied' do
- get :new, params: { :pretoken => 'abcdef' }
+ get :new, params: { pretoken: 'abcdef' }
expect(assigns[:pretoken]).to eq('abcdef')
end
@@ -15,7 +15,7 @@
end
it 'assigns nil to the pretoken if blank' do
- get :new, params: { :pretoken => '' }
+ get :new, params: { pretoken: '' }
expect(assigns[:pretoken]).to eq(nil)
end
@@ -53,8 +53,8 @@
user = FactoryBot.create(:user)
sign_in user
post :create, params: {
- :password_change_user => {
- :email => 'hacker@localhost'
+ password_change_user: {
+ email: 'hacker@localhost'
}
}
expect(assigns[:password_change_user]).to eq(user)
@@ -82,7 +82,7 @@
it 'assigns the user' do
user = FactoryBot.create(:user)
post :create, params: {
- :password_change_user => { :email => user.email }
+ password_change_user: { email: user.email }
}
expect(assigns[:password_change_user]).to eq(user)
end
@@ -90,7 +90,7 @@
it 'finds the user if the email case is different' do
user = FactoryBot.create(:user)
post :create, params: {
- :password_change_user => { :email => user.email.upcase }
+ password_change_user: { email: user.email.upcase }
}
expect(assigns[:password_change_user]).to eq(user)
end
@@ -109,16 +109,16 @@
circumstance: 'change_password' }
post :create, params: {
- :password_change_user => { :email => user.email }
+ password_change_user: { email: user.email }
}
post_redirect = PostRedirect.last
expected_attrs[:uri] = edit_password_change_url(post_redirect.token)
- post_redirect_attrs = { :uri => post_redirect.uri,
- :post_params => post_redirect.post_params,
- :reason_params => post_redirect.reason_params,
- :circumstance => post_redirect.circumstance }
+ post_redirect_attrs = { uri: post_redirect.uri,
+ post_params: post_redirect.post_params,
+ reason_params: post_redirect.reason_params,
+ circumstance: post_redirect.circumstance }
expect(post_redirect_attrs).to eq(expected_attrs)
end
@@ -127,25 +127,25 @@
it 'adds the pretoken to the post redirect uri' do
user = FactoryBot.create(:user)
- pretoken = PostRedirect.create(:user => user, :uri => '/')
+ pretoken = PostRedirect.create(user: user, uri: '/')
post :create, params: {
- :password_change_user => {
- :email => user.email
+ password_change_user: {
+ email: user.email
},
- :pretoken => pretoken.token
+ pretoken: pretoken.token
}
post_redirect = PostRedirect.last
expected = edit_password_change_url(post_redirect.token,
- :pretoken => pretoken.token)
+ pretoken: pretoken.token)
expect(post_redirect.uri).to include(expected)
end
it 'does not add a blank pretoken to the post redirect uri' do
user = FactoryBot.create(:user)
- pretoken = PostRedirect.create(:user => user, :uri => '/')
+ pretoken = PostRedirect.create(user: user, uri: '/')
post :create, params: {
- :password_change_user => { :email => user.email },
- :pretoken => ''
+ password_change_user: { email: user.email },
+ pretoken: ''
}
post_redirect = PostRedirect.last
expected = edit_password_change_url(post_redirect.token)
@@ -158,7 +158,7 @@
user = FactoryBot.create(:user)
post :create, params: {
- :password_change_user => { :email => user.email }
+ password_change_user: { email: user.email }
}
email = ActionMailer::Base.deliveries.last
@@ -168,8 +168,8 @@
it 'does not send a confirmation email for an unknown email' do
post :create, params: {
- :password_change_user => {
- :email => 'unknown-email@example.org'
+ password_change_user: {
+ email: 'unknown-email@example.org'
}
}
expect(ActionMailer::Base.deliveries.size).to eq(0)
@@ -178,15 +178,15 @@
it 'renders the confirmation message' do
user = FactoryBot.create(:user)
post :create, params: {
- :password_change_user => { :email => user.email }
+ password_change_user: { email: user.email }
}
expect(response).to render_template(:check_email)
end
it 'renders the confirmation message for an unknown email' do
post :create, params: {
- :password_change_user => {
- :email => 'unknown-email@example.org'
+ password_change_user: {
+ email: 'unknown-email@example.org'
}
}
expect(response).to render_template(:check_email)
@@ -196,14 +196,14 @@
msg = "That doesn't look like a valid email address. Please check " \
"you have typed it correctly."
post :create, params: {
- :password_change_user => { :email => 'invalid-email' }
+ password_change_user: { email: 'invalid-email' }
}
expect(flash[:error]).to eq(msg)
end
it 're-renders the form with an invalid email format' do
post :create, params: {
- :password_change_user => { :email => 'invalid-email' }
+ password_change_user: { email: 'invalid-email' }
}
expect(response).to render_template(:new)
end
@@ -216,26 +216,26 @@
let(:user) { FactoryBot.create(:user) }
let(:post_redirect) do
- PostRedirect.create(:user => user, :uri => frontpage_url)
+ PostRedirect.create(user: user, uri: frontpage_url)
end
it 'assigns the pretoken if supplied' do
- get :edit, params: { :id => post_redirect.token, :pretoken => 'abcdef' }
+ get :edit, params: { id: post_redirect.token, pretoken: 'abcdef' }
expect(assigns[:pretoken]).to eq('abcdef')
end
it 'assigns nil to the pretoken if not supplied' do
- get :edit, params: { :id => post_redirect.token }
+ get :edit, params: { id: post_redirect.token }
expect(assigns[:pretoken]).to eq(nil)
end
it 'assigns nil to the pretoken if blank' do
- get :edit, params: { :id => post_redirect.token, :pretoken => '' }
+ get :edit, params: { id: post_redirect.token, pretoken: '' }
expect(assigns[:pretoken]).to eq(nil)
end
it 'assigns the user' do
- get :edit, params: { :id => post_redirect.token }
+ get :edit, params: { id: post_redirect.token }
expect(assigns[:password_change_user]).to eq(user)
end
@@ -244,14 +244,14 @@
let(:post_redirect) { PostRedirect.new(user: nil) }
it 'redirects to new for the user to enter their email' do
- get :edit, params: { :id => post_redirect.token }
+ get :edit, params: { id: post_redirect.token }
expect(response).to redirect_to(new_password_change_path)
end
it 'redirects to new with a pretoken for the user to enter their email' do
- get :edit, params: { :id => post_redirect.token, :pretoken => 'abcdef' }
+ get :edit, params: { id: post_redirect.token, pretoken: 'abcdef' }
expect(response).
- to redirect_to(new_password_change_path(:pretoken => 'abcdef'))
+ to redirect_to(new_password_change_path(pretoken: 'abcdef'))
end
end
@@ -259,7 +259,7 @@
context 'invalid token' do
it 'redirects to new to force an email confirmation' do
- get :edit, params: { :id => 'invalid' }
+ get :edit, params: { id: 'invalid' }
expect(response).to redirect_to new_password_change_path
end
@@ -312,47 +312,47 @@
let(:user) { FactoryBot.create(:user) }
let(:post_redirect) do
- PostRedirect.create(:user => user, :uri => frontpage_path)
+ PostRedirect.create(user: user, uri: frontpage_path)
end
before(:each) do
@valid_password_params =
- { :password => 'secret123456',
- :password_confirmation => 'secret123456' }
+ { password: 'secret123456',
+ password_confirmation: 'secret123456' }
@invalid_password_params =
- { :password => 'secret',
- :password_confirmation => 'password' }
+ { password: 'secret',
+ password_confirmation: 'password' }
end
it 'changes the password on success' do
old_hash = user.hashed_password
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(user.reload.hashed_password).not_to eq(old_hash)
end
it 'notifies the user the password change has been successful' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(flash[:notice]).to eq('Your password has been changed.')
end
it 'assigns the user from a post redirect' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(assigns[:password_change_user]).to eq(user)
end
it 'logs in the user on success' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(session[:user_id]).to eq(user.id)
end
@@ -360,28 +360,28 @@
it 'retains the old password on failure' do
old_hash = user.hashed_password
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @invalid_password_params
+ id: post_redirect.token,
+ password_change_user: @invalid_password_params
}
expect(user.reload.hashed_password).to eq(old_hash)
end
it 're-renders the form on failure' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @invalid_password_params
+ id: post_redirect.token,
+ password_change_user: @invalid_password_params
}
expect(response).to render_template(:edit)
end
context 'no user is specified' do
- let(:post_redirect) { PostRedirect.new(:user => nil) }
+ let(:post_redirect) { PostRedirect.new(user: nil) }
it 'redirects to #new when a user cannot be found' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(response).to redirect_to(new_password_change_path)
end
@@ -392,8 +392,8 @@
it 'redirects to new to force an email confirmation' do
put :update, params: {
- :id => 'invalid',
- :password_change_user => @valid_password_params
+ id: 'invalid',
+ password_change_user: @valid_password_params
}
expect(response).to redirect_to new_password_change_path
end
@@ -403,30 +403,30 @@
context 'when a pretoken is supplied' do
it 'redirects to the post redirect uri' do
- pretoken = PostRedirect.create(:user => user, :uri => '/')
+ pretoken = PostRedirect.create(user: user, uri: '/')
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params,
- :pretoken => pretoken.token
+ id: post_redirect.token,
+ password_change_user: @valid_password_params,
+ pretoken: pretoken.token
}
expect(response).to redirect_to(pretoken.uri)
end
it 'does not redirect to another domain' do
- pretoken = PostRedirect.create(:user => user, :uri => 'http://bad.place.com/')
+ pretoken = PostRedirect.create(user: user, uri: 'http://bad.place.com/')
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params,
- :pretoken => pretoken.token
+ id: post_redirect.token,
+ password_change_user: @valid_password_params,
+ pretoken: pretoken.token
}
expect(response).to redirect_to('/')
end
it 'redirects to the user profile with a blank pretoken' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params,
- :pretoken => ''
+ id: post_redirect.token,
+ password_change_user: @valid_password_params,
+ pretoken: ''
}
expect(response).to redirect_to(show_user_profile_path(user.url_name))
end
@@ -437,8 +437,8 @@
it 'redirects to the user profile on success' do
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(response).to redirect_to(show_user_profile_path(user.url_name))
end
@@ -456,10 +456,10 @@
it 'changes the password with a correct otp_code' do
old_hash = user.hashed_password
- params = @valid_password_params.merge(:otp_code => user.otp_code)
+ params = @valid_password_params.merge(otp_code: user.otp_code)
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => params
+ id: post_redirect.token,
+ password_change_user: params
}
expect(user.reload.hashed_password).not_to eq(old_hash)
@@ -467,22 +467,22 @@
it 'redirects to the two factor page to show the new OTP' do
old_hash = user.hashed_password
- params = @valid_password_params.merge(:otp_code => user.otp_code)
+ params = @valid_password_params.merge(otp_code: user.otp_code)
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => params
+ id: post_redirect.token,
+ password_change_user: params
}
expect(response).to redirect_to(one_time_password_path)
end
it 'redirects to the two factor page even if there is a pretoken redirect' do
- pretoken = PostRedirect.create(:user => user, :uri => '/')
- params = @valid_password_params.merge(:otp_code => user.otp_code)
+ pretoken = PostRedirect.create(user: user, uri: '/')
+ params = @valid_password_params.merge(otp_code: user.otp_code)
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => params,
- :pretoken => pretoken.token
+ id: post_redirect.token,
+ password_change_user: params,
+ pretoken: pretoken.token
}
expect(response).to redirect_to(one_time_password_path)
@@ -490,10 +490,10 @@
it 'reminds the user that they have a new OTP' do
old_hash = user.hashed_password
- params = @valid_password_params.merge(:otp_code => user.otp_code)
+ params = @valid_password_params.merge(otp_code: user.otp_code)
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => params
+ id: post_redirect.token,
+ password_change_user: params
}
msg = "Your password has been changed. " \
@@ -504,10 +504,10 @@
it 'does not change the password with an incorrect otp_code' do
old_hash = user.hashed_password
- params = @valid_password_params.merge(:otp_code => 'invalid')
+ params = @valid_password_params.merge(otp_code: 'invalid')
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => params
+ id: post_redirect.token,
+ password_change_user: params
}
expect(user.reload.hashed_password).to eq(old_hash)
@@ -516,8 +516,8 @@
it 'does not change the password without an otp_code' do
old_hash = user.hashed_password
put :update, params: {
- :id => post_redirect.token,
- :password_change_user => @valid_password_params
+ id: post_redirect.token,
+ password_change_user: @valid_password_params
}
expect(user.reload.hashed_password).to eq(old_hash)
diff --git a/spec/controllers/public_body_change_requests_controller_spec.rb b/spec/controllers/public_body_change_requests_controller_spec.rb
index f29716d0d6..4feba9297b 100644
--- a/spec/controllers/public_body_change_requests_controller_spec.rb
+++ b/spec/controllers/public_body_change_requests_controller_spec.rb
@@ -27,19 +27,19 @@
before do
@email = "test@example.com"
name = "Test User"
- @change_request_params = {:user_email => @email,
- :user_name => name,
- :public_body_name => 'New Body',
- :public_body_email => 'new_body@example.com',
- :notes => 'Please',
- :source => 'http://www.example.com',
- :comment => '' }
+ @change_request_params = {user_email: @email,
+ user_name: name,
+ public_body_name: 'New Body',
+ public_body_email: 'new_body@example.com',
+ notes: 'Please',
+ source: 'http://www.example.com',
+ comment: '' }
end
it "should send an email to the site contact address" do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
change_request_id = assigns[:change_request].id
deliveries = ActionMailer::Base.deliveries
@@ -57,7 +57,7 @@
it 'sets render_recaptcha to true if there is no logged in user' do
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expect(assigns[:render_recaptcha]).to eq(true)
end
@@ -65,7 +65,7 @@
it 'sets render_recaptcha to false if there is a logged in user' do
sign_in FactoryBot.create(:user)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expect(assigns[:render_recaptcha]).to eq(false)
end
@@ -73,7 +73,7 @@
it 're-renders the form if the recaptcha verification was unsuccessful' do
allow(@controller).to receive(:verify_recaptcha).and_return(false)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expect(response).to render_template(:new)
end
@@ -81,7 +81,7 @@
it 'should show a notice' do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expected_text = "Your request to add an authority has been sent. Thank you for getting in touch! We'll get back to you soon."
expect(flash[:notice]).to eq(expected_text)
@@ -90,16 +90,16 @@
it 'should redirect to the frontpage' do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expect(response).to redirect_to frontpage_url
end
it 'has rudimentary spam protection' do
- spam_request_params = @change_request_params.merge({ :comment => 'I AM A SPAMBOT' })
+ spam_request_params = @change_request_params.merge({ comment: 'I AM A SPAMBOT' })
post :create, params: {
- :public_body_change_request => spam_request_params
+ public_body_change_request: spam_request_params
}
expect(response).to redirect_to(frontpage_path)
@@ -115,19 +115,19 @@
@email = "test@example.com"
name = "Test User"
@public_body = FactoryBot.create(:public_body)
- @change_request_params = {:user_email => @email,
- :user_name => name,
- :public_body_id => @public_body.id,
- :public_body_email => 'new_body@example.com',
- :notes => 'Please',
- :source => 'http://www.example.com',
- :comment => '' }
+ @change_request_params = {user_email: @email,
+ user_name: name,
+ public_body_id: @public_body.id,
+ public_body_email: 'new_body@example.com',
+ notes: 'Please',
+ source: 'http://www.example.com',
+ comment: '' }
end
it 'should send an email to the site contact address' do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
change_request_id = assigns[:change_request].id
deliveries = ActionMailer::Base.deliveries
@@ -146,7 +146,7 @@
it 'should show a notice' do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expected_text = "Your request to update the address for #{@public_body.name} has been sent. Thank you for getting in touch! We'll get back to you soon."
expect(flash[:notice]).to eq(expected_text)
@@ -155,7 +155,7 @@
it 'should redirect to the frontpage' do
allow(@controller).to receive(:verify_recaptcha).and_return(true)
post :create, params: {
- :public_body_change_request => @change_request_params
+ public_body_change_request: @change_request_params
}
expect(response).to redirect_to frontpage_url
end
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index f7b89992e6..3fe329c360 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -10,89 +10,89 @@
end
it "should be successful" do
- get :show, params: { :url_name => "dfh", :view => 'all' }
+ get :show, params: { url_name: "dfh", view: 'all' }
expect(response).to be_successful
end
it "should render with 'show' template" do
- get :show, params: { :url_name => "dfh", :view => 'all' }
+ get :show, params: { url_name: "dfh", view: 'all' }
expect(response).to render_template('show')
end
it "should assign the body" do
- get :show, params: { :url_name => "dfh", :view => 'all' }
+ get :show, params: { url_name: "dfh", view: 'all' }
expect(assigns[:public_body]).to eq(public_bodies(:humpadink_public_body))
end
it "should assign the requests (1)" do
- get :show, params: { :url_name => "tgq", :view => 'all' }
- conditions = { :public_body_id => public_bodies(:geraldine_public_body).id }
+ get :show, params: { url_name: "tgq", view: 'all' }
+ conditions = { public_body_id: public_bodies(:geraldine_public_body).id }
actual = assigns[:xapian_requests].results.map { |x| x[:model].info_request }
expect(actual).to match_array(InfoRequest.where(conditions))
end
it "should assign the requests (2)" do
- get :show, params: { :url_name => "tgq", :view => 'successful' }
- conditions = { :described_state => 'successful',
- :public_body_id => public_bodies(:geraldine_public_body).id }
+ get :show, params: { url_name: "tgq", view: 'successful' }
+ conditions = { described_state: 'successful',
+ public_body_id: public_bodies(:geraldine_public_body).id }
actual = assigns[:xapian_requests].results.map { |x| x[:model].info_request }
expect(actual).to match_array(InfoRequest.where(conditions))
end
it "should assign the requests (3)" do
- get :show, params: { :url_name => "dfh", :view => 'all' }
- conditions = { :public_body_id => public_bodies(:humpadink_public_body).id }
+ get :show, params: { url_name: "dfh", view: 'all' }
+ conditions = { public_body_id: public_bodies(:humpadink_public_body).id }
actual = assigns[:xapian_requests].results.map { |x| x[:model].info_request }
expect(actual).to match_array(InfoRequest.where(conditions))
end
it "should display the body using same locale as that used in url_name" do
- get :show, params: { :url_name => "edfh", :view => 'all', :locale => "es" }
+ get :show, params: { url_name: "edfh", view: 'all', locale: "es" }
expect(response.body).to have_content("Baguette")
end
it 'should show public body names in the selected locale language if present for a locale with underscores' do
AlaveteliLocalization.set_locales('he_IL en', 'en')
- get :show, params: { :url_name => 'dfh',
- :view => 'all',
- :locale => 'he_IL' }
+ get :show, params: { url_name: 'dfh',
+ view: 'all',
+ locale: 'he_IL' }
expect(response.body).to have_content('Hebrew Humpadinking')
end
it "should redirect use to the relevant locale even when url_name is for a different locale" do
- get :show, params: { :url_name => "edfh", :view => 'all' }
+ get :show, params: { url_name: "edfh", view: 'all' }
expect(response).to redirect_to "http://test.host/body/dfh"
end
it "should redirect to newest name if you use historic name of public body in URL" do
- get :show, params: { :url_name => "hdink", :view => 'all' }
- expect(response).to redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
+ get :show, params: { url_name: "hdink", view: 'all' }
+ expect(response).to redirect_to(controller: 'public_body', action: 'show', url_name: "dfh")
end
it "should redirect to lower case name if you use mixed case name in URL" do
- get :show, params: { :url_name => "dFh", :view => 'all' }
- expect(response).to redirect_to(:controller => 'public_body', :action => 'show', :url_name => "dfh")
+ get :show, params: { url_name: "dFh", view: 'all' }
+ expect(response).to redirect_to(controller: 'public_body', action: 'show', url_name: "dfh")
end
it 'keeps the search_params flash' do
# Make two get requests to simulate the flash getting swept after the
# first response.
search_params = { 'query' => 'Quango' }
- get :show, params: { :url_name => 'dfh', :view => 'all' },
- flash: { :search_params => search_params }
- get :show, params: { :url_name => 'dfh', :view => 'all' }
+ get :show, params: { url_name: 'dfh', view: 'all' },
+ flash: { search_params: search_params }
+ get :show, params: { url_name: 'dfh', view: 'all' }
expect(flash[:search_params]).to eq(search_params)
end
it 'should not show high page offsets as these are extremely slow to generate' do
expect {
- get :show, params: { :url_name => 'dfh', :view => 'all', :page => 25 }
+ get :show, params: { url_name: 'dfh', view: 'all', page: 25 }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'should not raise an error when given an empty query param' do
- get :show, params: { :url_name => "dfh", :view => 'all', :query => nil }
+ get :show, params: { url_name: "dfh", view: 'all', query: nil }
expect(response).to be_successful
end
end
@@ -111,14 +111,14 @@ def make_single_language_example(locale)
AlaveteliLocalization.with_locale(locale) do
case locale
when :en
- result = PublicBody.new(:name => 'English only',
- :short_name => 'EO')
+ result = PublicBody.new(name: 'English only',
+ short_name: 'EO')
when :es
- result = PublicBody.new(:name => 'Español Solamente',
- :short_name => 'ES')
+ result = PublicBody.new(name: 'Español Solamente',
+ short_name: 'ES')
when :en_GB
- result = PublicBody.new(:name => 'GB English',
- :short_name => 'GB')
+ result = PublicBody.new(name: 'GB English',
+ short_name: 'GB')
else
raise StandardError.new "Unknown locale #{locale}"
end
@@ -134,7 +134,7 @@ def make_single_language_example(locale)
it "with no fallback, should only return bodies from the current locale" do
@english_only = make_single_language_example :en
@spanish_only = make_single_language_example :es
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
expect(assigns[:public_bodies].include?(@english_only)).to eq(false)
expect(assigns[:public_bodies].include?(@spanish_only)).to eq(true)
end
@@ -142,27 +142,27 @@ def make_single_language_example(locale)
it "if fallback is requested, should list all bodies from default locale, even when there are no translations for selected locale" do
allow(AlaveteliConfiguration).to receive(:public_body_list_fallback_to_default_locale).and_return(true)
@english_only = make_single_language_example :en
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
expect(assigns[:public_bodies].include?(@english_only)).to eq(true)
end
it 'if fallback is requested, should still list public bodies only with translations in the current locale' do
allow(AlaveteliConfiguration).to receive(:public_body_list_fallback_to_default_locale).and_return(true)
@spanish_only = make_single_language_example :es
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
expect(assigns[:public_bodies].include?(@spanish_only)).to eq(true)
end
it "if fallback is requested, make sure that there are no duplicates listed" do
allow(AlaveteliConfiguration).to receive(:public_body_list_fallback_to_default_locale).and_return(true)
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
pb_ids = assigns[:public_bodies].map { |pb| pb.id }
unique_pb_ids = pb_ids.uniq
expect(pb_ids.sort).to be === unique_pb_ids.sort
end
it 'should show public body names in the selected locale language if present' do
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
expect(response.body).to have_content('El Department for Humpadinking')
end
@@ -170,13 +170,13 @@ def make_single_language_example(locale)
AlaveteliLocalization.set_locales(available_locales='en en_GB',
default_locale='en')
@gb_only = make_single_language_example :en_GB
- get :list, params: { :locale => 'en_GB' }
+ get :list, params: { locale: 'en_GB' }
expect(response.body).to have_content(@gb_only.name)
end
it 'should not show the internal admin authority' do
PublicBody.internal_admin_body
- get :list, params: { :locale => 'en' }
+ get :list, params: { locale: 'en' }
expect(response.body).not_to have_content('Internal admin authority')
end
@@ -185,7 +185,7 @@ def make_single_language_example(locale)
# Public Body Name
# ... eo extract all of those, and check that they are ordered:
allow(AlaveteliConfiguration).to receive(:public_body_list_fallback_to_default_locale).and_return(true)
- get :list, params: { :locale => 'es' }
+ get :list, params: { locale: 'es' }
parsed = Nokogiri::HTML(response.body)
public_body_names = parsed.xpath '//span[@class="head"]/a/text()'
public_body_names = public_body_names.map { |pb| pb.to_s }
@@ -194,7 +194,7 @@ def make_single_language_example(locale)
it 'should show public body names in the selected locale language if present for a locale with underscores' do
AlaveteliLocalization.set_locales('he_IL en', 'en')
- get :list, params: { :locale => 'he_IL' }
+ get :list, params: { locale: 'he_IL' }
expect(response.body).to have_content('Hebrew Humpadinking')
end
@@ -223,7 +223,7 @@ def make_single_language_example(locale)
with(an_instance_of(String)).
and_return(true)
- get :list, params: { :locale => 'en_GB' }
+ get :list, params: { locale: 'en_GB' }
expect(assigns[:public_bodies].to_sql).to include('COLLATE')
end
@@ -235,7 +235,7 @@ def make_single_language_example(locale)
with(an_instance_of(String)).
and_return(false)
- get :list, params: { :locale => 'unknown' }
+ get :list, params: { locale: 'unknown' }
expect(assigns[:public_bodies].to_sql).to_not include('COLLATE')
end
@@ -248,7 +248,7 @@ def make_single_language_example(locale)
with(an_instance_of(String)).
and_return(true)
- get :list, params: { :locale => 'en_GB' }
+ get :list, params: { locale: 'en_GB' }
expect(assigns[:public_bodies].to_sql).to include('COLLATE')
end
@@ -261,23 +261,23 @@ def make_single_language_example(locale)
with(an_instance_of(String)).
and_return(false)
- get :list, params: { :locale => 'unknown' }
+ get :list, params: { locale: 'unknown' }
expect(assigns[:public_bodies].to_sql).to_not include('COLLATE')
end
it "should support simple searching of bodies by title" do
- get :list, params: { :public_body_query => 'quango' }
+ get :list, params: { public_body_query: 'quango' }
expect(assigns[:public_bodies]).to eq([ public_bodies(:geraldine_public_body) ])
end
it "should support simple searching of bodies by short_name" do
- get :list, params: { :public_body_query => 'DfH' }
+ get :list, params: { public_body_query: 'DfH' }
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
end
xit "should support simple searching of bodies by notes" do
- get :list, params: { :public_body_query => 'Albatross' }
+ get :list, params: { public_body_query: 'Albatross' }
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
end
@@ -299,18 +299,18 @@ def make_single_language_example(locale)
category = FactoryBot.create(:public_body_category)
heading = FactoryBot.create(:public_body_heading)
- PublicBodyCategoryLink.create(:public_body_heading_id => heading.id,
- :public_body_category_id => category.id)
+ PublicBodyCategoryLink.create(public_body_heading_id: heading.id,
+ public_body_category_id: category.id)
public_bodies(:humpadink_public_body).tag_string = category.category_tag
- get :list, params: { :tag => category.category_tag }
+ get :list, params: { tag: category.category_tag }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
expect(assigns[:tag]).to eq(category.category_tag)
expect(assigns[:description]).
to eq("Found 1 public authority in the category ‘#{category.title}’")
- get :list, params: { :tag => "other" }
+ get :list, params: { tag: "other" }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ public_bodies(:other_public_body),
public_bodies(:forlorn_public_body),
@@ -331,17 +331,17 @@ def make_single_language_example(locale)
it "should list a machine tagged thing, should get it in both ways" do
public_bodies(:humpadink_public_body).tag_string = "eats_cheese:stilton"
- get :list, params: { :tag => "eats_cheese" }
+ get :list, params: { tag: "eats_cheese" }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
expect(assigns[:tag]).to eq("eats_cheese")
- get :list, params: { :tag => "eats_cheese:jarlsberg" }
+ get :list, params: { tag: "eats_cheese:jarlsberg" }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ ])
expect(assigns[:tag]).to eq("eats_cheese:jarlsberg")
- get :list, params: { :tag => "eats_cheese:stilton" }
+ get :list, params: { tag: "eats_cheese:stilton" }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ public_bodies(:humpadink_public_body) ])
expect(assigns[:tag]).to eq("eats_cheese:stilton")
@@ -350,9 +350,9 @@ def make_single_language_example(locale)
it 'should not include hidden requests in the request count' do
fake_pb = FactoryBot.create(:public_body)
hidden_request = FactoryBot.create(:info_request,
- :prominence => 'hidden',
- :public_body => fake_pb)
- visible_request = FactoryBot.create(:info_request, :public_body => fake_pb)
+ prominence: 'hidden',
+ public_body: fake_pb)
+ visible_request = FactoryBot.create(:info_request, public_body: fake_pb)
fake_pb.reload
expect(fake_pb.info_requests.size).to eq(2)
expect(fake_pb.info_requests.is_searchable.size).to eq(1)
@@ -372,7 +372,7 @@ def make_single_language_example(locale)
it 'raises an UnknownFormat error if asked for a json version of a list' do
expect {
- get :list, params: { :format => 'json' }
+ get :list, params: { format: 'json' }
}.to raise_error(ActionController::UnknownFormat)
end
@@ -383,7 +383,7 @@ def make_single_language_example(locale)
FactoryBot.create(:public_body, name: "Åčçèñtéd Authority")
end
- get :list, params: { :tag => "å", :locale => 'cs' }
+ get :list, params: { tag: "å", locale: 'cs' }
expect(response).to render_template('list')
expect(assigns[:public_bodies]).to eq([ authority ])
expect(assigns[:tag]).to eq("Å")
@@ -394,7 +394,7 @@ def make_single_language_example(locale)
RSpec.describe PublicBodyController, "when showing JSON version for API" do
it "should be successful" do
- get :show, params: { :url_name => "dfh", :format => "json", :view => 'all' }
+ get :show, params: { url_name: "dfh", format: "json", view: 'all' }
pb = JSON.parse(response.body)
expect(pb.class.to_s).to eq('Hash')
@@ -444,17 +444,17 @@ def make_single_language_example(locale)
end
it 'renders the search_ahead template' do
- get :search_typeahead, params: { :query => "" }
+ get :search_typeahead, params: { query: "" }
expect(response).to render_template('public_body/_search_ahead')
end
it 'assigns the xapian search to the view as xapian_requests' do
- get :search_typeahead, params: { :query => "Geraldine Humpadinking" }
+ get :search_typeahead, params: { query: "Geraldine Humpadinking" }
expect(assigns[:xapian_requests]).to be_an_instance_of ActsAsXapian::Search
end
it "shows the number of bodies matching the keywords" do
- get :search_typeahead, params: { :query => "Geraldine Humpadinking" }
+ get :search_typeahead, params: { query: "Geraldine Humpadinking" }
expect(response.body).to match("2 matching authorities")
end
diff --git a/spec/controllers/reports_controller_spec.rb b/spec/controllers/reports_controller_spec.rb
index 14721604ea..bf78fd28d1 100644
--- a/spec/controllers/reports_controller_spec.rb
+++ b/spec/controllers/reports_controller_spec.rb
@@ -9,13 +9,12 @@
context "when reporting a request when not logged in" do
it "should only allow logged-in users to report requests" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(flash[:notice]).to match(/You need to be logged in/)
expect(response)
- .to redirect_to show_request_path(:url_title =>
- info_request.url_title)
+ .to redirect_to show_request_path(url_title: info_request.url_title)
end
end
@@ -26,8 +25,8 @@
it "finds the expected request" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(assigns(:info_request)).to eq(info_request)
@@ -35,8 +34,8 @@
it "sets reportable to the request" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(assigns(:reportable)).to eq(info_request)
@@ -44,8 +43,8 @@
it "sets report_reasons to the request report reasons" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(assigns(:report_reasons)).to eq(info_request.report_reasons)
@@ -70,23 +69,23 @@
it 'ignores an empty comment_id param' do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => '',
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: '',
+ reason: "my reason"
}
expect(assigns[:comment]).to be_nil
end
it "should 404 for non-existent requests" do
expect {
- post :create, params: { :request_id => "hjksfdhjk_louytu_qqxxx" }
+ post :create, params: { request_id: "hjksfdhjk_louytu_qqxxx" }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'should 404 for embargoed requests' do
info_request = FactoryBot.create(:embargoed_request)
expect {
- post :create, params: { :request_id => info_request.url_title }
+ post :create, params: { request_id: info_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -94,12 +93,11 @@
expect(info_request.attention_requested).to eq(false)
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(response)
- .to redirect_to show_request_path(:url_title =>
- info_request.url_title)
+ .to redirect_to show_request_path(url_title: info_request.url_title)
info_request.reload
expect(info_request.attention_requested).to eq(true)
@@ -110,9 +108,9 @@
expected = "This request has been reported for administrator attention"
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason",
- :message => "It's just not"
+ request_id: info_request.url_title,
+ reason: "my reason",
+ message: "It's just not"
}
expect(flash[:notice]).to eq(expected)
@@ -120,28 +118,26 @@
it "should not allow a request to be reported twice" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(response)
- .to redirect_to show_request_url(:url_title =>
- info_request.url_title)
+ .to redirect_to show_request_url(url_title: info_request.url_title)
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ reason: "my reason"
}
expect(response)
- .to redirect_to show_request_url(:url_title =>
- info_request.url_title)
+ .to redirect_to show_request_url(url_title: info_request.url_title)
expect(flash[:notice]).to match(/has already been reported/)
end
it "should send an email from the reporter to admins" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => "my reason",
- :message => "It's just not"
+ request_id: info_request.url_title,
+ reason: "my reason",
+ message: "It's just not"
}
deliveries = ActionMailer::Base.deliveries
expect(deliveries.size).to eq(1)
@@ -155,8 +151,8 @@
it "should force the user to pick a reason" do
post :create, params: {
- :request_id => info_request.url_title,
- :reason => ""
+ request_id: info_request.url_title,
+ reason: ""
}
expect(response).to render_template("new")
expect(flash[:error]).to eq("Please choose a reason")
@@ -170,15 +166,15 @@
end
let(:comment) do
- FactoryBot.create(:comment, :info_request => info_request,
- :attention_requested => false)
+ FactoryBot.create(:comment, info_request: info_request,
+ attention_requested: false)
end
it "finds the expected request" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
expect(assigns(:info_request)).to eq(info_request)
@@ -186,9 +182,9 @@
it "finds the expected comment" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
expect(assigns(:comment)).to eq(comment)
@@ -196,9 +192,9 @@
it "sets reportable to the comment" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
expect(assigns(:reportable)).to eq(comment)
@@ -206,9 +202,9 @@
it "sets report_reasons to the comment report reasons" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
expect(assigns(:report_reasons)).to eq(comment.report_reasons)
@@ -218,18 +214,18 @@
new_comment = FactoryBot.create(:comment)
expect {
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => new_comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: new_comment.id,
+ reason: "my reason"
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "marks the comment as having been reported" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
comment.reload
@@ -238,9 +234,9 @@
it "does not mark the parent request as having been reported" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
info_request.reload
@@ -250,10 +246,10 @@
it "sends an email alerting admins to the report" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason",
- :message => "It's just not"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason",
+ message: "It's just not"
}
deliveries = ActionMailer::Base.deliveries
@@ -278,10 +274,10 @@
"administrator attention"
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason",
- :message => "It's just not"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason",
+ message: "It's just not"
}
expect(flash[:notice]).to eq(expected)
@@ -289,15 +285,14 @@
it "redirects to the parent info_request page" do
post :create, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason",
- :message => "It's just not"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason",
+ message: "It's just not"
}
expect(response)
- .to redirect_to show_request_path(:url_title =>
- info_request.url_title)
+ .to redirect_to show_request_path(url_title: info_request.url_title)
end
end
@@ -310,9 +305,9 @@
context "not logged in" do
it "should require the user to be logged in" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(response).
- to redirect_to(signin_path(:token => PostRedirect.last.token))
+ to redirect_to(signin_path(token: PostRedirect.last.token))
end
end
@@ -322,42 +317,42 @@
end
it "finds the expected request" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(assigns(:info_request)).to eq(info_request)
end
it "sets reportable to the request" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(assigns(:reportable)).to eq(info_request)
end
it "sets report_reasons to the request report reasons" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(assigns(:report_reasons)).to eq(info_request.report_reasons)
end
it "sets the page title" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(assigns(:title)).
to eq("Report request: #{ info_request.title }")
end
it "should show the form" do
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
expect(response).to render_template("new")
end
it "should 404 for non-existent requests" do
expect {
- get :new, params: { :request_id => "hjksfdhjk_louytu_qqxxx" }
+ get :new, params: { request_id: "hjksfdhjk_louytu_qqxxx" }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'should 404 for embargoed requests' do
info_request = FactoryBot.create(:embargoed_request)
expect {
- get :new, params: { :request_id => info_request.url_title }
+ get :new, params: { request_id: info_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -371,23 +366,23 @@
end
let(:comment) do
- FactoryBot.create(:comment, :info_request => info_request,
- :attention_requested => false)
+ FactoryBot.create(:comment, info_request: info_request,
+ attention_requested: false)
end
it "finds the expected request" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(assigns(:info_request)).to eq(info_request)
end
it "finds the expected comment" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id,
- :reason => "my reason"
+ request_id: info_request.url_title,
+ comment_id: comment.id,
+ reason: "my reason"
}
expect(assigns(:comment)).to eq(comment)
@@ -395,8 +390,8 @@
it "sets reportable to the comment" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(assigns(:reportable)).to eq(comment)
@@ -404,8 +399,8 @@
it "sets report_reasons to the comment report reasons" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(assigns(:report_reasons)).to eq(comment.report_reasons)
@@ -413,8 +408,8 @@
it "sets the page title" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(assigns(:title)).
@@ -425,35 +420,35 @@
new_comment = FactoryBot.create(:comment)
expect {
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => new_comment.id
+ request_id: info_request.url_title,
+ comment_id: new_comment.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "should show the form" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(response).to render_template("new")
end
it "copies the comment id into a hidden form field" do
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
expect(response.body).
to have_selector("input#comment_id[value=\"#{comment.id}\"]",
- :visible => false)
+ visible: false)
end
it "should 404 for non-existent requests" do
expect {
get :new, params: {
- :request_id => "hjksfdhjk_louytu_qqxxx",
- :comment_id => comment.id
+ request_id: "hjksfdhjk_louytu_qqxxx",
+ comment_id: comment.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -462,8 +457,8 @@
info_request = FactoryBot.create(:embargoed_request)
expect {
get :new, params: {
- :request_id => info_request.url_title,
- :comment_id => comment.id
+ request_id: info_request.url_title,
+ comment_id: comment.id
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 4c3fe03944..707dc4bcb1 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -7,26 +7,26 @@
end
it "should be successful" do
- get :list, params: { :view => 'all' }
+ get :list, params: { view: 'all' }
expect(response).to be_successful
end
it "should render with 'list' template" do
- get :list, params: { :view => 'all' }
+ get :list, params: { view: 'all' }
expect(response).to render_template('list')
end
it "should return 404 for pages we don't want to serve up" do
xap_results = double(ActsAsXapian::Search,
- :results => (1..25).to_a.map { |m| { :model => m } },
- :matches_estimated => 1_000_000)
+ results: (1..25).to_a.map { |m| { model: m } },
+ matches_estimated: 1_000_000)
expect {
- get :list, params: { :view => 'all', :page => 100 }
+ get :list, params: { view: 'all', page: 100 }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "raise unknown format error" do
- expect { get :list, params: { :view => "all", :format => :json } }.to(
+ expect { get :list, params: { view: "all", format: :json } }.to(
raise_error ActionController::UnknownFormat
)
end
@@ -34,7 +34,7 @@
it 'should not raise an error for a page param of less than zero, but should treat it as
a param of 1' do
expect {
- get :list, params: { :view => 'all', :page => "-1" }
+ get :list, params: { view: 'all', page: "-1" }
}.not_to raise_error
expect(assigns[:page]).to eq(1)
end
@@ -49,28 +49,28 @@
end
it "should be successful" do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response).to be_successful
end
it "should render with 'show' template" do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response).to render_template('show')
end
it "should assign the request" do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(assigns[:info_request]).to eq(info_requests(:fancy_dog_request))
end
it "should redirect from a numeric URL to pretty one" do
- get :show, params: { :url_title => info_requests(:naughty_chicken_request).id.to_s }
- expect(response).to redirect_to(:action => 'show', :url_title => info_requests(:naughty_chicken_request).url_title)
+ get :show, params: { url_title: info_requests(:naughty_chicken_request).id.to_s }
+ expect(response).to redirect_to(action: 'show', url_title: info_requests(:naughty_chicken_request).url_title)
end
it 'should return a 404 for GET requests to a malformed request URL' do
expect {
- get :show, params: { :url_title => '228%85' }
+ get :show, params: { url_title: '228%85' }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -197,14 +197,14 @@
it 'raises ActiveRecord::RecordNotFound' do
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- get :show, params: { :url_title => embargoed_request.url_title }
+ get :show, params: { url_title: embargoed_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
it "doesn't even redirect from a numeric id" do
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- get :show, params: { :url_title => embargoed_request.id }
+ get :show, params: { url_title: embargoed_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -213,7 +213,7 @@
describe 'when viewing anonymously' do
it 'should be successful' do
sign_in nil
- get :show, params: { :url_title => 'balalas' }
+ get :show, params: { url_title: 'balalas' }
expect(response).to be_successful
end
end
@@ -221,7 +221,7 @@
describe 'when the request is being viewed by an admin' do
def make_request
sign_in users(:admin_user)
- get :show, params: { :url_title => 'balalas' }
+ get :show, params: { url_title: 'balalas' }
end
it 'should be successful' do
@@ -236,12 +236,12 @@ def make_request
describe 'when the request is external' do
it 'should assign the "update status" flag to the view as falsey if the parameter is present' do
- get :show, params: { :url_title => 'balalas', :update_status => 1 }
+ get :show, params: { url_title: 'balalas', update_status: 1 }
expect(assigns[:update_status]).to be_falsey
end
it 'should assign the "update status" flag to the view as falsey if the parameter is not present' do
- get :show, params: { :url_title => 'balalas' }
+ get :show, params: { url_title: 'balalas' }
expect(assigns[:update_status]).to be_falsey
end
@@ -249,32 +249,32 @@ def make_request
it 'should assign the "update status" flag to the view as truthy if the parameter is present' do
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: 1
}
expect(assigns[:update_status]).to be_truthy
end
it 'should assign the "update status" flag to the view as falsey if the parameter is not present' do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(assigns[:update_status]).to be_falsey
end
it 'should require login' do
sign_in nil
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: 1
}
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
end
it 'should work if logged in as the requester' do
sign_in users(:bob_smith_user)
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: 1
}
expect(response).to render_template "request/show"
end
@@ -282,8 +282,8 @@ def make_request
it 'should not work if logged in as not the requester' do
sign_in users(:silly_name_user)
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: 1
}
expect(response).to render_template "user/wrong_user"
end
@@ -291,8 +291,8 @@ def make_request
it 'should work if logged in as an admin user' do
sign_in users(:admin_user)
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: 1
}
expect(response).to render_template "request/show"
end
@@ -304,7 +304,7 @@ def make_request
before :each do
sign_in pro_user
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
+ url_title: 'why_do_you_have_such_a_fancy_dog',
pro: "1"
}
end
@@ -321,7 +321,7 @@ def make_request
describe 'when params[:pro] is not set' do
before :each do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
end
it "should set @in_pro_area to false" do
@@ -342,9 +342,9 @@ def make_request
with_feature_enabled(:alaveteli_pro) do
sign_in pro_user
get :show, params: {
- :url_title => pro_request.url_title,
- :pro => "1",
- :update_status => "1"
+ url_title: pro_request.url_title,
+ pro: "1",
+ update_status: "1"
}
expect(assigns[:show_top_describe_state_form]).to be false
end
@@ -356,14 +356,14 @@ def make_request
it "is false" do
info_request = info_requests(:naughty_chicken_request)
expect(info_request.awaiting_description).to be false
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_top_describe_state_form]).to be false
end
context "but the request is awaiting_description" do
it "is true" do
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog'
+ url_title: 'why_do_you_have_such_a_fancy_dog'
}
expect(assigns[:show_top_describe_state_form]).to be true
end
@@ -376,8 +376,8 @@ def make_request
info_request = info_requests(:naughty_chicken_request)
expect(info_request.awaiting_description).to be false
get :show, params: {
- :url_title => info_request.url_title,
- :update_status => "1"
+ url_title: info_request.url_title,
+ update_status: "1"
}
expect(assigns[:show_top_describe_state_form]).to be true
end
@@ -385,8 +385,8 @@ def make_request
context "and the request is awaiting_description" do
it "is true" do
get :show, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :update_status => "1"
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ update_status: "1"
}
expect(assigns[:show_top_describe_state_form]).to be true
end
@@ -398,7 +398,7 @@ def make_request
it "is false" do
info_request = FactoryBot.create(:info_request)
info_request.set_described_state('not_foi')
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_top_describe_state_form]).to be false
end
end
@@ -413,8 +413,8 @@ def make_request
with_feature_enabled(:alaveteli_pro) do
sign_in pro_user
get :show, params: {
- :url_title => pro_request.url_title,
- :pro => "1"
+ url_title: pro_request.url_title,
+ pro: "1"
}
expect(assigns[:show_bottom_describe_state_form]).to be false
end
@@ -424,7 +424,7 @@ def make_request
context "when @in_pro_area is false" do
context "and the request is awaiting_description" do
it "is true" do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(assigns[:show_bottom_describe_state_form]).to be true
end
end
@@ -433,7 +433,7 @@ def make_request
it "is false" do
info_request = info_requests(:naughty_chicken_request)
expect(info_request.awaiting_description).to be false
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_bottom_describe_state_form]).to be false
end
end
@@ -443,7 +443,7 @@ def make_request
it "is false" do
info_request = FactoryBot.create(:info_request)
info_request.set_described_state('not_foi')
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_bottom_describe_state_form]).to be false
end
end
@@ -452,22 +452,22 @@ def make_request
it "should set @state_transitions for the request" do
info_request = FactoryBot.create(:info_request)
expected_transitions = {
- :pending => {
+ pending: {
"waiting_response" => "No response has been received (maybe there's just an acknowledgement)",
"waiting_clarification" => "Clarification has been requested",
"gone_postal" => "A response will be sent by postal mail"
},
- :complete => {
+ complete: {
"not_held" => "The authority do not have the information (maybe they say who does)",
"partially_successful" => "Some of the information has been sent ",
"successful" => "All the information has been sent",
"rejected" => "The request has been refused"
},
- :other => {
+ other: {
"error_message" => "An error message has been received"
}
}
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns(:state_transitions)).to eq(expected_transitions)
end
@@ -483,13 +483,13 @@ def make_request
it "@show_owner_update_status_action should be false" do
expect(info_request.is_old_unclassified?).to be true
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_owner_update_status_action]).to be false
end
it "@show_other_user_update_status_action should be true" do
expect(info_request.is_old_unclassified?).to be true
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_other_user_update_status_action]).to be true
end
end
@@ -498,12 +498,12 @@ def make_request
let(:info_request) { FactoryBot.create(:info_request) }
it "@show_owner_update_status_action should be true" do
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_owner_update_status_action]).to be true
end
it "@show_other_user_update_status_action should be false" do
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_other_user_update_status_action]).to be false
end
end
@@ -516,7 +516,7 @@ def make_request
end
it "should hide all status update options" do
- get :show, params: { :url_title => info_request.url_title }
+ get :show, params: { url_title: info_request.url_title }
expect(assigns[:show_owner_update_status_action]).to be false
expect(assigns[:show_other_user_update_status_action]).to be false
end
@@ -635,7 +635,7 @@ def expect_hidden(hidden_template)
it "should return matching bodies" do
sign_in @user
- get :select_authority, params: { :query => "Quango" }
+ get :select_authority, params: { query: "Quango" }
expect(response).to render_template('select_authority')
assigns[:xapian_requests].results.size == 1
@@ -726,19 +726,19 @@ def expect_hidden(hidden_template)
it "should redirect to front page if no public body specified" do
get :new
- expect(response).to redirect_to(:controller => 'general', :action => 'frontpage')
+ expect(response).to redirect_to(controller: 'general', action: 'frontpage')
end
it "should redirect to front page if no public body specified, when logged in" do
sign_in @user
get :new
- expect(response).to redirect_to(:controller => 'general', :action => 'frontpage')
+ expect(response).to redirect_to(controller: 'general', action: 'frontpage')
end
it "should redirect 'bad request' page when a body has no email address" do
@body.request_email = ""
@body.save!
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(response).to render_template('new_bad_contact')
end
@@ -748,13 +748,13 @@ def expect_hidden(hidden_template)
it "displays a flash error message without escaping the HTML" do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Test Request"
+ info_request: {
+ public_body_id: @body.id,
+ title: "Test Request"
},
- :outgoing_message => { :body => "me@here.com" },
- :submitted_new_request => 1,
- :preview => 1
+ outgoing_message: { body: "me@here.com" },
+ submitted_new_request: 1,
+ preview: 1
}
expect(response.body).to have_css('div#error p')
@@ -770,12 +770,12 @@ def expect_hidden(hidden_template)
it "displays a flash error message without escaping the HTML" do
sign_in @user
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Test Request" },
- :outgoing_message => { :body => "me@here.com" },
- :submitted_new_request => 1,
- :preview => 1
+ info_request: {
+ public_body_id: @body.id,
+ title: "Test Request" },
+ outgoing_message: { body: "me@here.com" },
+ submitted_new_request: 1,
+ preview: 1
}
expect(response.body).to have_css('div#error p')
@@ -792,13 +792,13 @@ def expect_hidden(hidden_template)
it 'displays an error message warning about the postcode' do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Test Request"
+ info_request: {
+ public_body_id: @body.id,
+ title: "Test Request"
},
- :outgoing_message => { :body => "SW1A 1AA" },
- :submitted_new_request => 1,
- :preview => 1
+ outgoing_message: { body: "SW1A 1AA" },
+ submitted_new_request: 1,
+ preview: 1
}
expect(response.body).to have_content('Your request contains a postcode')
@@ -836,7 +836,7 @@ def send_request
pro_user = FactoryBot.create(:pro_user)
public_body = FactoryBot.create(:public_body)
sign_in pro_user
- get :new, params: { :url_name => public_body.url_name }
+ get :new, params: { url_name: public_body.url_name }
expected_url = new_alaveteli_pro_info_request_url(
public_body: public_body.url_name)
expect(response).to redirect_to(expected_url)
@@ -844,13 +844,13 @@ def send_request
end
it "should accept a public body parameter" do
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(assigns[:info_request].public_body).to eq(@body)
expect(response).to render_template('new')
end
it 'assigns a default text for the request' do
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(assigns[:info_request].public_body).to eq(@body)
expect(response).to render_template('new')
default_message = <<-EOF.strip_heredoc
@@ -862,7 +862,7 @@ def send_request
end
it 'allows the default text to be set via the default_letter param' do
- get :new, params: { :url_name => @body.url_name, :default_letter => "test" }
+ get :new, params: { url_name: @body.url_name, default_letter: "test" }
default_message = <<-EOF.strip_heredoc
Dear Geraldine Quango,
@@ -875,10 +875,10 @@ def send_request
it 'should display one meaningful error message when no message body is added' do
post :new, params: {
- :info_request => { :public_body_id => @body.id },
- :outgoing_message => { :body => "" },
- :submitted_new_request => 1,
- :preview => 1
+ info_request: { public_body_id: @body.id },
+ outgoing_message: { body: "" },
+ submitted_new_request: 1,
+ preview: 1
}
expect(assigns[:info_request].errors.full_messages).not_to include('Outgoing messages is invalid')
expect(assigns[:outgoing_message].errors.full_messages).to include('Body Please enter your letter requesting information')
@@ -887,41 +887,40 @@ def send_request
it "should give an error and render 'new' template when a summary isn't given" do
post :new,
params: {
- :info_request => { :public_body_id => @body.id },
- :outgoing_message => {
- :body =>
- "This is a silly letter. It is too short to be interesting."
+ info_request: { public_body_id: @body.id },
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 1
+ submitted_new_request: 1,
+ preview: 1
}
expect(assigns[:info_request].errors[:title]).not_to be_nil
expect(response).to render_template('new')
end
it "should redirect to sign in page when input is good and nobody is logged in" do
- params = { :info_request => { :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?", :tag_string => "" },
- :outgoing_message => { :body => "This is a silly letter. It is too short to be interesting." },
- :submitted_new_request => 1, :preview => 0
+ params = { info_request: { public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?", tag_string: "" },
+ outgoing_message: { body: "This is a silly letter. It is too short to be interesting." },
+ submitted_new_request: 1, preview: 0
}
post :new, params: params
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
# post_redirect.post_params.should == params # TODO: get this working. there's a : vs '' problem amongst others
end
it 'redirects to the frontpage if the action is sent the invalid
public_body param' do
post :new, params: {
- :info_request => {
- :public_body => @body.id,
- :title => 'Why Geraldine?',
- :tag_string => ''
+ info_request: {
+ public_body: @body.id,
+ title: 'Why Geraldine?',
+ tag_string: ''
},
- :outgoing_message => { :body => 'This is a silly letter.'},
- :submitted_new_request => 1,
- :preview => 1
+ outgoing_message: { body: 'This is a silly letter.'},
+ submitted_new_request: 1,
+ preview: 1
}
expect(response).to redirect_to frontpage_url
end
@@ -929,50 +928,50 @@ def send_request
it "should show preview when input is good" do
sign_in @user
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 1
+ submitted_new_request: 1,
+ preview: 1
}
expect(response).to render_template('preview')
end
it "should allow re-editing of a request" do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 0,
- :reedit => "Re-edit this request"
+ submitted_new_request: 1,
+ preview: 0,
+ reedit: "Re-edit this request"
}
expect(response).to render_template('new')
end
it "re-editing preserves the message body" do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 0,
- :reedit => "Re-edit this request"
+ submitted_new_request: 1,
+ preview: 0,
+ reedit: "Re-edit this request"
}
expect(assigns[:outgoing_message].body).
to include('This is a silly letter. It is too short to be interesting.')
@@ -981,19 +980,19 @@ def send_request
it "should create the request and outgoing message, and send the outgoing message by email, and redirect to request page when input is good and somebody is logged in" do
sign_in @user
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- ir_array = InfoRequest.where(:title => "Why is your quango called Geraldine?")
+ ir_array = InfoRequest.where(title: "Why is your quango called Geraldine?")
expect(ir_array.size).to eq(1)
ir = ir_array[0]
expect(ir.outgoing_messages.size).to eq(1)
@@ -1005,22 +1004,22 @@ def send_request
mail = deliveries[0]
expect(mail.body).to match(/This is a silly letter. It is too short to be interesting./)
- expect(response).to redirect_to show_request_url(:url_title => ir.url_title)
+ expect(response).to redirect_to show_request_url(url_title: ir.url_title)
end
it "sets the request_sent flash to true if successful" do
sign_in @user
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(flash[:request_sent]).to be true
@@ -1032,16 +1031,16 @@ def send_request
# We use raw_body here, so white space is the same
post :new,
params: {
- :info_request => {
- :public_body_id => info_requests(:fancy_dog_request).public_body_id,
- :title => info_requests(:fancy_dog_request).title
+ info_request: {
+ public_body_id: info_requests(:fancy_dog_request).public_body_id,
+ title: info_requests(:fancy_dog_request).title
},
- :outgoing_message => {
- :body => info_requests(:fancy_dog_request).outgoing_messages[0].raw_body
+ outgoing_message: {
+ body: info_requests(:fancy_dog_request).outgoing_messages[0].raw_body
},
- :submitted_new_request => 1,
- :preview => 0,
- :mouse_house => 1
+ submitted_new_request: 1,
+ preview: 0,
+ mouse_house: 1
}
expect(response).to render_template('new')
end
@@ -1051,34 +1050,33 @@ def send_request
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body =>
- "This is a silly letter. It is too short to be interesting."
+ outgoing_message: {
+ body: "This is a silly letter. It is too short to be interesting."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why is your quango called Geraldine?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why is your quango called Geraldine?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "This is a sensible letter. It is too long to be boring."
+ outgoing_message: {
+ body: "This is a sensible letter. It is too long to be boring."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- ir_array = InfoRequest.where(:title => "Why is your quango called Geraldine?").
+ ir_array = InfoRequest.where(title: "Why is your quango called Geraldine?").
order(:id)
expect(ir_array.size).to eq(2)
@@ -1087,7 +1085,7 @@ def send_request
expect(ir.url_title).not_to eq(ir2.url_title)
- expect(response).to redirect_to show_request_url(:url_title => ir2.url_title)
+ expect(response).to redirect_to show_request_url(url_title: ir2.url_title)
end
it 'should respect the rate limit' do
@@ -1096,48 +1094,48 @@ def send_request
sign_in users(:robin_user)
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What is the answer to the ultimate question?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What is the answer to the ultimate question?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- expect(response).to redirect_to show_request_url(:url_title => 'what_is_the_answer_to_the_ultima')
+ expect(response).to redirect_to show_request_url(url_title: 'what_is_the_answer_to_the_ultima')
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why did the chicken cross the road?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why did the chicken cross the road?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please send me all the relevant documents you hold."
+ outgoing_message: {
+ body: "Please send me all the relevant documents you hold."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- expect(response).to redirect_to show_request_url(:url_title => 'why_did_the_chicken_cross_the_ro')
+ expect(response).to redirect_to show_request_url(url_title: 'why_did_the_chicken_cross_the_ro')
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please send all minutes of meetings and email records " \
+ outgoing_message: {
+ body: "Please send all minutes of meetings and email records " \
"that address this question."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response).to render_template('user/rate_limited')
end
@@ -1150,50 +1148,50 @@ def send_request
users(:robin_user).save!
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What is the answer to the ultimate question?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What is the answer to the ultimate question?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- expect(response).to redirect_to show_request_url(:url_title => 'what_is_the_answer_to_the_ultima')
+ expect(response).to redirect_to show_request_url(url_title: 'what_is_the_answer_to_the_ultima')
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "Why did the chicken cross the road?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "Why did the chicken cross the road?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please send me all the relevant documents you hold."
+ outgoing_message: {
+ body: "Please send me all the relevant documents you hold."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- expect(response).to redirect_to show_request_url(:url_title => 'why_did_the_chicken_cross_the_ro')
+ expect(response).to redirect_to show_request_url(url_title: 'why_did_the_chicken_cross_the_ro')
post :new,
params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please send all minutes of meetings and email records " \
+ outgoing_message: {
+ body: "Please send all minutes of meetings and email records " \
"that address this question."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
- expect(response).to redirect_to show_request_url(:url_title => 'whats_black_and_white_and_red_al')
+ expect(response).to redirect_to show_request_url(url_title: 'whats_black_and_white_and_red_al')
end
describe 'when rendering a reCAPTCHA' do
@@ -1207,14 +1205,14 @@ def send_request
it 'sets render_recaptcha to false' do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => { :body => "Please send info" },
- :submitted_new_request => 1,
- :preview => 0
+ outgoing_message: { body: "Please send info" },
+ submitted_new_request: 1,
+ preview: 0
}
expect(assigns[:render_recaptcha]).to eq(false)
end
@@ -1229,46 +1227,46 @@ def send_request
it 'sets render_recaptcha to true if there is no logged in user' do
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => { :body => "Please send info" },
- :submitted_new_request => 1,
- :preview => 0
+ outgoing_message: { body: "Please send info" },
+ submitted_new_request: 1,
+ preview: 0
}
expect(assigns[:render_recaptcha]).to eq(true)
end
it 'sets render_recaptcha to true if there is a logged in user who is not
confirmed as not spam' do
- sign_in FactoryBot.create(:user, :confirmed_not_spam => false)
+ sign_in FactoryBot.create(:user, confirmed_not_spam: false)
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => { :body => "Please send info" },
- :submitted_new_request => 1,
- :preview => 0
+ outgoing_message: { body: "Please send info" },
+ submitted_new_request: 1,
+ preview: 0
}
expect(assigns[:render_recaptcha]).to eq(true)
end
it 'sets render_recaptcha to false if there is a logged in user who is
confirmed as not spam' do
- sign_in FactoryBot.create(:user, :confirmed_not_spam => true)
+ sign_in FactoryBot.create(:user, confirmed_not_spam: true)
post :new, params: {
- :info_request => {
- :public_body_id => @body.id,
- :title => "What's black and white and red all over?",
- :tag_string => ""
+ info_request: {
+ public_body_id: @body.id,
+ title: "What's black and white and red all over?",
+ tag_string: ""
},
- :outgoing_message => { :body => "Please send info" },
- :submitted_new_request => 1,
- :preview => 0
+ outgoing_message: { body: "Please send info" },
+ submitted_new_request: 1,
+ preview: 0
}
expect(assigns[:render_recaptcha]).to eq(false)
end
@@ -1280,22 +1278,22 @@ def send_request
end
let(:user) { FactoryBot.create(:user,
- :confirmed_not_spam => false) }
+ confirmed_not_spam: false) }
let(:body) { FactoryBot.create(:public_body) }
it 'shows an error message' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request text",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request text",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(flash[:error])
.to eq('There was an error with the reCAPTCHA. Please try again.')
@@ -1304,16 +1302,16 @@ def send_request
it 'renders the compose interface' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request text",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request text",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response).to render_template("new")
end
@@ -1323,19 +1321,19 @@ def send_request
user.save!
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request text",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request text",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response)
- .to redirect_to show_request_path(:url_title => 'some_request_text')
+ .to redirect_to show_request_path(url_title: 'some_request_text')
end
end
@@ -1347,7 +1345,7 @@ def send_request
context 'when the request subject line looks like spam' do
let(:user) { FactoryBot.create(:user,
- :confirmed_not_spam => false) }
+ confirmed_not_spam: false) }
let(:body) { FactoryBot.create(:public_body) }
@@ -1359,16 +1357,16 @@ def send_request
sign_in user
title = "▩█ -Free Ɓrazzers Password Hăck Premium Account List 2017 ᒬᒬ"
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => title,
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: title,
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer."
+ outgoing_message: {
+ body: "Please supply the answer."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/Spam request from user #{ user.id }/)
@@ -1389,16 +1387,16 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer."
+ outgoing_message: {
+ body: "Please supply the answer."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/Spam request from user #{ user.id }/)
@@ -1416,16 +1414,16 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/Spam request from user #{ user.id }/)
@@ -1435,16 +1433,16 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(flash[:error])
.to eq("Sorry, we're currently unable to send your request. Please try again later.")
@@ -1454,16 +1452,16 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response).to render_template("new")
end
@@ -1474,19 +1472,19 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response)
- .to redirect_to show_request_path(:url_title => 'hd_watch_jason_bourne_online_fre')
+ .to redirect_to show_request_path(url_title: 'hd_watch_jason_bourne_online_fre')
end
end
@@ -1501,16 +1499,16 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).to match(/Spam request from user #{ user.id }/)
@@ -1520,19 +1518,19 @@ def send_request
sign_in user
post :new,
params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "[HD] Watch Jason Bourne Online free MOVIE Full-HD",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response)
- .to redirect_to show_request_path(:url_title => 'hd_watch_jason_bourne_online_fre')
+ .to redirect_to show_request_path(url_title: 'hd_watch_jason_bourne_online_fre')
end
end
@@ -1542,7 +1540,7 @@ def send_request
describe 'when the request is from an IP address in a blocked country' do
let(:user) { FactoryBot.create(:user,
- :confirmed_not_spam => false) }
+ confirmed_not_spam: false) }
let(:body) { FactoryBot.create(:public_body) }
before do
@@ -1560,16 +1558,16 @@ def send_request
it 'sends an exception notification' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).
@@ -1579,16 +1577,16 @@ def send_request
it 'shows an error message' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(flash[:error])
.to eq("Sorry, we're currently unable to send your request. Please try again later.")
@@ -1597,16 +1595,16 @@ def send_request
it 'renders the compose interface' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response).to render_template("new")
end
@@ -1616,19 +1614,19 @@ def send_request
user.save!
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response)
- .to redirect_to show_request_path(:url_title => 'some_request_content')
+ .to redirect_to show_request_path(url_title: 'some_request_content')
end
end
@@ -1643,16 +1641,16 @@ def send_request
it 'sends an exception notification' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
mail = ActionMailer::Base.deliveries.first
expect(mail.subject).
@@ -1662,19 +1660,19 @@ def send_request
it 'allows the request' do
sign_in user
post :new, params: {
- :info_request => {
- :public_body_id => body.id,
- :title => "Some request content",
- :tag_string => ""
+ info_request: {
+ public_body_id: body.id,
+ title: "Some request content",
+ tag_string: ""
},
- :outgoing_message => {
- :body => "Please supply the answer from your files."
+ outgoing_message: {
+ body: "Please supply the answer from your files."
},
- :submitted_new_request => 1,
- :preview => 0
+ submitted_new_request: 1,
+ preview: 0
}
expect(response)
- .to redirect_to show_request_path(:url_title => 'some_request_content')
+ .to redirect_to show_request_path(url_title: 'some_request_content')
end
end
@@ -1695,20 +1693,20 @@ def send_request
allow(@user).to receive(:login_token).and_return('abc')
allow(User).to receive(:find_by).with(id: @user.id, login_token: 'abc').
and_return(@user)
- @body = FactoryBot.create(:public_body, :name => 'Test Quango')
+ @body = FactoryBot.create(:public_body, name: 'Test Quango')
end
it "should allow you to have one undescribed request" do
allow(@user).to receive(:get_undescribed_requests).and_return([ 1 ])
sign_in @user
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(response).to render_template('new')
end
it "should fail if more than one request undescribed" do
allow(@user).to receive(:get_undescribed_requests).and_return([ 1, 2 ])
sign_in @user
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(response).to render_template('new_please_describe')
end
@@ -1718,7 +1716,7 @@ def send_request
to receive(:exceeded_limit?).with(:info_requests).and_return(false)
expect(@user).to receive(:can_fail_html).and_return('FAIL!')
sign_in @user
- get :new, params: { :public_body_id => @body.id }
+ get :new, params: { public_body_id: @body.id }
expect(response).to render_template('user/banned')
end
@@ -1732,7 +1730,7 @@ def send_request
it "should link to the user who submitted it" do
sign_in users(:bob_smith_user)
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
expect(s).to contain /Silly.*left an annotation/m
expect(s).not_to contain /You.*left an annotation/m
@@ -1741,7 +1739,7 @@ def send_request
it "should link to the user who submitted to it, even if it is you" do
sign_in users(:silly_name_user)
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
expect(s).to contain /Silly.*left an annotation/m
expect(s).not_to contain /You.*left an annotation/m
@@ -1756,12 +1754,12 @@ def send_request
before(:each) do
# domain after the @ is used for authentication of FOI officers, so to test it
# we need a user which isn't at localhost.
- @normal_user = User.new(:name => "Mr. Normal", :email => "normal-user@flourish.org",
- :password => PostRedirect.generate_random_token)
+ @normal_user = User.new(name: "Mr. Normal", email: "normal-user@flourish.org",
+ password: PostRedirect.generate_random_token)
@normal_user.save!
- @foi_officer_user = User.new(:name => "The Geraldine Quango", :email => "geraldine-requests@localhost",
- :password => PostRedirect.generate_random_token)
+ @foi_officer_user = User.new(name: "The Geraldine Quango", email: "geraldine-requests@localhost",
+ password: PostRedirect.generate_random_token)
@foi_officer_user.save!
end
@@ -1770,7 +1768,7 @@ def send_request
it 'raises an ActiveRecord::RecordNotFound error' do
expect {
- get :upload_response, params: { :url_title => embargoed_request.url_title }
+ get :upload_response, params: { url_title: embargoed_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -1790,7 +1788,7 @@ def send_request
expect(@ir.public_body.is_foi_officer?(@normal_user)).to eq(false)
sign_in @normal_user
- get :upload_response, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :upload_response, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response).to render_template('user/wrong_user')
end
@@ -1799,7 +1797,7 @@ def send_request
expect(@ir.public_body.is_foi_officer?(@foi_officer_user)).to eq(true)
sign_in @foi_officer_user
- get :upload_response, params: { :url_title => 'why_do_you_have_such_a_fancy_dog' }
+ get :upload_response, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response).to render_template('request/upload_response')
end
@@ -1811,10 +1809,10 @@ def send_request
# post up a photo of the parrot
parrot_upload = fixture_file_upload('parrot.png', 'image/png')
post :upload_response, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :body => "Find attached a picture of a parrot",
- :file_1 => parrot_upload,
- :submitted_upload_response => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ body: "Find attached a picture of a parrot",
+ file_1: parrot_upload,
+ submitted_upload_response: 1
}
expect(response).to render_template('user/wrong_user')
end
@@ -1822,14 +1820,14 @@ def send_request
it "should prevent entirely blank uploads" do
sign_in @foi_officer_user
- post :upload_response, params: { :url_title => 'why_do_you_have_such_a_fancy_dog', :body => "", :submitted_upload_response => 1 }
+ post :upload_response, params: { url_title: 'why_do_you_have_such_a_fancy_dog', body: "", submitted_upload_response: 1 }
expect(response).to render_template('request/upload_response')
expect(flash[:error]).to match(/Please type a message/)
end
it 'should 404 for non existent requests' do
expect {
- post :upload_response, params: { :url_title => 'i_dont_exist' }
+ post :upload_response, params: { url_title: 'i_dont_exist' }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -1843,13 +1841,13 @@ def send_request
# post up a photo of the parrot
parrot_upload = fixture_file_upload('parrot.png', 'image/png')
post :upload_response, params: {
- :url_title => 'why_do_you_have_such_a_fancy_dog',
- :body => "Find attached a picture of a parrot",
- :file_1 => parrot_upload,
- :submitted_upload_response => 1
+ url_title: 'why_do_you_have_such_a_fancy_dog',
+ body: "Find attached a picture of a parrot",
+ file_1: parrot_upload,
+ submitted_upload_response: 1
}
- expect(response).to redirect_to(:action => 'show', :url_title => 'why_do_you_have_such_a_fancy_dog')
+ expect(response).to redirect_to(action: 'show', url_title: 'why_do_you_have_such_a_fancy_dog')
expect(flash[:notice]).to match(/Thank you for responding to this FOI request/)
# check there is a new attachment
@@ -1873,7 +1871,7 @@ def send_request
end
it "should return data in JSON form" do
- get :show, params: { :url_title => 'why_do_you_have_such_a_fancy_dog', :format => 'json' }
+ get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog', format: 'json' }
ir = JSON.parse(response.body)
expect(ir.class.to_s).to eq('Hash')
@@ -1892,17 +1890,17 @@ def send_request
end
it 'can filter search results by public body' do
- get :search_typeahead, params: { :q => 'boring', :requested_from => 'dfh' }
+ get :search_typeahead, params: { q: 'boring', requested_from: 'dfh' }
expect(assigns[:query]).to eq('requested_from:dfh boring')
end
it 'defaults to 25 results per page' do
- get :search_typeahead, params: { :q => 'boring' }
+ get :search_typeahead, params: { q: 'boring' }
expect(assigns[:per_page]).to eq(25)
end
it 'can limit the number of searches returned' do
- get :search_typeahead, params: { :q => 'boring', :per_page => '1' }
+ get :search_typeahead, params: { q: 'boring', per_page: '1' }
expect(assigns[:per_page]).to eq(1)
expect(assigns[:xapian_requests].results.size).to eq(1)
end
@@ -1920,20 +1918,20 @@ def send_request
it "renders the 'similar' template" do
get :similar, params: {
- :url_title => info_requests(:badger_request).url_title
+ url_title: info_requests(:badger_request).url_title
}
expect(response).to render_template("request/similar")
end
it 'assigns the request' do
get :similar, params: {
- :url_title => info_requests(:badger_request).url_title
+ url_title: info_requests(:badger_request).url_title
}
expect(assigns[:info_request]).to eq(info_requests(:badger_request))
end
it "assigns a xapian object with similar requests" do
- get :similar, params: { :url_title => badger_request.url_title }
+ get :similar, params: { url_title: badger_request.url_title }
# Xapian seems to think *all* the requests are similar
results = assigns[:xapian_object].results
@@ -1945,7 +1943,7 @@ def send_request
it "raises ActiveRecord::RecordNotFound for non-existent paths" do
expect {
get :similar, params: {
- :url_title => "there_is_really_no_such_path_owNAFkHR"
+ url_title: "there_is_really_no_such_path_owNAFkHR"
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -1954,16 +1952,16 @@ def send_request
page we want to show" do
expect {
get :similar, params: {
- :url_title => badger_request.url_title,
- :page => 100
+ url_title: badger_request.url_title,
+ page: 100
}
}.to raise_error(ActiveRecord::RecordNotFound)
end
it 'raises ActiveRecord::RecordNotFound if the request is embargoed' do
- badger_request.create_embargo(:publish_at => Time.zone.now + 3.days)
+ badger_request.create_embargo(publish_at: Time.zone.now + 3.days)
expect {
- get :similar, params: { :url_title => badger_request.url_title }
+ get :similar, params: { url_title: badger_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -2004,17 +2002,17 @@ def send_request
let(:info_request) { FactoryBot.create(:info_request) }
it 'renders the details template' do
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
expect(response).to render_template('details')
end
it 'assigns the info_request' do
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
expect(assigns[:info_request]).to eq(info_request)
end
it 'assigns columns' do
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
expected_columns = ['id',
'event_type',
'created_at',
@@ -2032,12 +2030,12 @@ def send_request
end
it 'returns a 403' do
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
expect(response.code).to eq("403")
end
it 'shows the hidden request template' do
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
expect(response).to render_template("request/hidden")
end
@@ -2046,12 +2044,12 @@ def send_request
context 'when the request is embargoed' do
before do
- info_request.create_embargo(:publish_at => Time.zone.now + 3.days)
+ info_request.create_embargo(publish_at: Time.zone.now + 3.days)
end
it 'raises an ActiveRecord::RecordNotFound error' do
expect {
- get :details, params: { :url_title => info_request.url_title }
+ get :details, params: { url_title: info_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -2075,7 +2073,7 @@ def send_request
it 'raises ActiveRecord::RecordNotFound' do
expect {
get :download_entire_request,
- params: { :url_title => info_request.url_title }
+ params: { url_title: info_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -2088,7 +2086,7 @@ def send_request
it 'raises ActiveRecord::RecordNotFound' do
expect {
get :download_entire_request,
- params: { :url_title => info_request.url_title }
+ params: { url_title: info_request.url_title }
}.to raise_error(ActiveRecord::RecordNotFound)
end
end
@@ -2100,7 +2098,7 @@ def send_request
it 'allows the download' do
get :download_entire_request,
- params: { :url_title => info_request.url_title }
+ params: { url_title: info_request.url_title }
expect(response).to be_successful
end
end
@@ -2110,10 +2108,10 @@ def send_request
it 'does not render the describe state form' do
info_request = FactoryBot.create(:info_request)
- info_request.update(:awaiting_description => true)
+ info_request.update(awaiting_description: true)
info_request.expire
sign_in info_request.user
- get :download_entire_request, params: { :url_title => info_request.url_title }
+ get :download_entire_request, params: { url_title: info_request.url_title }
expect(assigns[:show_top_describe_state_form]).to eq(false)
expect(assigns[:show_bottom_describe_state_form]).to eq(false)
expect(assigns[:show_owner_update_status_action]).to eq(false)
@@ -2133,20 +2131,20 @@ def send_request
let(:event) { FactoryBot.create(:response_event) }
it 'returns a 301 status' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response.status).to eq(301)
end
it 'redirects to the incoming message path' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response)
.to redirect_to(incoming_message_path(event.incoming_message))
end
it 'raises ActiveRecord::RecordNotFound when the request is embargoed' do
- event.info_request.create_embargo(:publish_at => Time.zone.now + 1.day)
+ event.info_request.create_embargo(publish_at: Time.zone.now + 1.day)
expect {
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
@@ -2155,20 +2153,20 @@ def send_request
let(:event) { FactoryBot.create(:sent_event) }
it 'returns a 301 status' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response.status).to eq(301)
end
it 'redirects to the outgoing message path' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response)
.to redirect_to(outgoing_message_path(event.outgoing_message))
end
it 'raises ActiveRecord::RecordNotFound when the request is embargoed' do
- event.info_request.create_embargo(:publish_at => Time.zone.now + 1.day)
+ event.info_request.create_embargo(publish_at: Time.zone.now + 1.day)
expect {
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
@@ -2177,20 +2175,20 @@ def send_request
let(:event) { FactoryBot.create(:info_request_event) }
it 'returns a 301 status' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response.status).to eq(301)
end
it 'redirects to the request path' do
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
expect(response)
.to redirect_to(show_request_path(event.info_request.url_title))
end
it 'raises ActiveRecord::RecordNotFound when the request is embargoed' do
- event.info_request.create_embargo(:publish_at => Time.zone.now + 1.day)
+ event.info_request.create_embargo(publish_at: Time.zone.now + 1.day)
expect {
- get :show_request_event, params: { :info_request_event_id => event.id }
+ get :show_request_event, params: { info_request_event_id: event.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
diff --git a/spec/controllers/request_game_controller_spec.rb b/spec/controllers/request_game_controller_spec.rb
index 78596a1464..1c1a0862ee 100644
--- a/spec/controllers/request_game_controller_spec.rb
+++ b/spec/controllers/request_game_controller_spec.rb
@@ -48,7 +48,7 @@
render_views
- let(:test_url) { help_credits_path(:anchor => "helpus") }
+ let(:test_url) { help_credits_path(anchor: "helpus") }
it 'shows the game homepage' do
get :play
@@ -60,8 +60,8 @@
expect(flash.now[:notice][:partial]).
to eq("request_game/game_over")
expect(flash.now[:notice][:locals]).to include({
- :helpus_url => test_url,
- :site_name => site_name
+ helpus_url: test_url,
+ site_name: site_name
})
end
@@ -71,7 +71,7 @@
expect(response.body).
to have_content('All done! Thank you very much for your help')
expect(response.body).
- to have_link('more things you can do', :href => test_url)
+ to have_link('more things you can do', href: test_url)
end
end
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb
index 0c39f60594..852ca06725 100644
--- a/spec/controllers/services_controller_spec.rb
+++ b/spec/controllers/services_controller_spec.rb
@@ -19,7 +19,7 @@
it 'keeps the flash' do
# Make two get requests to simulate the flash getting swept after the
# first response.
- get :other_country_message, flash: { :some_flash_key => 'abc' }
+ get :other_country_message, flash: { some_flash_key: 'abc' }
get :other_country_message
expect(flash[:some_flash_key]).to eq('abc')
end
diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb
index 08efeb21b6..8b0d3ef145 100644
--- a/spec/controllers/track_controller_spec.rb
+++ b/spec/controllers/track_controller_spec.rb
@@ -6,44 +6,44 @@
describe 'GET #track_request' do
let(:info_request) do
FactoryBot.create(:info_request,
- :title => 'My request',
- :url_title => 'myrequest')
+ title: 'My request',
+ url_title: 'myrequest')
end
let(:track_thing) do
FactoryBot.create(:request_update_track,
- :info_request => info_request,
- :track_medium => 'email_daily',
- :track_query => 'example')
+ info_request: info_request,
+ track_medium: 'email_daily',
+ track_query: 'example')
end
- let(:user) { FactoryBot.create(:user, :locale => 'en', :name => 'bob') }
+ let(:user) { FactoryBot.create(:user, locale: 'en', name: 'bob') }
it 'clears widget votes for the request' do
allow(AlaveteliConfiguration).to receive(:enable_widgets).and_return(true)
- info_request.widget_votes.create(:cookie => mock_cookie)
+ info_request.widget_votes.create(cookie: mock_cookie)
sign_in user
request.cookies['widget_vote'] = mock_cookie
get :track_request, params: {
- :url_title => info_request.url_title,
- :feed => 'track'
+ url_title: info_request.url_title,
+ feed: 'track'
}
expect(info_request.reload.widget_votes).to be_empty
end
it "should require login when making new track" do
get :track_request, params: {
- :url_title => info_request.url_title,
- :feed => 'track'
+ url_title: info_request.url_title,
+ feed: 'track'
}
expect(response)
- .to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ .to redirect_to(signin_path(token: get_last_post_redirect.token))
end
it "should set no-cache headers on the login redirect" do
get :track_request, params: {
- :url_title => info_request.url_title,
- :feed => 'track'
+ url_title: info_request.url_title,
+ feed: 'track'
}
expect(response.headers["Cache-Control"]).
to eq('private, no-store')
@@ -56,19 +56,19 @@
allow(TrackThing).to receive(:create_track_for_request).and_return(track_thing)
expect(track_thing).to receive(:save).and_call_original
get :track_request, params: {
- :url_title => info_request.url_title,
- :feed => 'track'
+ url_title: info_request.url_title,
+ feed: 'track'
}
- expect(response).to redirect_to(:controller => 'request',
- :action => 'show',
- :url_title => info_request.url_title)
+ expect(response).to redirect_to(controller: 'request',
+ action: 'show',
+ url_title: info_request.url_title)
end
it "should 404 for non-existent requests" do
sign_in user
expect {
- get :track_request, params: { :url_title => "hjksfdh_louytu_qqxxx",
- :feed => 'track' }
+ get :track_request, params: { url_title: "hjksfdh_louytu_qqxxx",
+ feed: 'track' }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -76,8 +76,8 @@
sign_in user
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- get :track_request, params: { :url_title => embargoed_request.url_title,
- :feed => 'track' }
+ get :track_request, params: { url_title: embargoed_request.url_title,
+ feed: 'track' }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -93,8 +93,8 @@
track_thing = track_things(:track_fancy_dog_request)
get :track_request, params: {
- :feed => 'feed',
- :url_title => track_thing.info_request.url_title
+ feed: 'feed',
+ url_title: track_thing.info_request.url_title
}
expect(response).to render_template('track/atom_feed')
expect(response.media_type).to eq('application/atom+xml')
@@ -114,9 +114,9 @@
track_thing = track_things(:track_fancy_dog_request)
get :track_request, params: {
- :feed => 'feed',
- :url_title => track_thing.info_request.url_title,
- :format => "json"
+ feed: 'feed',
+ url_title: track_thing.info_request.url_title,
+ format: "json"
}
a = JSON.parse(response.body)
@@ -155,8 +155,8 @@
request.env['HTTP_ACCEPT'] = 'application/json,text/xml'
track_thing = FactoryBot.create(:request_update_track)
get :track_request, params: {
- :feed => 'feed',
- :url_title => track_thing.info_request.url_title
+ feed: 'feed',
+ url_title: track_thing.info_request.url_title
}
expect(response).to render_template('track/atom_feed')
expect(response.media_type).to eq('application/atom+xml')
@@ -168,36 +168,36 @@
describe "GET #track_search_query" do
let(:track_thing) do
FactoryBot.create(:search_track,
- :track_medium => 'email_daily',
- :track_query => 'example')
+ track_medium: 'email_daily',
+ track_query: 'example')
end
- let(:user) { FactoryBot.create(:user, :locale => 'en', :name => 'bob') }
+ let(:user) { FactoryBot.create(:user, locale: 'en', name: 'bob') }
it "should save a search track and redirect to the right place" do
sign_in user
allow(TrackThing).to receive(:create_track_for_search_query).and_return(track_thing)
expect(track_thing).to receive(:save).and_call_original
- get :track_search_query, params: { :query_array => "bob variety:sent",
- :feed => 'track' }
- expect(response).to redirect_to(:controller => 'general', :action => 'search',
- :combined => ["bob", "requests"])
+ get :track_search_query, params: { query_array: "bob variety:sent",
+ feed: 'track' }
+ expect(response).to redirect_to(controller: 'general', action: 'search',
+ combined: ["bob", "requests"])
end
it 'sets the flash message partial for a successful track' do
sign_in user
get :track_search_query, params: {
- :query_array => 'bob variety:sent',
- :feed => 'track'
+ query_array: 'bob variety:sent',
+ feed: 'track'
}
expected = {
- :partial => 'track/track_set',
- :locals => {
- :user_receive_email_alerts => true,
- :user_url_name => user.url_name,
- :track_thing_id => TrackThing.last.id } }
+ partial: 'track/track_set',
+ locals: {
+ user_receive_email_alerts: true,
+ user_url_name: user.url_name,
+ track_thing_id: TrackThing.last.id } }
expect(flash[:notice]).to eq(expected)
end
@@ -207,41 +207,41 @@
existing =
FactoryBot.create(:search_track,
- :tracking_user => user,
- :track_medium => 'email_daily',
- :track_query => 'bob variety:sent')
+ tracking_user: user,
+ track_medium: 'email_daily',
+ track_query: 'bob variety:sent')
get :track_search_query, params: {
- :query_array => 'bob variety:sent',
- :feed => 'track'
+ query_array: 'bob variety:sent',
+ feed: 'track'
}
expected = {
- :partial => 'track/already_tracking',
- :locals => { :track_thing_id => existing.id }
+ partial: 'track/already_tracking',
+ locals: { track_thing_id: existing.id }
}
expect(flash[:notice]).to eq(expected)
end
it "should redirect with an error message if the query is too long" do
- long_track = TrackThing.new(:track_type => 'search_query',
- :track_query => "lorem ipsum " * 42)
+ long_track = TrackThing.new(track_type: 'search_query',
+ track_query: "lorem ipsum " * 42)
sign_in user
allow(TrackThing).to receive(:create_track_for_search_query).and_return(long_track)
get :track_search_query, params: {
- :query_array => "bob variety:sent",
- :feed => 'track'
+ query_array: "bob variety:sent",
+ feed: 'track'
}
expect(flash[:error]).to match('too long')
- expect(response).to redirect_to(:controller => 'general', :action => 'search',
- :combined => ["bob", "requests"])
+ expect(response).to redirect_to(controller: 'general', action: 'search',
+ combined: ["bob", "requests"])
end
end
describe "GET #track_public_body" do
let(:public_body) { FactoryBot.create(:public_body) }
- let(:user) { FactoryBot.create(:user, :locale => 'en', :name => 'bob') }
+ let(:user) { FactoryBot.create(:user, locale: 'en', name: 'bob') }
before do
# these tests depend on the xapian index existing, although
@@ -252,28 +252,28 @@
it "should save a search track and redirect to the right place" do
sign_in user
- track_thing = TrackThing.new(:track_type => 'public_body_updates',
- :public_body => public_body)
+ track_thing = TrackThing.new(track_type: 'public_body_updates',
+ public_body: public_body)
allow(TrackThing).to receive(:create_track_for_public_body).and_return(track_thing)
expect(track_thing).to receive(:save).and_call_original
get :track_public_body, params: {
- :url_name => public_body.url_name,
- :feed => 'track',
- :event_type => 'sent'
+ url_name: public_body.url_name,
+ feed: 'track',
+ event_type: 'sent'
}
expect(response).to redirect_to("/body/#{public_body.url_name}")
end
it "should redirect with an error message if the query is too long" do
sign_in user
- long_track = TrackThing.new(:track_type => 'public_body_updates',
- :public_body => public_body,
- :track_query => "lorem ipsum " * 42)
+ long_track = TrackThing.new(track_type: 'public_body_updates',
+ public_body: public_body,
+ track_query: "lorem ipsum " * 42)
allow(TrackThing).to receive(:create_track_for_public_body).and_return(long_track)
get :track_public_body, params: {
- :url_name => public_body.url_name,
- :feed => 'track',
- :event_type => 'sent'
+ url_name: public_body.url_name,
+ feed: 'track',
+ event_type: 'sent'
}
expect(flash[:error]).to match('too long')
expect(response).to redirect_to("/body/#{public_body.url_name}")
@@ -281,8 +281,8 @@
it "should work" do
get :track_public_body, params: {
- :feed => 'feed',
- :url_name => public_body.url_name
+ feed: 'feed',
+ url_name: public_body.url_name
}
expect(response).to be_successful
expect(response).to render_template('track/atom_feed')
@@ -294,9 +294,9 @@
it "should filter by event type" do
get :track_public_body, params: {
- :feed => 'feed',
- :url_name => public_body.url_name,
- :event_type => 'sent'
+ feed: 'feed',
+ url_name: public_body.url_name,
+ event_type: 'sent'
}
expect(response).to be_successful
expect(response).to render_template('track/atom_feed')
@@ -315,32 +315,32 @@
it "should save a user track and redirect to the right place" do
sign_in user
- track_thing = TrackThing.new(:track_type => 'user_updates',
- :tracked_user => target_user,
- :track_query => "requested_by:#{target_user.url_name}")
+ track_thing = TrackThing.new(track_type: 'user_updates',
+ tracked_user: target_user,
+ track_query: "requested_by:#{target_user.url_name}")
allow(TrackThing).to receive(:create_track_for_user).and_return(track_thing)
expect(track_thing).to receive(:save).and_call_original
- get :track_user, params: { :url_name => target_user.url_name,
- :feed => 'track' }
+ get :track_user, params: { url_name: target_user.url_name,
+ feed: 'track' }
expect(response).to redirect_to("/user/#{target_user.url_name}")
end
it "should redirect with an error message if the query is too long" do
sign_in user
- long_track = TrackThing.new(:track_type => 'user_updates',
- :tracked_user => target_user,
- :track_query => "lorem ipsum " * 42)
+ long_track = TrackThing.new(track_type: 'user_updates',
+ tracked_user: target_user,
+ track_query: "lorem ipsum " * 42)
allow(TrackThing).to receive(:create_track_for_user).and_return(long_track)
- get :track_user, params: { :url_name => target_user.url_name,
- :feed => 'track' }
+ get :track_user, params: { url_name: target_user.url_name,
+ feed: 'track' }
expect(flash[:error]).to match('too long')
expect(response).to redirect_to("/user/#{target_user.url_name}")
end
it "should return NotFound for a non-existent user" do
expect {
- get :track_user, params: { :feed => 'feed',
- :url_name => "there_is_no_such_user" }
+ get :track_user, params: { feed: 'feed',
+ url_name: "there_is_no_such_user" }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -351,22 +351,22 @@
it "should save a list track and redirect to the right place" do
sign_in user
- track_thing = TrackThing.new(:track_type => 'all_new_requests',
- :track_query => "variety:sent")
+ track_thing = TrackThing.new(track_type: 'all_new_requests',
+ track_query: "variety:sent")
allow(TrackThing).to receive(:create_track_for_all_new_requests).
and_return(track_thing)
expect(track_thing).to receive(:save).and_call_original
- get :track_list, params: { :view => 'recent', :feed => 'track' }
+ get :track_list, params: { view: 'recent', feed: 'track' }
expect(response).to redirect_to("/list?view=recent")
end
it "should redirect with an error message if the query is too long" do
sign_in user
- long_track = TrackThing.new(:track_type => 'all_new_requests',
- :track_query => "lorem ipsum " * 42)
+ long_track = TrackThing.new(track_type: 'all_new_requests',
+ track_query: "lorem ipsum " * 42)
allow(TrackThing).to receive(:create_track_for_all_new_requests).
and_return(long_track)
- get :track_list, params: { :view => 'recent', :feed => 'track' }
+ get :track_list, params: { view: 'recent', feed: 'track' }
expect(flash[:error]).to match('too long')
expect(response).to redirect_to("/list?view=recent")
end
@@ -446,11 +446,11 @@
it 'redirects to the signin page' do
post :delete_all_type, params: {
- :user => track_thing.tracking_user.id,
- :track_type => 'search_query'
+ user: track_thing.tracking_user.id,
+ track_type: 'search_query'
}
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
end
end
@@ -460,19 +460,19 @@
it 'deletes all tracks for the user of the type passed in the params' do
sign_in track_thing.tracking_user
post :delete_all_type, params: {
- :user => track_thing.tracking_user.id,
- :track_type => 'search_query',
- :r => '/'
+ user: track_thing.tracking_user.id,
+ track_type: 'search_query',
+ r: '/'
}
- expect(TrackThing.where(:id => track_thing.id)).to be_empty
+ expect(TrackThing.where(id: track_thing.id)).to be_empty
end
it 'redirects to the redirect path in the param passed' do
sign_in track_thing.tracking_user
post :delete_all_type, params: {
- :user => track_thing.tracking_user.id,
- :track_type => 'search_query',
- :r => '/'
+ user: track_thing.tracking_user.id,
+ track_type: 'search_query',
+ r: '/'
}
expect(response).to redirect_to('/')
end
@@ -480,9 +480,9 @@
it 'shows a message telling the user what has happened' do
sign_in track_thing.tracking_user
post :delete_all_type, params: {
- :user => track_thing.tracking_user.id,
- :track_type => 'search_query',
- :r => '/'
+ user: track_thing.tracking_user.id,
+ track_type: 'search_query',
+ r: '/'
}
expect(flash[:notice]).to eq("You will no longer be emailed updates for those alerts")
end
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 5023f09c37..aa33b6b755 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -7,7 +7,7 @@
let(:user) { FactoryBot.create(:user) }
it 'renders the show template' do
- get :show, params: { :url_name => user.url_name }
+ get :show, params: { url_name: user.url_name }
expect(response).to render_template(:show)
end
@@ -666,15 +666,15 @@ def make_request
context 'user is banned' do
before(:each) do
- @user = FactoryBot.create(:user, :ban_text => 'Causing trouble')
+ @user = FactoryBot.create(:user, ban_text: 'Causing trouble')
sign_in @user
@uploadedfile = fixture_file_upload("parrot.png")
post :set_profile_photo, params: {
- :id => @user.id,
- :file => @uploadedfile,
- :submitted_draft_profile_photo => 1,
- :automatically_crop => 1
+ id: @user.id,
+ file: @uploadedfile,
+ submitted_draft_profile_photo: 1,
+ automatically_crop: 1
}
end
@@ -701,11 +701,11 @@ def make_request
it "should be an error if you type the password differently each time" do
post :signup, params: {
- :user_signup => {
- :email => 'new@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypasswordtwo'
+ user_signup: {
+ email: 'new@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypasswordtwo'
}
}
expect(assigns[:user_signup].errors[:password_confirmation]).
@@ -714,11 +714,11 @@ def make_request
it "should be an error to sign up with a misformatted email" do
post :signup, params: {
- :user_signup => {
- :email => 'malformed-email',
- :name => 'Mr Malformed',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'malformed-email',
+ name: 'Mr Malformed',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(assigns[:user_signup].errors[:email]).
@@ -726,14 +726,14 @@ def make_request
end
it "should not show the 'already in use' error when trying to sign up with a duplicate email" do
- existing_user = FactoryBot.create(:user, :email => 'in-use@localhost')
+ existing_user = FactoryBot.create(:user, email: 'in-use@localhost')
post :signup, params: {
- :user_signup => {
- :email => 'in-use@localhost',
- :name => 'Mr Suspected-Hacker',
- :password => 'sillypassword',
- :password_confirmation => 'mistyped'
+ user_signup: {
+ email: 'in-use@localhost',
+ name: 'Mr Suspected-Hacker',
+ password: 'sillypassword',
+ password_confirmation: 'mistyped'
}
}
expect(assigns[:user_signup].errors[:password_confirmation]).
@@ -743,11 +743,11 @@ def make_request
it "should send confirmation mail if you fill in the form right" do
post :signup, params: {
- :user_signup => {
- :email => 'new@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'new@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('confirm')
@@ -760,11 +760,11 @@ def make_request
it "should send confirmation mail in other languages or different locales" do
session[:locale] = "es"
post :signup, params: {
- :user_signup => {
- :email => 'new@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'new@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('confirm')
@@ -777,11 +777,11 @@ def make_request
context "filling in the form with an existing registered email" do
it "should send special 'already signed up' mail" do
post :signup, params: {
- :user_signup => {
- :email => 'silly@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'silly@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('confirm')
@@ -796,11 +796,11 @@ def make_request
it "cope with trailing spaces in the email address" do
post :signup, params: {
- :user_signup => {
- :email => 'silly@localhost ',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'silly@localhost ',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('confirm')
@@ -816,11 +816,11 @@ def make_request
it "should create a new PostRedirect if the old one has expired" do
allow(PostRedirect).to receive(:find_by_token).and_return(nil)
post :signup, params: {
- :user_signup => {
- :email => 'silly@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'silly@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('confirm')
@@ -830,12 +830,12 @@ def make_request
it 'accepts only whitelisted parameters' do
expect {
post :signup, params: {
- :user_signup => {
- :email => 'silly@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword',
- :role_ids => Role.admin_role.id
+ user_signup: {
+ email: 'silly@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword',
+ role_ids: Role.admin_role.id
}
}
}.to raise_error(ActionController::UnpermittedParameters)
@@ -867,11 +867,11 @@ def make_request
it "shows the confirmation page for valid credentials" do
sign_in user
- post :signup, params: { :user_signup => {
- :email => user.email,
- :name => user.name,
- :password => 'jonespassword',
- :password_confirmation => 'jonespassword'
+ post :signup, params: { user_signup: {
+ email: user.email,
+ name: user.name,
+ password: 'jonespassword',
+ password_confirmation: 'jonespassword'
}
}
expect(response).to render_template('confirm')
@@ -897,11 +897,11 @@ def make_request
it 'sends an exception notification' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
mail = ActionMailer::Base.deliveries.first
@@ -910,23 +910,23 @@ def make_request
it 'blocks the signup' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
- expect(User.where(:email => 'rate-limited@localhost').count).to eq(0)
+ expect(User.where(email: 'rate-limited@localhost').count).to eq(0)
end
it 're-renders the form' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('sign')
@@ -934,11 +934,11 @@ def make_request
it 'sets a flash error' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(flash[:error]).to match(/unable to sign up new users/)
@@ -955,11 +955,11 @@ def make_request
it 'sends an exception notification' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
mail = ActionMailer::Base.deliveries.first
@@ -968,14 +968,14 @@ def make_request
it 'allows the signup' do
post :signup, params: {
- :user_signup => {
- :email => 'rate-limited@localhost',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'rate-limited@localhost',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
- expect(User.where(:email => 'rate-limited@localhost').count).to eq(1)
+ expect(User.where(email: 'rate-limited@localhost').count).to eq(1)
end
end
@@ -1005,34 +1005,34 @@ def make_request
expect(Rails.logger).to receive(:info).with(msg)
post :signup, params: {
- :user_signup => {
- :email => 'spammer@example.com',
- :name => 'Download New Person 1080p!',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'spammer@example.com',
+ name: 'Download New Person 1080p!',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
end
it 'blocks the signup' do
post :signup, params: {
- :user_signup => {
- :email => 'spammer@example.com',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'spammer@example.com',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
- expect(User.where(:email => 'spammer@example.com').count).to eq(0)
+ expect(User.where(email: 'spammer@example.com').count).to eq(0)
end
it 're-renders the form' do
post :signup, params: {
- :user_signup => {
- :email => 'spammer@example.com',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'spammer@example.com',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
expect(response).to render_template('sign')
@@ -1049,11 +1049,11 @@ def make_request
it 'sends an exception notification' do
post :signup, params: {
- :user_signup => {
- :email => 'spammer@example.com',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'spammer@example.com',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
mail = ActionMailer::Base.deliveries.first
@@ -1062,14 +1062,14 @@ def make_request
it 'allows the signup' do
post :signup, params: {
- :user_signup => {
- :email => 'spammer@example.com',
- :name => 'New Person',
- :password => 'sillypassword',
- :password_confirmation => 'sillypassword'
+ user_signup: {
+ email: 'spammer@example.com',
+ name: 'New Person',
+ password: 'sillypassword',
+ password_confirmation: 'sillypassword'
}
}
- expect(User.where(:email => 'spammer@example.com').count).to eq(1)
+ expect(User.where(email: 'spammer@example.com').count).to eq(1)
end
end
@@ -1106,7 +1106,7 @@ def make_request
it "should require login" do
get :signchangeemail
expect(response).
- to redirect_to(signin_path(:token => get_last_post_redirect.token))
+ to redirect_to(signin_path(token: get_last_post_redirect.token))
end
it "should show form for changing email if logged in" do
@@ -1124,12 +1124,12 @@ def make_request
post :signchangeemail,
params: {
- :signchangeemail => {
- :old_email => 'bob@localhost',
- :password => 'donotknowpassword',
- :new_email => 'newbob@localhost'
+ signchangeemail: {
+ old_email: 'bob@localhost',
+ password: 'donotknowpassword',
+ new_email: 'newbob@localhost'
},
- :submitted_signchangeemail_do => 1
+ submitted_signchangeemail_do: 1
}
@user.reload
@@ -1147,12 +1147,12 @@ def make_request
post :signchangeemail,
params: {
- :signchangeemail => {
- :old_email => 'bob@moo',
- :password => 'jonespassword',
- :new_email => 'newbob@localhost'
+ signchangeemail: {
+ old_email: 'bob@moo',
+ password: 'jonespassword',
+ new_email: 'newbob@localhost'
},
- :submitted_signchangeemail_do => 1
+ submitted_signchangeemail_do: 1
}
@user.reload
@@ -1170,12 +1170,12 @@ def make_request
post :signchangeemail,
params: {
- :signchangeemail => {
- :old_email => 'BOB@localhost',
- :password => 'jonespassword',
- :new_email => 'newbob@localhost'
+ signchangeemail: {
+ old_email: 'BOB@localhost',
+ password: 'jonespassword',
+ new_email: 'newbob@localhost'
},
- :submitted_signchangeemail_do => 1
+ submitted_signchangeemail_do: 1
}
expect(response).to render_template('signchangeemail_confirm')
@@ -1187,12 +1187,12 @@ def make_request
post :signchangeemail,
params: {
- :signchangeemail => {
- :old_email => 'bob@localhost',
- :password => 'jonespassword',
- :new_email => 'silly@localhost'
+ signchangeemail: {
+ old_email: 'bob@localhost',
+ password: 'jonespassword',
+ new_email: 'silly@localhost'
},
- :submitted_signchangeemail_do => 1
+ submitted_signchangeemail_do: 1
}
@user.reload
@@ -1222,17 +1222,17 @@ def make_request
it "should not let you change profile photo if you're not logged in as the user" do
post :set_profile_photo, params: {
- :id => @user.id,
- :file => @uploadedfile,
- :submitted_draft_profile_photo => 1,
- :automatically_crop => 1
+ id: @user.id,
+ file: @uploadedfile,
+ submitted_draft_profile_photo: 1,
+ automatically_crop: 1
}
end
it "should return a 404 not a 500 when a profile photo has not been set" do
expect(@user.profile_photo).to be_nil
expect {
- get :get_profile_photo, params: { :url_name => @user.url_name }
+ get :get_profile_photo, params: { url_name: @user.url_name }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -1241,13 +1241,13 @@ def make_request
sign_in @user
post :set_profile_photo, params: {
- :id => @user.id,
- :file => @uploadedfile,
- :submitted_draft_profile_photo => 1,
- :automatically_crop => 1
+ id: @user.id,
+ file: @uploadedfile,
+ submitted_draft_profile_photo: 1,
+ automatically_crop: 1
}
- expect(response).to redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
+ expect(response).to redirect_to(controller: 'user', action: 'show', url_name: "bob_smith")
expect(flash[:notice]).to match(/Thank you for updating your profile photo/)
@user.reload
@@ -1255,21 +1255,21 @@ def make_request
end
context 'there is no profile text' do
- let(:user) { FactoryBot.create(:user, :about_me => '') }
+ let(:user) { FactoryBot.create(:user, about_me: '') }
it 'prompts you to add profile text when adding a photo' do
sign_in user
profile_photo = ProfilePhoto.
- create(:data => load_file_fixture("parrot.png"),
- :user => user)
+ create(data: load_file_fixture("parrot.png"),
+ user: user)
post :set_profile_photo,
params: {
- :id => user.id,
- :file => @uploadedfile,
- :submitted_crop_profile_photo => 1,
- :draft_profile_photo_id => profile_photo.id
+ id: user.id,
+ file: @uploadedfile,
+ submitted_crop_profile_photo: 1,
+ draft_profile_photo_id: profile_photo.id
}
expect(flash[:notice][:partial]).
@@ -1283,21 +1283,21 @@ def make_request
sign_in @user
post :set_profile_photo, params: {
- :id => @user.id,
- :file => @uploadedfile,
- :submitted_draft_profile_photo => 1,
- :automatically_crop => 1
+ id: @user.id,
+ file: @uploadedfile,
+ submitted_draft_profile_photo: 1,
+ automatically_crop: 1
}
- expect(response).to redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
+ expect(response).to redirect_to(controller: 'user', action: 'show', url_name: "bob_smith")
expect(flash[:notice]).to match(/Thank you for updating your profile photo/)
post :set_profile_photo, params: {
- :id => @user.id,
- :file => @uploadedfile_2,
- :submitted_draft_profile_photo => 1,
- :automatically_crop => 1
+ id: @user.id,
+ file: @uploadedfile_2,
+ submitted_draft_profile_photo: 1,
+ automatically_crop: 1
}
- expect(response).to redirect_to(:controller => 'user', :action => 'show', :url_name => "bob_smith")
+ expect(response).to redirect_to(controller: 'user', action: 'show', url_name: "bob_smith")
expect(flash[:notice]).to match(/Thank you for updating your profile photo/)
@user.reload
@@ -1310,7 +1310,7 @@ def make_request
RSpec.describe UserController, "when showing JSON version for API" do
it "should be successful" do
- get :show, params: { :url_name => "bob_smith", :format => "json" }
+ get :show, params: { url_name: "bob_smith", format: "json" }
u = JSON.parse(response.body)
expect(u.class.to_s).to eq('Hash')
@@ -1334,19 +1334,19 @@ def make_request
ire = info_request_events(:useless_incoming_message_event)
ire.created_at = DateTime.new(2001,1,1)
sign_in user
- get :wall, params: { :url_name => user.url_name }
+ get :wall, params: { url_name: user.url_name }
expect(assigns[:feed_results][0]).not_to eq(ire)
ire.created_at = Time.zone.now
ire.save!
- get :wall, params: { :url_name => user.url_name }
+ get :wall, params: { url_name: user.url_name }
expect(assigns[:feed_results][0]).to eq(ire)
end
it "should show other users' activities on their walls" do
user = users(:silly_name_user)
ire = info_request_events(:useless_incoming_message_event)
- get :wall, params: { :url_name => user.url_name }
+ get :wall, params: { url_name: user.url_name }
expect(assigns[:feed_results][0]).not_to eq(ire)
end
@@ -1355,8 +1355,8 @@ def make_request
sign_in user
expect(user.receive_email_alerts).to eq(true)
get :set_receive_email_alerts, params: {
- :receive_email_alerts => 'false',
- :came_from => "/"
+ receive_email_alerts: 'false',
+ came_from: "/"
}
user.reload
expect(user.receive_email_alerts).not_to eq(true)
@@ -1365,7 +1365,7 @@ def make_request
it 'should not show duplicate feed results' do
user = users(:silly_name_user)
sign_in user
- get :wall, params: { :url_name => user.url_name }
+ get :wall, params: { url_name: user.url_name }
expect(assigns[:feed_results].uniq).to eq(assigns[:feed_results])
end
diff --git a/spec/controllers/user_profile/about_me_controller_spec.rb b/spec/controllers/user_profile/about_me_controller_spec.rb
index a520da78c7..ec787ac6dc 100644
--- a/spec/controllers/user_profile/about_me_controller_spec.rb
+++ b/spec/controllers/user_profile/about_me_controller_spec.rb
@@ -49,7 +49,7 @@
describe 'PUT update' do
it 'sets the title' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(assigns[:title]).
to eq("Change the text about you on your profile at #{ site_name }")
end
@@ -58,7 +58,7 @@
it 'redirects to the sign in page' do
sign_in nil
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(response).to redirect_to(frontpage_path)
end
@@ -66,19 +66,19 @@
context 'with a banned user' do
- let(:banned_user) { FactoryBot.create(:user, :ban_text => 'banned') }
+ let(:banned_user) { FactoryBot.create(:user, ban_text: 'banned') }
before :each do
sign_in banned_user
end
it 'displays an error' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(flash[:error]).to eq('Suspended users cannot edit their profile')
end
it 'redirects to edit' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(response).to redirect_to(edit_profile_about_me_path)
end
@@ -93,29 +93,29 @@
end
it 'assigns the currently logged in user' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(assigns[:user]).to eq(user)
end
it 'updates the user about_me' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(user.reload.about_me).to eq('My bio')
end
context 'if the user has a profile photo' do
it 'sets a success message' do
- user.create_profile_photo!(:data => load_file_fixture('parrot.png'))
- put :update, params: { :user => { :about_me => 'My bio' } }
+ user.create_profile_photo!(data: load_file_fixture('parrot.png'))
+ put :update, params: { user: { about_me: 'My bio' } }
msg = 'You have now changed the text about you on your profile.'
expect(flash[:notice]).to eq(msg)
end
it 'redirects to the user page' do
- user.create_profile_photo!(:data => load_file_fixture('parrot.png'))
- put :update, params: { :user => { :about_me => 'My bio' } }
+ user.create_profile_photo!(data: load_file_fixture('parrot.png'))
+ put :update, params: { user: { about_me: 'My bio' } }
expect(response).
- to redirect_to(show_user_path(:url_name => user.url_name))
+ to redirect_to(show_user_path(url_name: user.url_name))
end
end
@@ -123,12 +123,12 @@
context 'if the user does not have a profile photo' do
it 'sets a message suggesting they add one' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(flash[:notice][:partial]).to eq("update_profile_text")
end
it 'redirects to the set profile photo page' do
- put :update, params: { :user => { :about_me => 'My bio' } }
+ put :update, params: { user: { about_me: 'My bio' } }
expect(response).to redirect_to(set_profile_photo_path)
end
@@ -138,7 +138,7 @@
context 'with invalid attributes' do
- let(:user) { FactoryBot.create(:user, :about_me => 'My bio') }
+ let(:user) { FactoryBot.create(:user, about_me: 'My bio') }
let(:invalid_text) { 'x' * 1000 }
before :each do
@@ -146,17 +146,17 @@
end
it 'assigns the currently logged in user' do
- put :update, params: { :user => { :about_me => invalid_text } }
+ put :update, params: { user: { about_me: invalid_text } }
expect(assigns[:user]).to eq(user)
end
it 'does not update the user about_me' do
- put :update, params: { :user => { :about_me => invalid_text } }
+ put :update, params: { user: { about_me: invalid_text } }
expect(user.reload.about_me).to eq('My bio')
end
it 'renders the edit form' do
- put :update, params: { :user => { :about_me => invalid_text } }
+ put :update, params: { user: { about_me: invalid_text } }
expect(response).to render_template(:edit)
end
@@ -164,26 +164,26 @@
context 'with invalid parameters' do
- let(:user) { FactoryBot.create(:user, :about_me => 'My bio') }
+ let(:user) { FactoryBot.create(:user, about_me: 'My bio') }
before :each do
sign_in user
end
it 'assigns the currently logged in user' do
- put :update, params: { :about_me => 'Updated text' }
+ put :update, params: { about_me: 'Updated text' }
expect(assigns[:user]).to eq(user)
end
it 'does not update the user about_me' do
- put :update, params: { :about_me => 'Updated text' }
+ put :update, params: { about_me: 'Updated text' }
expect(user.reload.about_me).to eq('My bio')
end
it 'redirects to the user page' do
- put :update, params: { :about_me => 'Updated text' }
+ put :update, params: { about_me: 'Updated text' }
expect(response).
- to redirect_to(show_user_path(:url_name => user.url_name))
+ to redirect_to(show_user_path(url_name: user.url_name))
end
end
@@ -198,21 +198,21 @@
it 'ignores non-whitelisted attributes' do
put :update, params: {
- :user => {
- :about_me => 'My bio',
- :role_ids => [ Role.admin_role.id ]
+ user: {
+ about_me: 'My bio',
+ role_ids: [ Role.admin_role.id ]
}
}
expect(user.reload.roles).to eq([])
end
it 'sets whitelisted attributes' do
- user = FactoryBot.create(:user, :name => '1234567')
+ user = FactoryBot.create(:user, name: '1234567')
sign_in user
put :update, params: {
- :user => {
- :about_me => 'My bio',
- :role_ids => [ Role.admin_role.id ]
+ user: {
+ about_me: 'My bio',
+ role_ids: [ Role.admin_role.id ]
}
}
expect(user.reload.about_me).to eq('My bio')
@@ -223,14 +223,14 @@
context 'with spam attributes and a non-whitelisted user' do
let(:user) do
- FactoryBot.create(:user, :name => 'JWahewKjWhebCd',
- :confirmed_not_spam => false)
+ FactoryBot.create(:user, name: 'JWahewKjWhebCd',
+ confirmed_not_spam: false)
end
before :each do
UserSpamScorer.spam_score_threshold = 1
UserSpamScorer.score_mappings =
- { :about_me_includes_currency_symbol? => 20 }
+ { about_me_includes_currency_symbol?: 20 }
sign_in user
end
@@ -238,7 +238,7 @@
it 'sets an error message' do
put :update, params: {
- :user => { :about_me => 'http://example.com/$£$£$' }
+ user: { about_me: 'http://example.com/$£$£$' }
}
msg = "You can't update your profile text at this time."
expect(flash[:error]).to eq(msg)
@@ -246,15 +246,15 @@
it 'redirects to the user page' do
put :update, params: {
- :user => { :about_me => 'http://example.com/$£$£$' }
+ user: { about_me: 'http://example.com/$£$£$' }
}
expect(response).
- to redirect_to(show_user_path(:url_name => user.url_name))
+ to redirect_to(show_user_path(url_name: user.url_name))
end
it 'does not update the user about_me' do
put :update, params: {
- :user => { :about_me => 'http://example.com/$£$£$' }
+ user: { about_me: 'http://example.com/$£$£$' }
}
expect(user.reload.about_me).to eq('')
end
@@ -264,14 +264,14 @@
context 'with spam attributes and a whitelisted user' do
let(:user) do
- FactoryBot.create(:user, :name => 'JWahewKjWhebCd',
- :confirmed_not_spam => true)
+ FactoryBot.create(:user, name: 'JWahewKjWhebCd',
+ confirmed_not_spam: true)
end
before :each do
UserSpamScorer.spam_score_threshold = 1
UserSpamScorer.score_mappings =
- { :about_me_includes_currency_symbol? => 20 }
+ { about_me_includes_currency_symbol?: 20 }
sign_in user
end
@@ -280,7 +280,7 @@
it 'updates the user about_me' do
# By whitelisting we're giving them the benefit of the doubt
put :update, params: {
- :user => { :about_me => 'http://example.com/$£$£$' }
+ user: { about_me: 'http://example.com/$£$£$' }
}
expect(user.reload.about_me).to eq('http://example.com/$£$£$')
end
@@ -289,7 +289,7 @@
context 'with block_spam_about_me_text? returning true, spam content and a non-whitelisted user' do
- let(:user) { FactoryBot.create(:user, :confirmed_not_spam => false) }
+ let(:user) { FactoryBot.create(:user, confirmed_not_spam: false) }
before :each do
UserSpamScorer.score_mappings = {}
@@ -302,8 +302,8 @@
it 'sends an exception notification' do
put :update,
params: {
- :user => {
- :about_me => '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
mail = ActionMailer::Base.deliveries.first
@@ -313,8 +313,8 @@
it 'sets an error message' do
put :update,
params: {
- :user => {
- :about_me => '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
msg = "You can't update your profile text at this time."
@@ -324,19 +324,19 @@
it 'redirects to the user page' do
put :update,
params: {
- :user => {
- :about_me => '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
expect(response).
- to redirect_to(show_user_path(:url_name => user.url_name))
+ to redirect_to(show_user_path(url_name: user.url_name))
end
it 'does not update the user about_me' do
put :update,
params: {
- :user => {
- :about_me => '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
expect(user.reload.about_me).to eq('')
@@ -347,7 +347,7 @@
context 'with block_spam_about_me_text? returning false, spam content and a whitelisted user' do
let(:user) do
- FactoryBot.create(:user, :name => '12345', :confirmed_not_spam => true)
+ FactoryBot.create(:user, name: '12345', confirmed_not_spam: true)
end
before :each do
@@ -359,8 +359,8 @@
# By whitelisting we're giving them the benefit of the doubt
put :update,
params: {
- :user => {
- :about_me => '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
expect(user.reload.about_me).to eq('[HD] Watch Jason Bourne Online free MOVIE Full-HD')
@@ -370,7 +370,7 @@
context 'with block_spam_about_me_text? returning true, spam content and a whitelisted user' do
- let(:user) { FactoryBot.create(:user, :confirmed_not_spam => true) }
+ let(:user) { FactoryBot.create(:user, confirmed_not_spam: true) }
before :each do
sign_in user
@@ -381,9 +381,8 @@
# By whitelisting we're giving them the benefit of the doubt
put :update,
params: {
- :user => {
- :about_me =>
- '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
+ user: {
+ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD'
}
}
expect(user.reload.about_me).to eq('[HD] Watch Jason Bourne Online free MOVIE Full-HD')
diff --git a/spec/controllers/users/confirmations_controller_spec.rb b/spec/controllers/users/confirmations_controller_spec.rb
index 88a11689d0..cae05aefd3 100644
--- a/spec/controllers/users/confirmations_controller_spec.rb
+++ b/spec/controllers/users/confirmations_controller_spec.rb
@@ -7,7 +7,7 @@
context 'if the post redirect cannot be found' do
it 'renders bad_token' do
- get :confirm, params: { :email_token => '' }
+ get :confirm, params: { email_token: '' }
expect(response).to render_template(:bad_token)
end
@@ -88,11 +88,11 @@
before :each do
@admin = FactoryBot.create(:admin_user)
- @user = FactoryBot.create(:user, :email_confirmed => false)
- @post_redirect = PostRedirect.create(:uri => '/', :user => @user)
+ @user = FactoryBot.create(:user, email_confirmed: false)
+ @post_redirect = PostRedirect.create(uri: '/', user: @user)
sign_in @admin
- get :confirm, params: { :email_token => @post_redirect.email_token }
+ get :confirm, params: { email_token: @post_redirect.email_token }
end
it 'does not confirm the post redirect user' do
@@ -119,11 +119,11 @@
EOF
before :each do
- @user = FactoryBot.create(:user, :email_confirmed => false)
- @post_redirect = PostRedirect.create(:uri => '/', :user => @user)
+ @user = FactoryBot.create(:user, email_confirmed: false)
+ @post_redirect = PostRedirect.create(uri: '/', user: @user)
sign_in @user
- get :confirm, params: { :email_token => @post_redirect.email_token }
+ get :confirm, params: { email_token: @post_redirect.email_token }
end
it 'confirms the post redirect user' do
@@ -150,11 +150,11 @@
EOF
before :each do
@current_user = FactoryBot.create(:user)
- @user = FactoryBot.create(:user, :email_confirmed => false)
- @post_redirect = PostRedirect.create(:uri => '/', :user => @user)
+ @user = FactoryBot.create(:user, email_confirmed: false)
+ @post_redirect = PostRedirect.create(uri: '/', user: @user)
sign_in @current_user
- get :confirm, params: { :email_token => @post_redirect.email_token }
+ get :confirm, params: { email_token: @post_redirect.email_token }
end
it 'confirms the post redirect user' do
@@ -179,10 +179,10 @@
context 'if there is no logged in user' do
before :each do
- @user = FactoryBot.create(:user, :email_confirmed => false)
- @post_redirect = PostRedirect.create(:uri => '/', :user => @user)
+ @user = FactoryBot.create(:user, email_confirmed: false)
+ @post_redirect = PostRedirect.create(uri: '/', user: @user)
- get :confirm, params: { :email_token => @post_redirect.email_token }
+ get :confirm, params: { email_token: @post_redirect.email_token }
end
it 'confirms the post redirect user' do
diff --git a/spec/controllers/users/sessions_controller_spec.rb b/spec/controllers/users/sessions_controller_spec.rb
index eefd565b0d..7a8f7f6531 100644
--- a/spec/controllers/users/sessions_controller_spec.rb
+++ b/spec/controllers/users/sessions_controller_spec.rb
@@ -21,7 +21,7 @@
end
it "should create post redirect to /list when you click signin on /list" do
- get :new, params: { :r => "/list" }
+ get :new, params: { r: "/list" }
post_redirect = get_last_post_redirect
expect(post_redirect.uri).to eq("/list")
end
@@ -58,11 +58,11 @@
it "should show you the sign in page again if you get the password wrong" do
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'bob@localhost',
- :password => 'NOTRIGHTPASSWORD'
+ user_signin: {
+ email: 'bob@localhost',
+ password: 'NOTRIGHTPASSWORD'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(response).to render_template('user/sign')
end
@@ -70,11 +70,11 @@
it "should show you the sign in page again if you get the email wrong" do
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'unknown@localhost',
- :password => 'NOTRIGHTPASSWORD'
+ user_signin: {
+ email: 'unknown@localhost',
+ password: 'NOTRIGHTPASSWORD'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(response).to render_template('user/sign')
end
@@ -83,11 +83,11 @@
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'bob@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'bob@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(session[:user_id]).to eq(users(:bob_smith_user).id)
# response doesn't contain /en/ but redirect_to does...
@@ -99,20 +99,20 @@
post_redirect = "something invalid"
expect {
post :create, params: {
- :user_signin => {
- :email => 'bob@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'bob@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect
+ token: post_redirect
}
}.not_to raise_error
post :create, params: {
- :user_signin => {
- :email => 'bob@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'bob@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect
+ token: post_redirect
}
expect(response).to render_template('user/sign')
expect(assigns[:post_redirect]).to eq(nil)
@@ -120,9 +120,9 @@
it "sets a the cookie expiry to nil on next page load" do
post :create, params: {
- :user_signin => {
- :email => user.email,
- :password => 'jonespassword'
+ user_signin: {
+ email: user.email,
+ password: 'jonespassword'
}
}
get :new
@@ -132,11 +132,11 @@
it "does not log you in if you use an invalid PostRedirect token" do
post_redirect = "something invalid"
post :create, params: {
- :user_signin => {
- :email => 'bob@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'bob@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect
+ token: post_redirect
}
expect(response).to render_template('sign')
expect(assigns[:post_redirect]).to eq(nil)
@@ -158,17 +158,17 @@
context "checking 'remember_me'" do
let(:user) do
FactoryBot.create(:user,
- :password => 'password1234',
- :email_confirmed => true)
+ password: 'password1234',
+ email_confirmed: true)
end
def do_signin(email, password)
post :create, params: {
- :user_signin => {
- :email => email,
- :password => password
+ user_signin: {
+ email: email,
+ password: password
},
- :remember_me => "1"
+ remember_me: "1"
}
end
@@ -214,23 +214,23 @@ def do_signin(email, password)
it "signs them in if the credentials are valid" do
post :create, params: {
- :user_signin => {
- :email => user.email,
- :password => 'jonespassword'
+ user_signin: {
+ email: user.email,
+ password: 'jonespassword'
}
},
- session: { :user_id => user.id }
+ session: { user_id: user.id }
expect(session[:user_id]).to eq(user.id)
end
it 'signs them out if the credentials are not valid' do
post :create, params: {
- :user_signin => {
- :email => user.email,
- :password => 'wrongpassword'
+ user_signin: {
+ email: user.email,
+ password: 'wrongpassword'
}
},
- session: { :user_id => user.id }
+ session: { user_id: user.id }
expect(session[:user_id]).to be_nil
end
@@ -313,11 +313,11 @@ def do_signin(email, password)
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'unconfirmed@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'unconfirmed@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(response).to render_template('user/confirm')
@@ -332,13 +332,13 @@ def do_signin(email, password)
FactoryBot.create(:post_redirect, uri: 'http://bad.place.com/list')
post :create, params: {
- :user_signin => {
- :email => 'unconfirmed@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'unconfirmed@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
- get :confirm, params: { :email_token => post_redirect.email_token }
+ get :confirm, params: { email_token: post_redirect.email_token }
expect(response).to redirect_to('/list?post_redirect=1')
end
@@ -349,11 +349,11 @@ def do_signin(email, password)
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'unconfirmed@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'unconfirmed@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(ActionMailer::Base.deliveries).not_to be_empty
@@ -367,13 +367,13 @@ def do_signin(email, password)
# check is right confirmation URL
expect(mail_token).to eq(post_redirect.email_token)
- expect(Rails.application.routes.recognize_path(mail_path)).to eq({ :controller => 'user', :action => 'confirm', :email_token => mail_token })
+ expect(Rails.application.routes.recognize_path(mail_path)).to eq({ controller: 'user', action: 'confirm', email_token: mail_token })
# check confirmation URL works
expect(session[:user_id]).to be_nil
- get :confirm, params: { :email_token => post_redirect.email_token }
+ get :confirm, params: { email_token: post_redirect.email_token }
expect(session[:user_id]).to eq(users(:unconfirmed_user).id)
- expect(response).to redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1)
+ expect(response).to redirect_to(controller: 'request', action: 'list', post_redirect: 1)
end
# TODO: Extract to integration spec
@@ -383,11 +383,11 @@ def do_signin(email, password)
post_redirect = FactoryBot.create(:post_redirect, uri: '/list')
post :create, params: {
- :user_signin => {
- :email => 'unconfirmed@localhost',
- :password => 'jonespassword'
+ user_signin: {
+ email: 'unconfirmed@localhost',
+ password: 'jonespassword'
},
- :token => post_redirect.token
+ token: post_redirect.token
}
expect(ActionMailer::Base.deliveries).not_to be_empty
@@ -401,17 +401,17 @@ def do_signin(email, password)
# check is right confirmation URL
expect(mail_token).to eq(post_redirect.email_token)
- expect(Rails.application.routes.recognize_path(mail_path)).to eq({ :controller => 'user', :action => 'confirm', :email_token => mail_token })
+ expect(Rails.application.routes.recognize_path(mail_path)).to eq({ controller: 'user', action: 'confirm', email_token: mail_token })
# Log in as an admin
sign_in users(:admin_user)
# Get the confirmation URL, and check we’re still Joe
- get :confirm, params: { :email_token => post_redirect.email_token }
+ get :confirm, params: { email_token: post_redirect.email_token }
expect(session[:user_id]).to eq(users(:admin_user).id)
# And the redirect should still work, of course
- expect(response).to redirect_to(:controller => 'request', :action => 'list', :post_redirect => 1)
+ expect(response).to redirect_to(controller: 'request', action: 'list', post_redirect: 1)
end
end
@@ -428,14 +428,14 @@ def do_signin(email, password)
it "logs you out and redirect you to where you were" do
sign_in user
- get :destroy, params: { :r => '/list' }
+ get :destroy, params: { r: '/list' }
expect(session[:user_id]).to be_nil
expect(response).
to redirect_to(request_list_path)
end
it "clears the session ttl" do
- get :destroy, session: { :user_id => user.id, :ttl => Time.zone.now }
+ get :destroy, session: { user_id: user.id, ttl: Time.zone.now }
expect(session[:ttl]).to be_nil
end
diff --git a/spec/controllers/widget_votes_controller_spec.rb b/spec/controllers/widget_votes_controller_spec.rb
index 33dd23977d..0c57d77b91 100644
--- a/spec/controllers/widget_votes_controller_spec.rb
+++ b/spec/controllers/widget_votes_controller_spec.rb
@@ -12,12 +12,12 @@
end
it 'should find the info request' do
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(assigns[:info_request]).to eq(info_request)
end
it 'should redirect to the track path for the info request' do
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
track_thing = TrackThing.create_track_for_request(info_request)
expect(response).to redirect_to(do_track_path(track_thing))
end
@@ -26,7 +26,7 @@
it 'sets a tracking cookie' do
allow(SecureRandom).to receive(:hex).and_return(mock_cookie)
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(cookies[:widget_vote]).to eq(mock_cookie)
end
@@ -34,9 +34,9 @@
allow(SecureRandom).to receive(:hex).and_return(mock_cookie)
votes = info_request.
widget_votes.
- where(:cookie => mock_cookie)
+ where(cookie: mock_cookie)
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(votes.size).to eq(1)
end
@@ -47,7 +47,7 @@
it 'retains the existing tracking cookie' do
request.cookies['widget_vote'] = mock_cookie
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(cookies[:widget_vote]).to eq(mock_cookie)
end
@@ -55,9 +55,9 @@
request.cookies['widget_vote'] = mock_cookie
votes = info_request.
widget_votes.
- where(:cookie => mock_cookie)
+ where(cookie: mock_cookie)
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(votes.size).to eq(1)
end
@@ -69,7 +69,7 @@
it 'raises ActiveRecord::RecordNotFound' do
allow(AlaveteliConfiguration).to receive(:enable_widgets).and_return(false)
expect {
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -80,7 +80,7 @@
it 'should return a 403' do
info_request.prominence = 'hidden'
info_request.save!
- post :create, params: { :request_id => info_request.id }
+ post :create, params: { request_id: info_request.id }
expect(response.code).to eq("403")
end
@@ -91,7 +91,7 @@
it 'should raise an ActiveRecord::RecordNotFound error' do
embargoed_request = FactoryBot.create(:embargoed_request)
expect {
- post :create, params: { :request_id => embargoed_request.id }
+ post :create, params: { request_id: embargoed_request.id }
}.to raise_error ActiveRecord::RecordNotFound
end
end
diff --git a/spec/controllers/widgets_controller_spec.rb b/spec/controllers/widgets_controller_spec.rb
index dd0af5f13f..d942d9ff7a 100644
--- a/spec/controllers/widgets_controller_spec.rb
+++ b/spec/controllers/widgets_controller_spec.rb
@@ -12,22 +12,22 @@
end
it 'should render the widget template' do
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(response).to render_template('show')
end
it 'should find the info request' do
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:info_request]).to eq(@info_request)
end
it 'should create a track thing for the request' do
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:track_thing].info_request).to eq(@info_request)
end
it 'should assign the request status' do
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:status]).to eq(@info_request.calculate_status)
end
@@ -41,10 +41,10 @@
track.save!
3.times do
- @info_request.widget_votes.create(:cookie => SecureRandom.hex(10))
+ @info_request.widget_votes.create(cookie: SecureRandom.hex(10))
end
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
# Count should be 5
# 1 for the request's owning user
@@ -55,18 +55,18 @@
it 'sets user_owns_request to true if the user owns the request' do
sign_in @info_request.user
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:user_owns_request]).to be true
end
it 'sets user_owns_request to false if the user does not own the request' do
sign_in FactoryBot.create(:user)
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:user_owns_request]).to be false
end
it 'should not send an x-frame-options header' do
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(response.headers["X-Frame-Options"]).to be_nil
end
@@ -74,23 +74,23 @@
it 'will not find existing tracks' do
request.cookies['widget_vote'] = mock_cookie
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_track]).to be_nil
end
it 'finds existing votes' do
vote = FactoryBot.create(:widget_vote,
- :info_request => @info_request,
- :cookie => mock_cookie)
+ info_request: @info_request,
+ cookie: mock_cookie)
request.cookies['widget_vote'] = vote.cookie
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be true
end
it 'will not find any existing votes if none exist' do
WidgetVote.delete_all
request.cookies['widget_vote'] = mock_cookie
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be false
end
@@ -100,13 +100,13 @@
it 'will not find existing tracks' do
request.cookies['widget_vote'] = nil
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_track]).to be_nil
end
it 'will not find any existing votes' do
request.cookies['widget_vote'] = nil
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be false
end
@@ -122,7 +122,7 @@
track.save!
sign_in user
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_track]).to eq(track)
end
@@ -136,7 +136,7 @@
user = FactoryBot.create(:user)
sign_in user
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_track]).to be_nil
end
@@ -144,12 +144,12 @@
it 'looks for an existing vote' do
TrackThing.delete_all
vote = FactoryBot.create(:widget_vote,
- :info_request => @info_request,
- :cookie => mock_cookie)
+ info_request: @info_request,
+ cookie: mock_cookie)
sign_in @info_request.user
request.cookies['widget_vote'] = mock_cookie
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be true
end
@@ -160,7 +160,7 @@
sign_in @info_request.user
request.cookies['widget_vote'] = mock_cookie
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be false
end
@@ -172,7 +172,7 @@
it 'raises ActiveRecord::RecordNotFound' do
allow(AlaveteliConfiguration).to receive(:enable_widgets).and_return(false)
expect {
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -183,17 +183,17 @@
it 'should return a 403' do
@info_request.prominence = 'hidden'
@info_request.save!
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(response.code).to eq("403")
end
it 'does not look for an existing vote' do
vote = FactoryBot.create(:widget_vote,
- :info_request => @info_request,
- :cookie => mock_cookie)
+ info_request: @info_request,
+ cookie: mock_cookie)
sign_in @info_request.user
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(assigns[:existing_vote]).to be false
end
@@ -210,12 +210,12 @@
end
it 'should render the create widget template' do
- get :new, params: { :request_id => @info_request.id }
+ get :new, params: { request_id: @info_request.id }
expect(response).to render_template('new')
end
it 'should find the info request' do
- get :new, params: { :request_id => @info_request.id }
+ get :new, params: { request_id: @info_request.id }
expect(assigns[:info_request]).to eq(@info_request)
end
@@ -224,7 +224,7 @@
it 'raises ActiveRecord::RecordNotFound' do
allow(AlaveteliConfiguration).to receive(:enable_widgets).and_return(false)
expect {
- get :new, params: { :request_id => @info_request.id }
+ get :new, params: { request_id: @info_request.id }
}.to raise_error(ActiveRecord::RecordNotFound)
end
@@ -235,7 +235,7 @@
it 'should return a 403' do
@info_request.prominence = 'hidden'
@info_request.save!
- get :show, params: { :request_id => @info_request.id }
+ get :show, params: { request_id: @info_request.id }
expect(response.code).to eq("403")
end
From 4f07d6fd8c3a7bc09d5f90cbc89145afb21f7130 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:00:55 +0000
Subject: [PATCH 096/289] Style: HashSyntax Rubocop (app helpers)
---
app/helpers/admin_comments_helper.rb | 2 +-
app/helpers/admin_helper.rb | 2 +-
app/helpers/admin_users_helper.rb | 6 +--
app/helpers/application_helper.rb | 42 ++++++++---------
app/helpers/date_time_helper.rb | 6 +--
app/helpers/health_checks_helper.rb | 2 +-
app/helpers/highlight_helper.rb | 8 ++--
app/helpers/info_request_helper.rb | 38 +++++++--------
app/helpers/link_to_helper.rb | 70 ++++++++++++++--------------
app/helpers/public_body_helper.rb | 6 +--
app/helpers/track_helper.rb | 68 +++++++++++++--------------
11 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/app/helpers/admin_comments_helper.rb b/app/helpers/admin_comments_helper.rb
index 7c4d0bafb2..959a5330b6 100644
--- a/app/helpers/admin_comments_helper.rb
+++ b/app/helpers/admin_comments_helper.rb
@@ -9,6 +9,6 @@ def comment_labels(comment)
private
def hidden_label
- content_tag(:span, 'hidden', :class => 'label label-warning')
+ content_tag(:span, 'hidden', class: 'label label-warning')
end
end
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 2b0fed840a..b844f11cc8 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -5,7 +5,7 @@ module AdminHelper
include Admin::ProminenceHelper
def icon(name)
- content_tag(:i, "", :class => "icon-#{name}")
+ content_tag(:i, "", class: "icon-#{name}")
end
def eye
diff --git a/app/helpers/admin_users_helper.rb b/app/helpers/admin_users_helper.rb
index df0f19dbcc..5625f62aa9 100644
--- a/app/helpers/admin_users_helper.rb
+++ b/app/helpers/admin_users_helper.rb
@@ -12,15 +12,15 @@ def user_labels(user)
private
def banned_label
- content_tag(:span, 'banned', :class => 'label label-warning')
+ content_tag(:span, 'banned', class: 'label label-warning')
end
def closed_label
- content_tag(:span, 'closed', :class => 'label label-warning')
+ content_tag(:span, 'closed', class: 'label label-warning')
end
def role_label(role)
- content_tag(:span, role.name, :class => 'label')
+ content_tag(:span, role.name, class: 'label')
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 04f6019936..1f784b8ecd 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -74,10 +74,10 @@ def admin_value(v)
end
def admin_date(date, ago: true, ago_only: false)
- ago_text = _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(date))
+ ago_text = _('{{length_of_time}} ago', length_of_time: time_ago_in_words(date))
text = ago_text if ago_only
- exact_date = I18n.l(date, :format => "%e %B %Y %H:%M:%S")
+ exact_date = I18n.l(date, format: "%e %B %Y %H:%M:%S")
text ||= "#{exact_date} (#{ago_text})" if ago
time_tag(date, text || exact_date, title: date)
@@ -163,38 +163,38 @@ def event_description(event)
case event.event_type
when 'sent'
_('Request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ date: date)
when 'followup_sent'
case event.calculated_state
when 'internal_review'
_('Internal review request sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ date: date)
when 'waiting_response'
_('Clarification sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ date: date)
else
_('Follow up sent to {{public_body_name}} by {{info_request_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ date: date)
end
when 'response'
_('Response by {{public_body_name}} to {{info_request_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ date: date)
when 'comment'
_('Request to {{public_body_name}} by {{info_request_user}}. Annotated by {{event_comment_user}} on {{date}}.',
- :public_body_name => body_link,
- :info_request_user => user_link,
- :event_comment_user => user_link_absolute(event.comment.user),
- :date => date)
+ public_body_name: body_link,
+ info_request_user: user_link,
+ event_comment_user: user_link_absolute(event.comment.user),
+ date: date)
end
end
diff --git a/app/helpers/date_time_helper.rb b/app/helpers/date_time_helper.rb
index 22d437ecf1..e1c3c8fbab 100644
--- a/app/helpers/date_time_helper.rb
+++ b/app/helpers/date_time_helper.rb
@@ -18,7 +18,7 @@ module DateTimeHelper
# Returns a String
# Raises ArgumentError if the format is unrecognized
def simple_date(date, opts = {})
- opts = { :format => :html }.merge(opts)
+ opts = { format: :html }.merge(opts)
date_formatter = "simple_date_#{ opts[:format] }"
if respond_to?(date_formatter)
@@ -36,7 +36,7 @@ def simple_date(date, opts = {})
# Returns a String
def simple_date_html(date)
date = date.in_time_zone unless date.is_a?(Date)
- time_tag date, simple_date_text(date), :title => date.to_s
+ time_tag date, simple_date_text(date), title: date.to_s
end
# Usually-correct plain text formatting of a DateTime-ish object
@@ -50,7 +50,7 @@ def simple_date_text(date)
date_format = _('simple_date_format')
date_format = :long if date_format == 'simple_date_format'
- I18n.l(date, :format => date_format)
+ I18n.l(date, format: date_format)
end
# Strips the date from a DateTime
diff --git a/app/helpers/health_checks_helper.rb b/app/helpers/health_checks_helper.rb
index 5c9b02959e..297e2e702b 100644
--- a/app/helpers/health_checks_helper.rb
+++ b/app/helpers/health_checks_helper.rb
@@ -2,7 +2,7 @@ module HealthChecksHelper
def check_status(check)
style = check.ok? ? '' : 'color: red'
- content_tag(:b, check.message, :style => style)
+ content_tag(:b, check.message, style: style)
end
end
diff --git a/app/helpers/highlight_helper.rb b/app/helpers/highlight_helper.rb
index da0ed3539b..56e2fd6191 100644
--- a/app/helpers/highlight_helper.rb
+++ b/app/helpers/highlight_helper.rb
@@ -28,15 +28,15 @@ def highlight_matches(text, phrases, options = {})
# Highlight words, also escapes HTML (other than spans that we add)
def highlight_words(t, words, html = true)
if html
- highlight_matches(h(t), words, :highlighter => '\1').html_safe
+ highlight_matches(h(t), words, highlighter: '\1').html_safe
else
- highlight_matches(t, words, :highlighter => '*\1*')
+ highlight_matches(t, words, highlighter: '*\1*')
end
end
def highlight_and_excerpt(t, words, excount, html = true)
- newt = excerpt(t, words[0], :radius => excount)
- newt = excerpt(t, '', :radius => excount) if not newt
+ newt = excerpt(t, words[0], radius: excount)
+ newt = excerpt(t, '', radius: excount) if not newt
t = newt
t = highlight_words(t, words, html)
return t
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index 08b92451df..9bc1b06d80 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -56,7 +56,7 @@ def status_text_awaiting_description(info_request, opts = {})
def status_text_waiting_response(info_request, opts = {})
str = _('Currently waiting for a response from ' \
'{{public_body_link}}, they should respond promptly and',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
str += ' '
str += _('normally')
str += ' '
@@ -76,11 +76,11 @@ def status_text_waiting_response_overdue(info_request, opts = {})
if info_request.public_body.not_subject_to_law?
str += _('Although not legally required to do so, we would have ' \
'expected {{public_body_link}} to have responded by ',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
else
str += _('By law, {{public_body_link}} should normally have responded ' \
'promptly and',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
str += ' '
str += _('by')
str += ' '
@@ -99,11 +99,11 @@ def status_text_waiting_response_very_overdue(info_request, opts = {})
if info_request.public_body.not_subject_to_law?
str += _('Although not legally required to do so, we would have ' \
'expected {{public_body_link}} to have responded by now',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
else
str += _('By law, under all circumstances, {{public_body_link}} should ' \
'have responded by now',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
end
str += ' '
str += "("
@@ -115,7 +115,7 @@ def status_text_waiting_response_very_overdue(info_request, opts = {})
str += _('You can complain by')
str += ' '
str += link_to _('requesting an internal review'),
- new_request_followup_path(:request_id => info_request.id) +
+ new_request_followup_path(request_id: info_request.id) +
'?internal_review=1'
str += '.'
end
@@ -126,12 +126,12 @@ def status_text_waiting_response_very_overdue(info_request, opts = {})
def status_text_not_held(info_request, opts = {})
_('{{authority_name}} did not have the information ' \
'requested.',
- :authority_name => public_body_link(info_request.public_body))
+ authority_name: public_body_link(info_request.public_body))
end
def status_text_rejected(info_request, opts = {})
_('The request was refused by {{authority_name}}.',
- :authority_name => public_body_link(info_request.public_body))
+ authority_name: public_body_link(info_request.public_body))
end
def status_text_successful(info_request, opts = {})
@@ -150,7 +150,7 @@ def status_text_waiting_clarification(info_request, opts = {})
if is_owning_user && !info_request.is_external?
str += _('{{authority_name}} is waiting for your clarification' \
'.',
- :authority_name => info_request.public_body.name)
+ authority_name: info_request.public_body.name)
str += ' '
str += _('Please')
str += ' '
@@ -165,9 +165,9 @@ def status_text_waiting_clarification(info_request, opts = {})
str += ' '
str += _('If you are {{user_link}}, please',
- :user_link => user_link_for_request(info_request))
+ user_link: user_link_for_request(info_request))
str += ' '
- str += link_to _("sign in"), signin_path(:r => redirect_to)
+ str += link_to _("sign in"), signin_path(r: redirect_to)
str += ' '
str += _('to send a follow up message.')
end
@@ -184,19 +184,19 @@ def status_text_gone_postal(info_request, opts = {})
def status_text_internal_review(info_request, opts = {})
_('Waiting for an internal review by ' \
'{{public_body_link}} of their handling of this request.',
- :public_body_link => public_body_link(info_request.public_body))
+ public_body_link: public_body_link(info_request.public_body))
end
def status_text_error_message(info_request, opts = {})
_('There was a delivery error or similar, which ' \
'needs fixing by the {{site_name}} team.',
- :site_name => site_name)
+ site_name: site_name)
end
def status_text_requires_admin(info_request, opts = {})
_('This request has had an unusual response, and requires ' \
'attention from the {{site_name}} team.',
- :site_name => site_name)
+ site_name: site_name)
end
def status_text_user_withdrawn(info_request, opts = {})
@@ -220,8 +220,8 @@ def status_text_not_foi(info_request, opts = {})
end
def custom_state_description(info_request, opts = {})
- render :partial => 'general/custom_state_descriptions',
- :locals => { :status => info_request.calculate_status }
+ render partial: 'general/custom_state_descriptions',
+ locals: { status: info_request.calculate_status }
end
def status_text_awaiting_description_owner_please_answer(new_responses_count)
@@ -271,8 +271,8 @@ def attachment_link(incoming_message, attachment)
"content_type/icon_unknown.png"
end
- link_to image_tag(image, :class => "attachment__image",
- :alt => "Attachment"),
+ link_to image_tag(image, class: "attachment__image",
+ alt: "Attachment"),
attachment_path(attachment)
end
@@ -297,7 +297,7 @@ def attachment_url(attachment, options = {})
def details_help_link(public_body)
anchor =
public_body.not_subject_to_law? ? 'authorities' : 'quickly_response'
- link_to _('details'), help_requesting_path(:anchor => anchor)
+ link_to _('details'), help_requesting_path(anchor: anchor)
end
private
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 64ac95ad70..289700a8ba 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -11,19 +11,19 @@ module LinkToHelper
# Requests
def request_url(info_request, options = {})
- show_request_url({:url_title => info_request.url_title}.merge(options))
+ show_request_url({url_title: info_request.url_title}.merge(options))
end
def request_path(info_request, options = {})
- request_url(info_request, options.merge(:only_path => true))
+ request_url(info_request, options.merge(only_path: true))
end
def request_link(info_request, cls=nil)
- link_to info_request.title, request_path(info_request), :class => cls
+ link_to info_request.title, request_path(info_request), class: cls
end
def request_details_path(info_request)
- details_request_path(:url_title => info_request.url_title)
+ details_request_path(url_title: info_request.url_title)
end
# Incoming / outgoing messages
@@ -55,11 +55,11 @@ def foi_attachment_path(foi_attachment, options = {})
end
def comment_url(comment, options = {})
- request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}"))
+ request_url(comment.info_request, options.merge(anchor: "comment-#{comment.id}"))
end
def comment_path(comment, options = {})
- comment_url(comment, options.merge(:only_path => true))
+ comment_url(comment, options.merge(only_path: true))
end
# Used in mailers where we want to give a link to a new response
@@ -67,13 +67,13 @@ def new_response_url(info_request, incoming_message)
if info_request.user.is_pro?
# Pro users will always need to log in, so we have to give them a link
# which forces that
- message_url = incoming_message_url(incoming_message, :cachebust => true)
- signin_url(:r => message_url)
+ message_url = incoming_message_url(incoming_message, cachebust: true)
+ signin_url(r: message_url)
else
# For normal users, we try not to use a login link here, just the
# actual URL. This is because people tend to forward these emails
# amongst themselves.
- incoming_message_url(incoming_message, :cachebust => true)
+ incoming_message_url(incoming_message, cachebust: true)
end
end
@@ -81,23 +81,23 @@ def new_response_url(info_request, incoming_message)
def respond_to_last_url(info_request, options = {})
last_response = info_request.get_last_public_response
if last_response.nil?
- new_request_followup_url(options.merge(:request_id => info_request.id))
+ new_request_followup_url(options.merge(request_id: info_request.id))
else
- new_request_incoming_followup_url(options.merge(:request_id => info_request.id, :incoming_message_id => last_response.id))
+ new_request_incoming_followup_url(options.merge(request_id: info_request.id, incoming_message_id: last_response.id))
end
end
def respond_to_last_path(info_request, options = {})
- respond_to_last_url(info_request, options.merge(:only_path => true))
+ respond_to_last_url(info_request, options.merge(only_path: true))
end
# Public bodies
def public_body_url(public_body, options = {})
- public_body.url_name.nil? ? '' : show_public_body_url(options.merge(:url_name => public_body.url_name))
+ public_body.url_name.nil? ? '' : show_public_body_url(options.merge(url_name: public_body.url_name))
end
def public_body_path(public_body, options = {})
- public_body_url(public_body, options.merge(:only_path => true))
+ public_body_url(public_body, options.merge(only_path: true))
end
def public_body_link_short(public_body)
@@ -105,7 +105,7 @@ def public_body_link_short(public_body)
end
def public_body_link(public_body, cls=nil)
- link_to public_body.name, public_body_path(public_body), :class => cls
+ link_to public_body.name, public_body_path(public_body), class: cls
end
def public_body_link_absolute(public_body) # e.g. for in RSS
@@ -114,15 +114,15 @@ def public_body_link_absolute(public_body) # e.g. for in RSS
# Users
def user_url(user, options = {})
- show_user_url(options.merge(:url_name => user.url_name))
+ show_user_url(options.merge(url_name: user.url_name))
end
def user_path(user, options = {})
- user_url(user, options.merge(:only_path => true))
+ user_url(user, options.merge(only_path: true))
end
def user_link(user, cls=nil)
- link_to user.name, user_path(user), :class => cls
+ link_to user.name, user_path(user), class: cls
end
def user_link_for_request(request, cls=nil)
@@ -134,7 +134,7 @@ def user_link_for_request(request, cls=nil)
user_name
end
else
- link_to request.user.name, user_path(request.user), :class => cls
+ link_to request.user.name, user_path(request.user), class: cls
end
end
@@ -159,9 +159,9 @@ def external_user_link(request, absolute, text)
request.external_user_name
else
if absolute
- url = help_privacy_url(:anchor => 'anonymous')
+ url = help_privacy_url(anchor: 'anonymous')
else
- url = help_privacy_path(:anchor => 'anonymous')
+ url = help_privacy_path(anchor: 'anonymous')
end
link_to(text, url)
end
@@ -204,30 +204,30 @@ def user_or_you_capital_link(user)
end
def user_admin_link(user, name="admin", cls=nil)
- link_to name, admin_user_url(user), :class => cls
+ link_to name, admin_user_url(user), class: cls
end
# Tracks. feed can be 'track' or 'feed'
def do_track_url(track_thing, feed = 'track', options = {})
if track_thing.track_type == 'request_updates'
- track_request_url(options.merge(:url_title => track_thing.info_request.url_title, :feed => feed))
+ track_request_url(options.merge(url_title: track_thing.info_request.url_title, feed: feed))
elsif track_thing.track_type == 'all_new_requests'
- track_list_url(options.merge(:view => 'recent', :feed => feed))
+ track_list_url(options.merge(view: 'recent', feed: feed))
elsif track_thing.track_type == 'all_successful_requests'
- track_list_url(options.merge(:view => 'successful', :feed => feed))
+ track_list_url(options.merge(view: 'successful', feed: feed))
elsif track_thing.track_type == 'public_body_updates'
- track_public_body_url(options.merge(:url_name => track_thing.public_body.url_name, :feed => feed))
+ track_public_body_url(options.merge(url_name: track_thing.public_body.url_name, feed: feed))
elsif track_thing.track_type == 'user_updates'
- track_user_url(options.merge(:url_name => track_thing.tracked_user.url_name, :feed => feed))
+ track_user_url(options.merge(url_name: track_thing.tracked_user.url_name, feed: feed))
elsif track_thing.track_type == 'search_query'
- track_search_url(options.merge(:query_array => track_thing.track_query, :feed => feed))
+ track_search_url(options.merge(query_array: track_thing.track_query, feed: feed))
else
raise "unknown tracking type " + track_thing.track_type
end
end
def do_track_path(track_thing, feed = 'track', options = {})
- do_track_url(track_thing, feed, options.merge(:only_path => true))
+ do_track_url(track_thing, feed, options.merge(only_path: true))
end
# General pages.
@@ -236,10 +236,10 @@ def search_url(query, options = nil)
query = query - ["", nil]
query = query.join("/")
end
- routing_info = {:controller => 'general',
- :action => 'search',
- :combined => query,
- :view => nil}
+ routing_info = {controller: 'general',
+ action: 'search',
+ combined: query,
+ view: nil}
routing_info = options.merge(routing_info) if !options.nil?
if routing_info.kind_of?(Hash)
@@ -267,7 +267,7 @@ def search_url(query, options = nil)
end
def search_path(query, options = {})
- search_url(query, options.merge(:only_path => true))
+ search_url(query, options.merge(only_path: true))
end
def search_link(query)
@@ -320,7 +320,7 @@ def message_url(message, options = {})
end
def message_path(message, options = {})
- message_url(message, options.merge(:only_path => true))
+ message_url(message, options.merge(only_path: true))
end
def dom_id(record, prefix = nil)
diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb
index cbb8817350..2fb564ed38 100644
--- a/app/helpers/public_body_helper.rb
+++ b/app/helpers/public_body_helper.rb
@@ -23,8 +23,8 @@ def public_body_not_requestable_reasons(public_body)
# Make the authority appear requestable to encourage users to help find
# the authority's email address
msg = link_to _("Make a request to this authority"),
- new_request_to_body_path(:url_name => public_body.url_name),
- :class => "link_button_green"
+ new_request_to_body_path(url_name: public_body.url_name),
+ class: "link_button_green"
reasons.push(msg)
end
@@ -48,7 +48,7 @@ def type_of_authority(public_body)
end
if types.any?
- types.to_sentence(:last_word_connector => ' and ').html_safe
+ types.to_sentence(last_word_connector: ' and ').html_safe
else
_("A public authority")
end
diff --git a/app/helpers/track_helper.rb b/app/helpers/track_helper.rb
index 40f9297fb7..c054ebeb83 100644
--- a/app/helpers/track_helper.rb
+++ b/app/helpers/track_helper.rb
@@ -4,22 +4,22 @@ def already_subscribed_notice(track_thing)
case track_thing.track_type
when 'request_updates'
_("You are already subscribed to '{{link_to_request}}', a request.",
- :link_to_request => request_link(track_thing.info_request))
+ link_to_request: request_link(track_thing.info_request))
when 'all_new_requests'
_('You are already subscribed to any new requests.',
- :new_requests_url => request_list_path)
+ new_requests_url: request_list_path)
when 'all_successful_requests'
_('You are already subscribed to any successful requests.',
- :successful_requests_url => request_list_successful_path )
+ successful_requests_url: request_list_successful_path )
when 'public_body_updates'
_("You are already subscribed to '{{link_to_authority}}', a public authority.",
- :link_to_authority => public_body_link(track_thing.public_body))
+ link_to_authority: public_body_link(track_thing.public_body))
when 'user_updates'
_("You are already subscribed to '{{link_to_user}}', a person.",
- :link_to_user => user_link(track_thing.tracked_user))
+ link_to_user: user_link(track_thing.tracked_user))
when 'search_query'
_('You are already subscribed to this search.',
- :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ search_url: search_path([track_thing.track_query, 'newest', 'advanced']))
end
end
@@ -27,52 +27,52 @@ def subscribe_email_notice(track_thing)
case track_thing.track_type
when 'request_updates'
_("You will now be emailed updates about '{{link_to_request}}', a request.",
- :link_to_request => request_link(track_thing.info_request))
+ link_to_request: request_link(track_thing.info_request))
when 'all_new_requests'
_('You will now be emailed updates about any new requests.',
- :new_requests_url => request_list_path)
+ new_requests_url: request_list_path)
when 'all_successful_requests'
_('You will now be emailed updates about successful requests.',
- :successful_requests_url => request_list_successful_path )
+ successful_requests_url: request_list_successful_path )
when 'public_body_updates'
_("You will now be emailed updates about '{{link_to_authority}}', a public authority.",
- :link_to_authority => public_body_link(track_thing.public_body))
+ link_to_authority: public_body_link(track_thing.public_body))
when 'user_updates'
_("You will now be emailed updates about '{{link_to_user}}', a person.",
- :link_to_user => user_link(track_thing.tracked_user))
+ link_to_user: user_link(track_thing.tracked_user))
when 'search_query'
_("You will now be emailed updates about this search.",
- :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ search_url: search_path([track_thing.track_query, 'newest', 'advanced']))
end
end
def subscribe_follow_notice(track_thing)
- wall_url_user = show_user_wall_path(:url_name => track_thing.tracking_user.url_name)
+ wall_url_user = show_user_wall_path(url_name: track_thing.tracking_user.url_name)
case track_thing.track_type
when 'request_updates'
_('You are now following updates about \'{{link_to_request}}\', a request.',
- :link_to_request => request_link(track_thing.info_request),
- :wall_url_user => wall_url_user)
+ link_to_request: request_link(track_thing.info_request),
+ wall_url_user: wall_url_user)
when 'all_new_requests'
_('You are now following updates about new requests.',
- :new_requests_url => request_list_path,
- :wall_url_user => wall_url_user)
+ new_requests_url: request_list_path,
+ wall_url_user: wall_url_user)
when 'all_successful_requests'
_('You are now following updates about successful requests.',
- :successful_requests_url => request_list_successful_path,
- :wall_url_user => wall_url_user)
+ successful_requests_url: request_list_successful_path,
+ wall_url_user: wall_url_user)
when 'public_body_updates'
_('You are now following updates about \'{{link_to_authority}}\', a public authority.',
- :wall_url_user => wall_url_user,
- :link_to_authority => public_body_link(track_thing.public_body))
+ wall_url_user: wall_url_user,
+ link_to_authority: public_body_link(track_thing.public_body))
when 'user_updates'
_('You are now following updates about \'{{link_to_user}}\', a person.',
- :wall_url_user => wall_url_user,
- :link_to_user => user_link(track_thing.tracked_user))
+ wall_url_user: wall_url_user,
+ link_to_user: user_link(track_thing.tracked_user))
when 'search_query'
_('You are now following updates about this search.',
- :wall_url_user => wall_url_user,
- :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ wall_url_user: wall_url_user,
+ search_url: search_path([track_thing.track_query, 'newest', 'advanced']))
end
end
@@ -80,22 +80,22 @@ def unsubscribe_notice(track_thing)
case track_thing.track_type
when 'request_updates'
_("You are no longer following '{{link_to_request}}', a request.",
- :link_to_request => request_link(track_thing.info_request))
+ link_to_request: request_link(track_thing.info_request))
when 'all_new_requests'
_('You are no longer following new requests.',
- :new_requests_url => request_list_path)
+ new_requests_url: request_list_path)
when 'all_successful_requests'
_('You are no longer following successful requests.',
- :successful_requests_url => request_list_successful_path )
+ successful_requests_url: request_list_successful_path )
when 'public_body_updates'
_("You are no longer following '{{link_to_authority}}', a public authority.",
- :link_to_authority => public_body_link(track_thing.public_body))
+ link_to_authority: public_body_link(track_thing.public_body))
when 'user_updates'
_("You are no longer following '{{link_to_user}}', a person.",
- :link_to_user => user_link(track_thing.tracked_user))
+ link_to_user: user_link(track_thing.tracked_user))
when 'search_query'
_('You are no longer following this search.',
- :search_url => search_path([track_thing.track_query, 'newest', 'advanced']))
+ search_url: search_path([track_thing.track_query, 'newest', 'advanced']))
end
end
@@ -103,17 +103,17 @@ def track_description(track_thing)
case track_thing.track_type
when 'request_updates'
_("'{{link_to_request}}', a request",
- :link_to_request => request_link(track_thing.info_request))
+ link_to_request: request_link(track_thing.info_request))
when 'all_new_requests'
link_to(_('new requests'), request_list_path)
when 'all_successful_requests'
link_to(_('successful requests'), request_list_successful_path)
when 'public_body_updates'
_("'{{link_to_authority}}', a public authority",
- :link_to_authority => public_body_link(track_thing.public_body))
+ link_to_authority: public_body_link(track_thing.public_body))
when 'user_updates'
_("'{{link_to_user}}', a person",
- :link_to_user => user_link(track_thing.tracked_user))
+ link_to_user: user_link(track_thing.tracked_user))
when 'search_query'
link_to(track_thing.track_query_description,
search_path([track_thing.track_query, 'newest', 'advanced']))
From e8465c776aa8b7f068739a5c8d5d640ff95ea6f0 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:01:30 +0000
Subject: [PATCH 097/289] Style: HashSyntax Rubocop (app models)
---
app/models/alaveteli_pro/account_request.rb | 8 +-
.../alaveteli_pro/activity_list/comment.rb | 6 +-
.../alaveteli_pro/activity_list/item.rb | 4 +-
.../alaveteli_pro/activity_list/list.rb | 6 +-
.../alaveteli_pro/activity_list/overdue.rb | 2 +-
.../activity_list/very_overdue.rb | 6 +-
.../alaveteli_pro/draft_info_request_batch.rb | 4 +-
app/models/alaveteli_pro/embargo.rb | 10 +-
app/models/alaveteli_pro/embargo_extension.rb | 2 +-
app/models/alaveteli_pro/request_filter.rb | 56 ++---
app/models/alaveteli_pro/request_summary.rb | 6 +-
.../alaveteli_pro/request_summary_category.rb | 4 +-
.../to_do_list/expiring_embargo.rb | 2 +-
.../alaveteli_pro/to_do_list/new_response.rb | 2 +-
.../to_do_list/overdue_request.rb | 2 +-
.../to_do_list/very_overdue_request.rb | 2 +-
app/models/censor_rule.rb | 8 +-
.../alaveteli_pro/request_summaries.rb | 8 +-
app/models/concerns/translatable.rb | 4 +-
app/models/draft_info_request.rb | 4 +-
app/models/foi_attachment.rb | 6 +-
app/models/holiday_import.rb | 12 +-
app/models/incoming_message.rb | 22 +-
app/models/info_request.rb | 208 +++++++++---------
app/models/info_request/pro_query.rb | 4 +-
.../response_gatekeeper/spam_checker.rb | 8 +-
.../response_rejection/holding_pen.rb | 2 +-
app/models/info_request/state.rb | 2 +-
app/models/info_request_batch.rb | 50 ++---
app/models/info_request_event.rb | 76 +++----
app/models/mail_server_log.rb | 10 +-
.../delivery_status/translated_constants.rb | 16 +-
app/models/mail_server_log_done.rb | 2 +-
app/models/notification.rb | 4 +-
app/models/outgoing_message.rb | 34 +--
app/models/post_redirect.rb | 4 +-
app/models/pro_account.rb | 2 +-
app/models/profile_photo.rb | 10 +-
app/models/public_body.rb | 134 ++++++-----
app/models/public_body_change_request.rb | 28 +--
app/models/raw_email.rb | 8 +-
app/models/request_classification.rb | 6 +-
app/models/track_thing.rb | 174 +++++++--------
app/models/track_things_sent_email.rb | 8 +-
app/models/user.rb | 2 +-
app/models/user/transaction_calculator.rb | 2 +-
app/models/user_info_request_sent_alert.rb | 8 +-
app/models/widget_vote.rb | 4 +-
48 files changed, 495 insertions(+), 497 deletions(-)
diff --git a/app/models/alaveteli_pro/account_request.rb b/app/models/alaveteli_pro/account_request.rb
index 402fd9e148..05ed9c88d9 100644
--- a/app/models/alaveteli_pro/account_request.rb
+++ b/app/models/alaveteli_pro/account_request.rb
@@ -12,10 +12,10 @@ class AlaveteliPro::AccountRequest
:marketing_emails,
:training_emails
- validates_presence_of :email, :message => N_("Please enter your email address")
- validates_presence_of :reason, :message => N_("Please enter the reason why you want access")
- validates_presence_of :marketing_emails, :message => N_("Please tell us if you want to get updates")
- validates_presence_of :training_emails, :message => N_("Please tell us if you're interested in training and seminars")
+ validates_presence_of :email, message: N_("Please enter your email address")
+ validates_presence_of :reason, message: N_("Please enter the reason why you want access")
+ validates_presence_of :marketing_emails, message: N_("Please tell us if you want to get updates")
+ validates_presence_of :training_emails, message: N_("Please tell us if you're interested in training and seminars")
validate :email_format
diff --git a/app/models/alaveteli_pro/activity_list/comment.rb b/app/models/alaveteli_pro/activity_list/comment.rb
index ffc5caede6..4780614d36 100644
--- a/app/models/alaveteli_pro/activity_list/comment.rb
+++ b/app/models/alaveteli_pro/activity_list/comment.rb
@@ -13,9 +13,9 @@ def description
end
def description_urls
- { :public_body_name => { :text => body_name, :url => body_path },
- :info_request_title => { :text => info_request_title, :url => info_request_path },
- :commenter_name => { :text => event.comment.user.name, :url => user_path(event.comment.user) } }
+ { public_body_name: { text: body_name, url: body_path },
+ info_request_title: { text: info_request_title, url: info_request_path },
+ commenter_name: { text: event.comment.user.name, url: user_path(event.comment.user) } }
end
def call_to_action_url
diff --git a/app/models/alaveteli_pro/activity_list/item.rb b/app/models/alaveteli_pro/activity_list/item.rb
index a943f0e76f..5956f0b085 100644
--- a/app/models/alaveteli_pro/activity_list/item.rb
+++ b/app/models/alaveteli_pro/activity_list/item.rb
@@ -33,8 +33,8 @@ def call_to_action
end
def description_urls
- { :public_body_name => { :text => body_name, :url => body_path },
- :info_request_title => { :text => info_request_title, :url => info_request_path } }
+ { public_body_name: { text: body_name, url: body_path },
+ info_request_title: { text: info_request_title, url: info_request_path } }
end
def event_time
diff --git a/app/models/alaveteli_pro/activity_list/list.rb b/app/models/alaveteli_pro/activity_list/list.rb
index 8a64c803a9..aa33ffa934 100644
--- a/app/models/alaveteli_pro/activity_list/list.rb
+++ b/app/models/alaveteli_pro/activity_list/list.rb
@@ -15,12 +15,12 @@ def event_types
end
def events
- user.info_request_events.where(:event_type => event_types)
+ user.info_request_events.where(event_type: event_types)
end
def current_items
- current_events = events.paginate :page => page,
- :per_page => per_page
+ current_events = events.paginate page: page,
+ per_page: per_page
current_events.map { |event| activity_types[event.event_type].new(event) }
end
diff --git a/app/models/alaveteli_pro/activity_list/overdue.rb b/app/models/alaveteli_pro/activity_list/overdue.rb
index 5c6aaea3fe..2603c64c18 100644
--- a/app/models/alaveteli_pro/activity_list/overdue.rb
+++ b/app/models/alaveteli_pro/activity_list/overdue.rb
@@ -11,7 +11,7 @@ def call_to_action
end
def call_to_action_url
- new_request_followup_path(:request_id => event.info_request.id, :anchor => 'followup')
+ new_request_followup_path(request_id: event.info_request.id, anchor: 'followup')
end
end
diff --git a/app/models/alaveteli_pro/activity_list/very_overdue.rb b/app/models/alaveteli_pro/activity_list/very_overdue.rb
index a5175b661b..385d57db9a 100644
--- a/app/models/alaveteli_pro/activity_list/very_overdue.rb
+++ b/app/models/alaveteli_pro/activity_list/very_overdue.rb
@@ -11,9 +11,9 @@ def call_to_action
end
def call_to_action_url
- new_request_followup_path(:request_id => event.info_request.id,
- :anchor => 'followup',
- :internal_review => 1)
+ new_request_followup_path(request_id: event.info_request.id,
+ anchor: 'followup',
+ internal_review: 1)
end
end
diff --git a/app/models/alaveteli_pro/draft_info_request_batch.rb b/app/models/alaveteli_pro/draft_info_request_batch.rb
index d34faf6c52..9b5f7c7e03 100644
--- a/app/models/alaveteli_pro/draft_info_request_batch.rb
+++ b/app/models/alaveteli_pro/draft_info_request_batch.rb
@@ -17,13 +17,13 @@ class AlaveteliPro::DraftInfoRequestBatch < ApplicationRecord
include InfoRequest::DraftTitleValidation
belongs_to :user,
- :inverse_of => :draft_info_request_batches
+ inverse_of: :draft_info_request_batches
has_and_belongs_to_many :public_bodies, -> {
AlaveteliLocalization.with_locale(AlaveteliLocalization.locale) do
includes(:translations).
reorder('public_body_translations.name asc')
end
- }, :inverse_of => :draft_info_request_batches
+ }, inverse_of: :draft_info_request_batches
validates_presence_of :user
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index 4b502fcb38..588e1087ad 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -15,12 +15,12 @@
module AlaveteliPro
class Embargo < ApplicationRecord
belongs_to :info_request,
- :inverse_of => :embargo
+ inverse_of: :embargo
has_many :embargo_extensions,
- :inverse_of => :embargo
+ inverse_of: :embargo
has_one :user,
- :inverse_of => :embargoes,
- :through => :info_request
+ inverse_of: :embargoes,
+ through: :info_request
validates_presence_of :info_request
validates_presence_of :publish_at
@@ -141,7 +141,7 @@ def add_set_embargo_event
publish_at_changed = publish_at_changed?
yield
if publish_at_changed
- params = { :embargo_id => id }
+ params = { embargo_id: id }
params[:embargo_extension_id] = extension.id if extension
info_request.log_event('set_embargo', params)
end
diff --git a/app/models/alaveteli_pro/embargo_extension.rb b/app/models/alaveteli_pro/embargo_extension.rb
index 3b2e7ae15e..5e223b2f51 100644
--- a/app/models/alaveteli_pro/embargo_extension.rb
+++ b/app/models/alaveteli_pro/embargo_extension.rb
@@ -13,7 +13,7 @@
module AlaveteliPro
class EmbargoExtension < ApplicationRecord
belongs_to :embargo,
- :inverse_of => :embargo_extensions
+ inverse_of: :embargo_extensions
validates_presence_of :embargo
validates_presence_of :extension_duration
validates_inclusion_of :extension_duration,
diff --git a/app/models/alaveteli_pro/request_filter.rb b/app/models/alaveteli_pro/request_filter.rb
index 7f9f4b3f33..ef26664775 100644
--- a/app/models/alaveteli_pro/request_filter.rb
+++ b/app/models/alaveteli_pro/request_filter.rb
@@ -67,18 +67,18 @@ def default_order
def order_attributes
[
- { :param => 'updated_at_desc',
- :value => 'request_updated_at DESC',
- :label => _('last updated'),
- :capital_label => _('Last updated') },
- { :param => 'created_at_asc',
- :value => 'request_created_at ASC',
- :label => _('first created'),
- :capital_label => _('First created') },
- { :param => 'title_asc',
- :value => 'title ASC',
- :label => _('title (A-Z)'),
- :capital_label => _('Title (A-Z)') }
+ { param: 'updated_at_desc',
+ value: 'request_updated_at DESC',
+ label: _('last updated'),
+ capital_label: _('Last updated') },
+ { param: 'created_at_asc',
+ value: 'request_created_at ASC',
+ label: _('first created'),
+ capital_label: _('First created') },
+ { param: 'title_asc',
+ value: 'title ASC',
+ label: _('title (A-Z)'),
+ capital_label: _('Title (A-Z)') }
]
end
@@ -104,27 +104,27 @@ def order_value
def default_filters
[
- { :param => nil,
- :value => nil,
- :label => _('all requests'),
- :capital_label => _('All requests') },
- { :param => 'draft',
- :value => :draft,
- :label => _('drafts'),
- :capital_label => _('Drafts') },
- { :param => 'embargoes_expiring',
- :value => :embargo_expiring,
- :label => _('requests that will be made public soon'),
- :capital_label => _('Requests that will be made public soon')
+ { param: nil,
+ value: nil,
+ label: _('all requests'),
+ capital_label: _('All requests') },
+ { param: 'draft',
+ value: :draft,
+ label: _('drafts'),
+ capital_label: _('Drafts') },
+ { param: 'embargoes_expiring',
+ value: :embargo_expiring,
+ label: _('requests that will be made public soon'),
+ capital_label: _('Requests that will be made public soon')
}
]
end
def phase_filters
- InfoRequest::State.phases.map { |phase| { :param => phase[:scope].to_s,
- :value => phase[:scope],
- :label => phase[:label],
- :capital_label => phase[:capital_label] } }
+ InfoRequest::State.phases.map { |phase| { param: phase[:scope].to_s,
+ value: phase[:scope],
+ label: phase[:label],
+ capital_label: phase[:capital_label] } }
end
def filter_attributes
diff --git a/app/models/alaveteli_pro/request_summary.rb b/app/models/alaveteli_pro/request_summary.rb
index dd8498d9ad..7a3f1533e0 100644
--- a/app/models/alaveteli_pro/request_summary.rb
+++ b/app/models/alaveteli_pro/request_summary.rb
@@ -19,10 +19,10 @@
class AlaveteliPro::RequestSummary < ApplicationRecord
belongs_to :summarisable, polymorphic: true
belongs_to :user,
- :inverse_of => :request_summaries
+ inverse_of: :request_summaries
has_and_belongs_to_many :request_summary_categories,
- :class_name => "AlaveteliPro::RequestSummaryCategory",
- :inverse_of => :request_summaries
+ class_name: "AlaveteliPro::RequestSummaryCategory",
+ inverse_of: :request_summaries
validates_presence_of :summarisable,
:request_created_at,
diff --git a/app/models/alaveteli_pro/request_summary_category.rb b/app/models/alaveteli_pro/request_summary_category.rb
index 980921d8d4..d71c1194bc 100644
--- a/app/models/alaveteli_pro/request_summary_category.rb
+++ b/app/models/alaveteli_pro/request_summary_category.rb
@@ -11,8 +11,8 @@
class AlaveteliPro::RequestSummaryCategory < ApplicationRecord
has_and_belongs_to_many :request_summaries,
- :class_name => "AlaveteliPro::RequestSummary",
- :inverse_of => :request_summary_categories
+ class_name: "AlaveteliPro::RequestSummary",
+ inverse_of: :request_summary_categories
def self.draft
return find_by(slug: "draft")
diff --git a/app/models/alaveteli_pro/to_do_list/expiring_embargo.rb b/app/models/alaveteli_pro/to_do_list/expiring_embargo.rb
index ee93b7eaad..5f6815a78c 100644
--- a/app/models/alaveteli_pro/to_do_list/expiring_embargo.rb
+++ b/app/models/alaveteli_pro/to_do_list/expiring_embargo.rb
@@ -6,7 +6,7 @@ def description
n_("{{count}} request will be made public this week.",
"{{count}} requests will be made public this week.",
count,
- :count => count)
+ count: count)
end
def items
diff --git a/app/models/alaveteli_pro/to_do_list/new_response.rb b/app/models/alaveteli_pro/to_do_list/new_response.rb
index af929f2944..8bef8e6d80 100644
--- a/app/models/alaveteli_pro/to_do_list/new_response.rb
+++ b/app/models/alaveteli_pro/to_do_list/new_response.rb
@@ -6,7 +6,7 @@ def description
n_("{{count}} request has received a response.",
"{{count}} requests have received a response.",
count,
- :count => count)
+ count: count)
end
def items
diff --git a/app/models/alaveteli_pro/to_do_list/overdue_request.rb b/app/models/alaveteli_pro/to_do_list/overdue_request.rb
index 0811b3c3ed..9586da3c46 100644
--- a/app/models/alaveteli_pro/to_do_list/overdue_request.rb
+++ b/app/models/alaveteli_pro/to_do_list/overdue_request.rb
@@ -6,7 +6,7 @@ def description
n_("{{count}} request is delayed.",
"{{count}} requests are delayed.",
count,
- :count => count)
+ count: count)
end
def items
diff --git a/app/models/alaveteli_pro/to_do_list/very_overdue_request.rb b/app/models/alaveteli_pro/to_do_list/very_overdue_request.rb
index 1bef1bbfa6..0c0655c5e8 100644
--- a/app/models/alaveteli_pro/to_do_list/very_overdue_request.rb
+++ b/app/models/alaveteli_pro/to_do_list/very_overdue_request.rb
@@ -6,7 +6,7 @@ def description
n_("{{count}} request is long overdue.",
"{{count}} requests are long overdue.",
count,
- :count => count)
+ count: count)
end
def items
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index 1e05173989..1245076b6e 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -32,13 +32,13 @@ class CensorRule < ApplicationRecord
].freeze
belongs_to :info_request,
- :inverse_of => :censor_rules
+ inverse_of: :censor_rules
belongs_to :user,
- :inverse_of => :censor_rules
+ inverse_of: :censor_rules
belongs_to :public_body,
- :inverse_of => :censor_rules
+ inverse_of: :censor_rules
- validate :require_valid_regexp, :if => proc { |rule| rule.regexp? == true }
+ validate :require_valid_regexp, if: proc { |rule| rule.regexp? == true }
validates_presence_of :text,
:replacement,
diff --git a/app/models/concerns/alaveteli_pro/request_summaries.rb b/app/models/concerns/alaveteli_pro/request_summaries.rb
index daa0e6b1fc..5ee8da0506 100644
--- a/app/models/concerns/alaveteli_pro/request_summaries.rb
+++ b/app/models/concerns/alaveteli_pro/request_summaries.rb
@@ -4,11 +4,11 @@ module RequestSummaries
extend ActiveSupport::Concern
included do
- has_one :request_summary, :as => :summarisable,
- :class_name => "AlaveteliPro::RequestSummary",
- :dependent => :destroy
+ has_one :request_summary, as: :summarisable,
+ class_name: "AlaveteliPro::RequestSummary",
+ dependent: :destroy
after_commit :create_or_update_request_summary,
- :on => [:create, :update]
+ on: [:create, :update]
end
# Creates a RequestSummary item for this model on first save, or updates
diff --git a/app/models/concerns/translatable.rb b/app/models/concerns/translatable.rb
index 8278fe892a..47a040ade9 100644
--- a/app/models/concerns/translatable.rb
+++ b/app/models/concerns/translatable.rb
@@ -2,7 +2,7 @@ module Translatable
extend ActiveSupport::Concern
included do
- accepts_nested_attributes_for :translations, :reject_if => :empty_translation_in_params?
+ accepts_nested_attributes_for :translations, reject_if: :empty_translation_in_params?
end
def find_translation_by_locale(locale)
@@ -24,7 +24,7 @@ def ordered_translations
def build_all_translations
AlaveteliLocalization.available_locales.each do |locale|
if translations.none? { |translation| translation.locale.to_s == locale }
- translations.build(:locale => locale)
+ translations.build(locale: locale)
end
end
end
diff --git a/app/models/draft_info_request.rb b/app/models/draft_info_request.rb
index e8b1031add..b5f718c3ca 100644
--- a/app/models/draft_info_request.rb
+++ b/app/models/draft_info_request.rb
@@ -20,8 +20,8 @@ class DraftInfoRequest < ApplicationRecord
validates_presence_of :user
belongs_to :user,
- :inverse_of => :draft_info_requests
- belongs_to :public_body, :inverse_of => :draft_info_requests
+ inverse_of: :draft_info_requests
+ belongs_to :public_body, inverse_of: :draft_info_requests
strip_attributes
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index ab21db2f76..639587d3f1 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -31,7 +31,7 @@ class FoiAttachment < ApplicationRecord
include MessageProminence
belongs_to :incoming_message,
- :inverse_of => :foi_attachments
+ inverse_of: :foi_attachments
has_one_attached :file, service: :attachments
@@ -39,7 +39,7 @@ class FoiAttachment < ApplicationRecord
validates_presence_of :filename
validates_presence_of :display_size
- before_validation :ensure_filename!, :only => [:filename]
+ before_validation :ensure_filename!, only: [:filename]
before_destroy :delete_cached_file!
scope :binary, -> { where.not(content_type: AlaveteliTextMasker::TextMask) }
@@ -295,7 +295,7 @@ def name_of_content_type
# For "View as HTML" of attachment
def body_as_html(dir, opts = {})
attachment_url = opts.fetch(:attachment_url, nil)
- to_html_opts = opts.merge(:tmpdir => dir, :attachment_url => attachment_url)
+ to_html_opts = opts.merge(tmpdir: dir, attachment_url: attachment_url)
AttachmentToHTML.to_html(self, to_html_opts)
end
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index 8b2aff6bc4..f1b0f3304d 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -12,9 +12,9 @@ class HolidayImport
:populated
validate :all_holidays_valid
- validates_inclusion_of :source, :in => %w( suggestions feed )
+ validates_inclusion_of :source, in: %w( suggestions feed )
validates_presence_of :ical_feed_url,
- :if => proc { |holiday_import| holiday_import.source == 'feed' }
+ if: proc { |holiday_import| holiday_import.source == 'feed' }
def initialize(opts = {})
@populated = false
@@ -89,8 +89,8 @@ def populate_from_ical_feed
def populate_from_ical_event(cal_event)
if cal_event.dtstart >= start_date and cal_event.dtstart <= end_date
- holidays << Holiday.new(:description => cal_event.summary,
- :day => cal_event.dtstart)
+ holidays << Holiday.new(description: cal_event.summary,
+ day: cal_event.dtstart)
end
end
@@ -98,8 +98,8 @@ def populate_from_suggestions
begin
holiday_info = Holidays.between(start_date, end_date, @country_code.to_sym, :observed)
holiday_info.each do |holiday_info_hash|
- holidays << Holiday.new(:description => holiday_info_hash[:name],
- :day => holiday_info_hash[:date])
+ holidays << Holiday.new(description: holiday_info_hash[:name],
+ day: holiday_info_hash[:date])
end
rescue Holidays::InvalidRegion
[]
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index d5f8c712be..b04240d6fb 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -52,10 +52,10 @@ class IncomingMessage < ApplicationRecord
validates_presence_of :raw_email
has_many :outgoing_message_followups,
- :inverse_of => :incoming_message_followup,
- :foreign_key => 'incoming_message_followup_id',
- :class_name => 'OutgoingMessage',
- :dependent => :nullify
+ inverse_of: :incoming_message_followup,
+ foreign_key: 'incoming_message_followup_id',
+ class_name: 'OutgoingMessage',
+ dependent: :nullify
has_many :foi_attachments,
-> { order(:id) },
inverse_of: :incoming_message,
@@ -63,12 +63,12 @@ class IncomingMessage < ApplicationRecord
autosave: true
# never really has many info_request_events, but could in theory
has_many :info_request_events,
- :dependent => :destroy,
- :inverse_of => :incoming_message
+ dependent: :destroy,
+ inverse_of: :incoming_message
belongs_to :raw_email,
- :inverse_of => :incoming_message,
- :dependent => :destroy
+ inverse_of: :incoming_message,
+ dependent: :destroy
after_destroy :update_request
after_update :update_request
@@ -201,8 +201,8 @@ def self.get_attachment_by_url_part_number_and_filename!(
end
def apply_masks(text, content_type)
- mask_options = { :censor_rules => info_request.applicable_censor_rules,
- :masks => info_request.masks }
+ mask_options = { censor_rules: info_request.applicable_censor_rules,
+ masks: info_request.masks }
AlaveteliTextMasker.apply_masks(text, content_type, mask_options)
end
@@ -516,7 +516,7 @@ def get_body_for_html_display(collapse_quoted_sections = true)
text = folded_quoted_text if collapse_quoted_sections
text = MySociety::Format.simplify_angle_bracketed_urls(text)
text = CGI.escapeHTML(text)
- text = MySociety::Format.make_clickable(text, :contract => 1)
+ text = MySociety::Format.make_clickable(text, contract: 1)
# add a helpful link to email addresses and mobile numbers removed
# by apply_masks
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 71d77d255f..7532d94b4b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -59,46 +59,46 @@ def self.admin_title
'Request'
end
- strip_attributes :allow_empty => true
- strip_attributes :only => [:title],
- :replace_newlines => true, :collapse_spaces => true
+ strip_attributes allow_empty: true
+ strip_attributes only: [:title],
+ replace_newlines: true, collapse_spaces: true
belongs_to :user,
- :inverse_of => :info_requests,
- :counter_cache => true
+ inverse_of: :info_requests,
+ counter_cache: true
validate :must_be_internal_or_external
belongs_to :public_body,
- :inverse_of => :info_requests,
- :counter_cache => true
+ inverse_of: :info_requests,
+ counter_cache: true
belongs_to :info_request_batch,
- :inverse_of => :info_requests
+ inverse_of: :info_requests
validates_presence_of :public_body, message: N_("Please select an authority")
has_many :info_request_events,
-> { order(:created_at, :id) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :outgoing_messages,
-> { order(:created_at) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :incoming_messages,
-> { order(:created_at) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :user_info_request_sent_alerts,
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :track_things,
-> { order(created_at: :desc) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :widget_votes,
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :citations,
-> (info_request) { unscope(:where).for_request(info_request) },
as: :citable,
@@ -106,20 +106,20 @@ def self.admin_title
dependent: :destroy
has_many :comments,
-> { order(:created_at) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :censor_rules,
-> { order(created_at: :desc) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_many :mail_server_logs,
-> { order(:mail_server_log_done_id, :order) },
- :inverse_of => :info_request,
- :dependent => :destroy
+ inverse_of: :info_request,
+ dependent: :destroy
has_one :embargo,
- :inverse_of => :info_request,
- :class_name => 'AlaveteliPro::Embargo',
- :dependent => :destroy
+ inverse_of: :info_request,
+ class_name: 'AlaveteliPro::Embargo',
+ dependent: :destroy
has_many :foi_attachments, through: :incoming_messages
@@ -166,18 +166,18 @@ class << self
# user described state (also update in info_request_event, admin_request/edit.rhtml)
validate :must_be_valid_state
- validates_inclusion_of :prominence, :in => Prominence::VALUES
+ validates_inclusion_of :prominence, in: Prominence::VALUES
validates_inclusion_of :law_used, in: Legislation.keys
# who can send new responses
- validates_inclusion_of :allow_new_responses_from, :in => [
+ validates_inclusion_of :allow_new_responses_from, in: [
'anybody', # anyone who knows the request email address
'authority_only', # only people from authority domains
'nobody'
]
# what to do with refused new responses
- validates_inclusion_of :handle_rejected_responses, :in => [
+ validates_inclusion_of :handle_rejected_responses, in: [
'bounce', # return them to sender
'holding_pen', # put them in the holding pen
'blackhole' # just dump them
@@ -358,19 +358,19 @@ def self.holding_pen_request
ir = InfoRequest.find_by_url_title("holding_pen")
if ir.nil?
ir = InfoRequest.new(
- :user => User.internal_admin_user,
- :public_body => PublicBody.internal_admin_body,
- :title => 'Holding pen',
- :described_state => 'waiting_response',
- :awaiting_description => false,
- :prominence => 'hidden'
+ user: User.internal_admin_user,
+ public_body: PublicBody.internal_admin_body,
+ title: 'Holding pen',
+ described_state: 'waiting_response',
+ awaiting_description: false,
+ prominence: 'hidden'
)
om = OutgoingMessage.new({
- :status => 'ready',
- :message_type => 'initial_request',
- :body => 'This is the holding pen request. It shows responses that were sent to invalid addresses, and need moving to the correct request by an adminstrator.',
- :last_sent_at => Time.zone.now,
- :what_doing => 'normal_sort'
+ status: 'ready',
+ message_type: 'initial_request',
+ body: 'This is the holding pen request. It shows responses that were sent to invalid addresses, and need moving to the correct request by an adminstrator.',
+ last_sent_at: Time.zone.now,
+ what_doing: 'normal_sort'
})
ir.outgoing_messages << om
@@ -419,7 +419,7 @@ def self.get_status_description(status)
elsif respond_to?(:theme_display_status)
theme_display_status(status)
else
- raise _("unknown status {{status}}", :status => status)
+ raise _("unknown status {{status}}", status: status)
end
end
@@ -434,9 +434,9 @@ def self.magic_email_for_id(prefix_part, id)
def self.build_from_attributes(info_request_atts, outgoing_message_atts, user=nil)
info_request = new(info_request_atts)
default_message_params = {
- :status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort'
+ status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort'
}
attrs = outgoing_message_atts.merge(default_message_params)
@@ -453,18 +453,18 @@ def self.build_from_attributes(info_request_atts, outgoing_message_atts, user=ni
end
def self.from_draft(draft)
- info_request = new(:title => draft.title,
- :user => draft.user,
- :public_body => draft.public_body)
- info_request.outgoing_messages.new(:body => draft.body,
- :status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ info_request = new(title: draft.title,
+ user: draft.user,
+ public_body: draft.public_body)
+ info_request.outgoing_messages.new(body: draft.body,
+ status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
if draft.embargo_duration
info_request.embargo = AlaveteliPro::Embargo.new(
- :embargo_duration => draft.embargo_duration,
- :info_request => info_request
+ embargo_duration: draft.embargo_duration,
+ info_request: info_request
)
end
info_request
@@ -525,7 +525,7 @@ def self.reject_incoming_at_mta(options)
if options[:dryrun]
0
else
- query.update_all(:reject_incoming_at_mta => true)
+ query.update_all(reject_incoming_at_mta: true)
end
end
@@ -589,17 +589,17 @@ def self.stop_new_responses_on_old_requests
def self.request_list(filters, page, per_page, max_results)
query = InfoRequestEvent.make_query_from_params(filters)
search_options = {
- :limit => 25,
- :offset => (page - 1) * per_page,
- :collapse_by_prefix => 'request_collapse' }
+ limit: 25,
+ offset: (page - 1) * per_page,
+ collapse_by_prefix: 'request_collapse' }
xapian_object = search_events(query, search_options)
list_results = xapian_object.results.map { |r| r[:model] }
matches_estimated = xapian_object.matches_estimated
show_no_more_than = [matches_estimated, max_results].min
- return { :results => list_results,
- :matches_estimated => matches_estimated,
- :show_no_more_than => show_no_more_than }
+ return { results: list_results,
+ matches_estimated: matches_estimated,
+ show_no_more_than: show_no_more_than }
end
def self.recent_requests
@@ -610,8 +610,8 @@ def self.recent_requests
query = 'variety:response (status:successful OR status:partially_successful)'
max_count = 5
search_options = {
- :limit => max_count,
- :collapse_by_prefix => 'request_title_collapse' }
+ limit: max_count,
+ collapse_by_prefix: 'request_title_collapse' }
xapian_object = search_events(query, search_options)
xapian_object.results
@@ -639,7 +639,7 @@ def self.recent_requests
end
def self.find_in_state(state)
- where(:described_state => state).
+ where(described_state: state).
order(:last_event_time)
end
@@ -676,7 +676,7 @@ def self.log_overdue_event_type(event_type)
Time.zone.today,
event_type])
- query.find_each(:batch_size => 100) do |info_request|
+ query.find_each(batch_size: 100) do |info_request|
# Date to DateTime representing beginning of day
created_at = info_request.send(date_field).beginning_of_day + 1.day
event = info_request.log_event(
@@ -726,7 +726,7 @@ def state(opts = {})
end
def indexed_by_search?
- prominence(:decorate => true).is_searchable?
+ prominence(decorate: true).is_searchable?
end
# The request must either be internal, in which case it has
@@ -771,7 +771,7 @@ def user_name_slug
end
def user_json_for_api
- is_external? ? { :name => user_name || _("Anonymous user") } : user.json_for_api
+ is_external? ? { name: user_name || _("Anonymous user") } : user.json_for_api
end
@@custom_states_loaded = false
@@ -858,7 +858,7 @@ def email_subject_followup(opts = {})
incoming_message = opts.fetch(:incoming_message, nil)
html = opts.fetch(:html, true)
if incoming_message.nil? || !incoming_message.valid_to_reply_to? || !incoming_message.subject
- 'Re: ' + email_subject_request(:html => html)
+ 'Re: ' + email_subject_request(html: html)
else
if incoming_message.subject.match(/^Re:/i)
incoming_message.subject
@@ -890,9 +890,9 @@ def already_received?(email, raw_email_data)
end
def receive(email, raw_email_data, *args)
- defaults = { :override_stop_new_responses => false,
- :rejected_reason => nil,
- :source => :internal }
+ defaults = { override_stop_new_responses: false,
+ rejected_reason: nil,
+ source: :internal }
opts = if args.first.is_a?(Hash)
defaults.merge(args.shift)
@@ -1139,7 +1139,7 @@ def calculate_last_event_forming_initial_request
# Log an event to the history of some things that have happened to this request
def log_event(type, params, options = {})
- event = info_request_events.create!(:event_type => type, :params => params)
+ event = info_request_events.create!(event_type: type, params: params)
set_due_dates(event) if event.resets_due_dates?
if options[:created_at]
event.update_column(:created_at, options[:created_at])
@@ -1208,14 +1208,14 @@ def calculate_date_very_overdue_after
def last_embargo_set_event
info_request_events.
- where(:event_type => 'set_embargo').
+ where(event_type: 'set_embargo').
reorder(created_at: :desc).
first
end
def last_embargo_expire_event
info_request_events.
- where(:event_type => 'expire_embargo').
+ where(event_type: 'expire_embargo').
reorder(created_at: :desc).
first
end
@@ -1278,7 +1278,7 @@ def get_last_public_outgoing_event
# Text from the the initial request, for use in summary display
def initial_request_text
return '' if outgoing_messages.empty?
- body_opts = { :censor_rules => applicable_censor_rules }
+ body_opts = { censor_rules: applicable_censor_rules }
first_message = outgoing_messages.first
first_message.is_public? ? first_message.get_text_for_indexing(true, body_opts) : ''
end
@@ -1487,8 +1487,8 @@ def apply_censor_rules_to_binary(text)
end
def apply_masks(text, content_type)
- mask_options = { :censor_rules => applicable_censor_rules,
- :masks => masks }
+ mask_options = { censor_rules: applicable_censor_rules,
+ masks: masks }
AlaveteliTextMasker.apply_masks(text, content_type, mask_options)
end
@@ -1501,9 +1501,9 @@ def masks
replacement: _("[{{site_name}} contact email]",
site_name: site_name) }]
if public_body.is_followupable?
- masks << { :to_replace => public_body.request_email,
- :replacement => _("[{{public_body}} request email]",
- :public_body => public_body.short_or_long_name) }
+ masks << { to_replace: public_body.request_email,
+ replacement: _("[{{public_body}} request email]",
+ public_body: public_body.short_or_long_name) }
end
end
@@ -1518,24 +1518,24 @@ def is_actual_owning_user?(user)
end
def all_correspondence_is_public?
- prominence(:decorate => true).is_public? &&
+ prominence(decorate: true).is_public? &&
incoming_messages.all? { |message| message.is_public? } &&
outgoing_messages.all? { |message| message.is_public? }
end
def json_for_api(deep)
ret = {
- :id => id,
- :url_title => url_title,
- :title => title,
- :created_at => created_at,
- :updated_at => updated_at,
- :described_state => described_state,
- :display_status => display_status,
- :awaiting_description => awaiting_description,
- :prominence => prominence,
- :law_used => law_used,
- :tags => tag_array,
+ id: id,
+ url_title: url_title,
+ title: title,
+ created_at: created_at,
+ updated_at: updated_at,
+ described_state: described_state,
+ display_status: display_status,
+ awaiting_description: awaiting_description,
+ prominence: prominence,
+ law_used: law_used,
+ tags: tag_array,
# not sure we need to make these, mainly anti-spam, admin params public
# allow_new_responses_from
@@ -1581,8 +1581,8 @@ def similar_ids(limit=10)
xapian_similar =
ActsAsXapian::Similar.new([InfoRequestEvent],
info_request_events,
- :limit => limit,
- :collapse_by_prefix => 'request_collapse')
+ limit: limit,
+ collapse_by_prefix: 'request_collapse')
xapian_similar_more = (xapian_similar.matches_estimated > limit)
ids = xapian_similar.results.map do |result|
result[:model].info_request_id
@@ -1598,7 +1598,7 @@ def move_to_public_body(destination_public_body, opts = {})
old_body = public_body
editor = opts.fetch(:editor)
- attrs = { :public_body => destination_public_body }
+ attrs = { public_body: destination_public_body }
if destination_public_body
attrs[:law_used] = destination_public_body.legislation.key
@@ -1631,7 +1631,7 @@ def move_to_user(destination_user, opts = {})
old_user = user
editor = opts.fetch(:editor)
- return_val = if update(:user => destination_user)
+ return_val = if update(user: destination_user)
log_event(
'move_request',
editor: editor,
@@ -1755,10 +1755,10 @@ def self.add_conditions_from_extra_params(params, extra_params)
def self.search_events(query, opts = {})
defaults = {
- :offset => 0,
- :limit => 20,
- :sort_by_prefix => 'created_at',
- :sort_by_ascending => true
+ offset: 0,
+ limit: 20,
+ sort_by_prefix: 'created_at',
+ sort_by_ascending: true
}
ActsAsXapian::Search.new([InfoRequestEvent], query, defaults.merge(opts))
end
@@ -1830,7 +1830,7 @@ def create_response!(email, raw_email_data, rejected_reason = nil)
self.awaiting_description = true
end
- params = { :incoming_message_id => incoming_message.id }
+ params = { incoming_message_id: incoming_message.id }
params[:rejected_reason] = rejected_reason.to_s if rejected_reason
log_event('response', params)
diff --git a/app/models/info_request/pro_query.rb b/app/models/info_request/pro_query.rb
index bc29ab032a..4cab5280b8 100644
--- a/app/models/info_request/pro_query.rb
+++ b/app/models/info_request/pro_query.rb
@@ -6,8 +6,8 @@ def initialize(relation = InfoRequest)
def call
@relation
- .includes(:user => :roles)
- .where(:roles => {:name => 'pro'})
+ .includes(user: :roles)
+ .where(roles: {name: 'pro'})
.references(:roles)
end
end
diff --git a/app/models/info_request/response_gatekeeper/spam_checker.rb b/app/models/info_request/response_gatekeeper/spam_checker.rb
index cc2ab527c9..de023e8772 100644
--- a/app/models/info_request/response_gatekeeper/spam_checker.rb
+++ b/app/models/info_request/response_gatekeeper/spam_checker.rb
@@ -2,9 +2,9 @@ class InfoRequest
module ResponseGatekeeper
class SpamChecker
DEFAULT_CONFIGURATION = {
- :spam_action => ::AlaveteliConfiguration.incoming_email_spam_action,
- :spam_header => ::AlaveteliConfiguration.incoming_email_spam_header,
- :spam_threshold => ::AlaveteliConfiguration.incoming_email_spam_threshold
+ spam_action: ::AlaveteliConfiguration.incoming_email_spam_action,
+ spam_header: ::AlaveteliConfiguration.incoming_email_spam_header,
+ spam_threshold: ::AlaveteliConfiguration.incoming_email_spam_threshold
}
attr_reader :spam_action, :spam_header, :spam_threshold
@@ -22,7 +22,7 @@ def allow?(email)
def reason
_('Incoming message has a spam score above the configured threshold ' \
- '({{spam_threshold}}).', :spam_threshold => spam_threshold)
+ '({{spam_threshold}}).', spam_threshold: spam_threshold)
end
def spam?(email)
diff --git a/app/models/info_request/response_rejection/holding_pen.rb b/app/models/info_request/response_rejection/holding_pen.rb
index 771f675a05..6c8d74f8cb 100644
--- a/app/models/info_request/response_rejection/holding_pen.rb
+++ b/app/models/info_request/response_rejection/holding_pen.rb
@@ -14,7 +14,7 @@ def reject(reason = nil)
else
holding_pen.receive(email,
raw_email_data,
- { :rejected_reason => reason })
+ { rejected_reason: reason })
end
end
end
diff --git a/app/models/info_request/state.rb b/app/models/info_request/state.rb
index 36bbe2aa68..de44381930 100644
--- a/app/models/info_request/state.rb
+++ b/app/models/info_request/state.rb
@@ -57,7 +57,7 @@ def self.short_description(state)
elsif InfoRequest.respond_to?(:theme_short_description)
InfoRequest.theme_short_description(state)
else
- raise _("unknown status {{state}}", :state => state)
+ raise _("unknown status {{state}}", state: state)
end
end
diff --git a/app/models/info_request_batch.rb b/app/models/info_request_batch.rb
index 0a8d08431f..d51bd9c9dd 100644
--- a/app/models/info_request_batch.rb
+++ b/app/models/info_request_batch.rb
@@ -19,10 +19,10 @@ class InfoRequestBatch < ApplicationRecord
include InfoRequest::TitleValidation
has_many :info_requests,
- :inverse_of => :info_request_batch
+ inverse_of: :info_request_batch
belongs_to :user,
- :inverse_of => :info_request_batches,
- :counter_cache => true
+ inverse_of: :info_request_batches,
+ counter_cache: true
has_many :citations,
-> (batch) { unscope(:where).for_batch(batch) },
as: :citable,
@@ -34,7 +34,7 @@ class InfoRequestBatch < ApplicationRecord
includes(:translations).
reorder('public_body_translations.name asc')
end
- }, :inverse_of => :info_request_batches
+ }, inverse_of: :info_request_batches
attr_accessor :ignore_existing_batch
@@ -91,11 +91,11 @@ def self.find_existing(user, title, body, public_body_ids, id: nil)
# Create a new batch from the supplied draft version
def self.from_draft(draft)
- new(:user => draft.user,
- :public_bodies => draft.public_bodies,
- :title => draft.title,
- :body => draft.body,
- :embargo_duration => draft.embargo_duration)
+ new(user: draft.user,
+ public_bodies: draft.public_bodies,
+ title: draft.title,
+ body: draft.body,
+ embargo_duration: draft.embargo_duration)
end
def existing_batch
@@ -165,14 +165,14 @@ def example_request
public_body = public_bodies.first
body = OutgoingMessage.fill_in_salutation(self.body, public_body)
info_request = InfoRequest.build_from_attributes(
- { :title => title, :public_body => public_body },
- { :body => body },
+ { title: title, public_body: public_body },
+ { body: body },
user
)
unless embargo_duration.blank?
info_request.embargo = AlaveteliPro::Embargo.new(
- :info_request => info_request,
- :embargo_duration => embargo_duration
+ info_request: info_request,
+ embargo_duration: embargo_duration
)
end
info_request
@@ -221,21 +221,21 @@ def request_phases
# Returns hash of string group names mapped to an integer
def request_phases_summary
{
- :in_progress => {
- :label => _('In progress'),
- :count => info_requests.in_progress.count
+ in_progress: {
+ label: _('In progress'),
+ count: info_requests.in_progress.count
},
- :action_needed => {
- :label => _('Action needed'),
- :count => info_requests.action_needed.count
+ action_needed: {
+ label: _('Action needed'),
+ count: info_requests.action_needed.count
},
- :complete => {
- :label => _('Complete'),
- :count => info_requests.complete.count
+ complete: {
+ label: _('Complete'),
+ count: info_requests.complete.count
},
- :other => {
- :label => _('Other'),
- :count => info_requests.other.count
+ other: {
+ label: _('Other'),
+ count: info_requests.other.count
}
}
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 9f9e0e1903..ffdb6e79c3 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -58,41 +58,41 @@ class InfoRequestEvent < ApplicationRecord
].freeze
belongs_to :info_request,
- :inverse_of => :info_request_events
+ inverse_of: :info_request_events
validates_presence_of :info_request
belongs_to :outgoing_message,
- :inverse_of => :info_request_events
+ inverse_of: :info_request_events
belongs_to :incoming_message,
- :inverse_of => :info_request_events
+ inverse_of: :info_request_events
belongs_to :comment,
- :inverse_of => :info_request_events
+ inverse_of: :info_request_events
has_one :request_classification,
- :inverse_of => :info_request_event
+ inverse_of: :info_request_event
has_many :user_info_request_sent_alerts,
- :inverse_of => :info_request_event,
- :dependent => :destroy
+ inverse_of: :info_request_event,
+ dependent: :destroy
has_many :track_things_sent_emails,
- :inverse_of => :info_request_event,
- :dependent => :destroy
+ inverse_of: :info_request_event,
+ dependent: :destroy
has_many :notifications,
- :inverse_of => :info_request_event,
- :dependent => :destroy
+ inverse_of: :info_request_event,
+ dependent: :destroy
validates_presence_of :event_type
- before_save(:if => :only_editing_prominence_to_hide?) do
+ before_save(if: :only_editing_prominence_to_hide?) do
self.event_type = "hide"
end
- after_create :update_request, :if => :response?
+ after_create :update_request, if: :response?
after_commit -> { info_request.create_or_update_request_summary },
- :on => [:create]
+ on: [:create]
- validates_inclusion_of :event_type, :in => EVENT_TYPES
+ validates_inclusion_of :event_type, in: EVENT_TYPES
# user described state (also update in info_request)
validate :must_be_valid_state
@@ -106,15 +106,15 @@ def must_be_valid_state
attr_accessor :no_xapian_reindex
# Full text search indexing
- acts_as_xapian :texts => [ :search_text_main, :title ],
- :values => [
+ acts_as_xapian texts: [ :search_text_main, :title ],
+ values: [
[ :created_at, 0, "range_search", :date ], # for QueryParser range searches e.g. 01/01/2008..14/01/2008
[ :created_at_numeric, 1, "created_at", :number ], # for sorting
[ :described_at_numeric, 2, "described_at", :number ], # TODO: using :number for lack of :datetime support in Xapian values
[ :request, 3, "request_collapse", :string ],
[ :request_title_collapse, 4, "request_title_collapse", :string ],
],
- :terms => [ [ :calculated_state, 'S', "status" ],
+ terms: [ [ :calculated_state, 'S', "status" ],
[ :requested_by, 'B', "requested_by" ],
[ :requested_from, 'F', "requested_from" ],
[ :commented_by, 'C', "commented_by" ],
@@ -126,8 +126,8 @@ def must_be_valid_state
[ :filetype, 'T', "filetype" ],
[ :tags, 'U', "tag" ],
[ :request_public_body_tags, 'X', "request_public_body_tag" ] ],
- :if => :indexed_by_search?,
- :eager_load => [ :outgoing_message, :comment, { :info_request => [ :user, :public_body, :censor_rules ] } ]
+ if: :indexed_by_search?,
+ eager_load: [ :outgoing_message, :comment, { info_request: [ :user, :public_body, :censor_rules ] } ]
def self.count_of_hides_by_week
where(event_type: "hide").group("date(date_trunc('week', created_at))").count.sort
@@ -159,13 +159,13 @@ def request
end
def latest_variety
- sibling_events(:reverse => true).each do |event|
+ sibling_events(reverse: true).each do |event|
return event.variety unless event.variety.blank?
end
end
def latest_status
- sibling_events(:reverse => true).each do |event|
+ sibling_events(reverse: true).each do |event|
return event.calculated_state unless event.calculated_state.blank?
end
end
@@ -175,7 +175,7 @@ def waiting_classification
end
def request_title_collapse
- info_request.url_title(:collapse => true)
+ info_request.url_title(collapse: true)
end
def described_at
@@ -355,7 +355,7 @@ def params_diff
end
end
new_params.delete_if { |key, value| ignore.keys.include?(key) }
- {:new => new_params, :old => old_params, :other => other_params}
+ {new: new_params, old: old_params, other: other_params}
end
def is_incoming_message?
@@ -385,7 +385,7 @@ def is_clarification?
# A follow up is a clarification only if it's the first
# follow up when the request is in a state of
# waiting for clarification
- previous_events(:reverse => true).each do |event|
+ previous_events(reverse: true).each do |event|
if event.described_state == 'waiting_clarification'
waiting_clarification = true
break
@@ -415,7 +415,7 @@ def display_status
if status
return _("Internal review request") if status == 'internal_review'
return _("Clarification") if status == 'waiting_response'
- raise _("unknown status {{status}}", :status => status)
+ raise _("unknown status {{status}}", status: status)
end
# TRANSLATORS: "Follow up" in this context means a further
# message sent by the requester to the authority after
@@ -466,16 +466,16 @@ def same_email_as_previous_send?
def json_for_api(deep, snippet_highlight_proc = nil)
ret = {
- :id => id,
- :event_type => event_type,
+ id: id,
+ event_type: event_type,
# params has possibly sensitive data in it, don't include it
- :created_at => created_at,
- :described_state => described_state,
- :calculated_state => calculated_state,
- :last_described_at => last_described_at,
- :incoming_message_id => incoming_message_id,
- :outgoing_message_id => outgoing_message_id,
- :comment_id => comment_id,
+ created_at: created_at,
+ described_state: described_state,
+ calculated_state: calculated_state,
+ last_described_at: last_described_at,
+ incoming_message_id: incoming_message_id,
+ outgoing_message_id: outgoing_message_id,
+ comment_id: comment_id,
# TODO: would be nice to add links here, but alas the
# code to make them is in views only. See views/request/details.html.erb
@@ -513,7 +513,7 @@ def previous_events(opts = {})
order = opts[:reverse] ? 'created_at DESC' : 'created_at'
events = self.
class.
- where(:info_request_id => info_request_id).
+ where(info_request_id: info_request_id).
where('created_at < ?', created_at).
order(order)
@@ -523,14 +523,14 @@ def subsequent_events(opts = {})
order = opts[:reverse] ? 'created_at DESC' : 'created_at'
events = self.
class.
- where(:info_request_id => info_request_id).
+ where(info_request_id: info_request_id).
where('created_at > ?', created_at).
order(order)
end
def sibling_events(opts = {})
order = opts[:reverse] ? 'created_at DESC' : 'created_at'
- events = self.class.where(:info_request_id => info_request_id).order(order)
+ events = self.class.where(info_request_id: info_request_id).order(order)
end
def params_for_jsonb(params)
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 74b2c0e83f..18a05b52f3 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -24,9 +24,9 @@ class MailServerLog < ApplicationRecord
serialize :delivery_status, DeliveryStatusSerializer
belongs_to :info_request,
- :inverse_of => :mail_server_logs
+ inverse_of: :mail_server_logs
belongs_to :mail_server_log_done,
- :inverse_of => :mail_server_logs
+ inverse_of: :mail_server_logs
before_create :calculate_delivery_status
@@ -55,7 +55,7 @@ def self.load_file(file_name)
MailServerLog.where("mail_server_log_done_id = ?", done.id).delete_all
end
else
- done = MailServerLogDone.new(:filename => file_name_db)
+ done = MailServerLogDone.new(filename: file_name_db)
end
done.last_stat = modified
# update done structure so we know when we last read this file
@@ -262,7 +262,7 @@ def delivery_status
# attempt to parse the status from the log line and store if successful
def set_delivery_status(force = false)
- decorated = line(:decorate => true)
+ decorated = line(decorate: true)
if decorated && decorated.delivery_status
if force
force_delivery_status(decorated.delivery_status)
@@ -293,7 +293,7 @@ def self.create_mail_server_logs(emails, line, order, done)
if info_request
info_request.
mail_server_logs.
- create!(:line => line, :order => order, :mail_server_log_done => done)
+ create!(line: line, order: order, mail_server_log_done: done)
end
end
end
diff --git a/app/models/mail_server_log/delivery_status/translated_constants.rb b/app/models/mail_server_log/delivery_status/translated_constants.rb
index c0d9bca1e2..c0b21fcb9c 100644
--- a/app/models/mail_server_log/delivery_status/translated_constants.rb
+++ b/app/models/mail_server_log/delivery_status/translated_constants.rb
@@ -4,18 +4,18 @@ module TranslatedConstants
def self.humanized
# The order of these is important as we use the keys for sorting in #<=>
{
- :unknown => _("We don't know the delivery status for this message."),
- :failed => _('This message could not be delivered.'),
- :sent => _('This message has been sent.'),
- :delivered => _('This message has been delivered.')
+ unknown: _("We don't know the delivery status for this message."),
+ failed: _('This message could not be delivered.'),
+ sent: _('This message has been sent.'),
+ delivered: _('This message has been delivered.')
}.freeze
end
def self.to_s!
- { :unknown => _('unknown'),
- :failed => _('failed'),
- :sent => _('sent'),
- :delivered => _('delivered') }.freeze
+ { unknown: _('unknown'),
+ failed: _('failed'),
+ sent: _('sent'),
+ delivered: _('delivered') }.freeze
end
end
diff --git a/app/models/mail_server_log_done.rb b/app/models/mail_server_log_done.rb
index 5982c5462e..cc65bcf376 100644
--- a/app/models/mail_server_log_done.rb
+++ b/app/models/mail_server_log_done.rb
@@ -17,5 +17,5 @@
class MailServerLogDone < ApplicationRecord
has_many :mail_server_logs,
- :inverse_of => :mail_server_log_done
+ inverse_of: :mail_server_log_done
end
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 817287df04..2537152244 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -16,9 +16,9 @@
class Notification < ApplicationRecord
belongs_to :info_request_event,
- :inverse_of => :notifications
+ inverse_of: :notifications
belongs_to :user,
- :inverse_of => :notifications
+ inverse_of: :notifications
INSTANTLY = :instantly
DAILY = :daily
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 5ec9905c7e..a0ee3e9f18 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -41,25 +41,25 @@ class OutgoingMessage < ApplicationRecord
attr_accessor :default_letter
validates_presence_of :info_request
- validates_inclusion_of :status, :in => STATUS_TYPES
- validates_inclusion_of :message_type, :in => MESSAGE_TYPES
+ validates_inclusion_of :status, in: STATUS_TYPES
+ validates_inclusion_of :message_type, in: MESSAGE_TYPES
validate :template_changed
validate :body_uses_mixed_capitals
validate :body_has_signature
validate :what_doing_value
belongs_to :info_request,
- :inverse_of => :outgoing_messages
+ inverse_of: :outgoing_messages
belongs_to :incoming_message_followup,
- :inverse_of => :outgoing_message_followups,
- :foreign_key => 'incoming_message_followup_id',
- :class_name => 'IncomingMessage'
+ inverse_of: :outgoing_message_followups,
+ foreign_key: 'incoming_message_followup_id',
+ class_name: 'IncomingMessage'
# can have many events, for items which were resent by site admin e.g. if
# contact address changed
has_many :info_request_events,
- :inverse_of => :outgoing_message,
- :dependent => :destroy
+ inverse_of: :outgoing_message,
+ dependent: :destroy
delegate :public_body, to: :info_request, private: true, allow_nil: true
@@ -67,7 +67,7 @@ class OutgoingMessage < ApplicationRecord
# reindex if body text is edited (e.g. by admin interface)
after_update :xapian_reindex_after_update
- strip_attributes :allow_empty => true
+ strip_attributes allow_empty: true
admin_columns include: [:to, :from, :subject]
@@ -96,7 +96,7 @@ def self.additional_send_errors
end
def self.default_salutation(public_body)
- _("Dear {{public_body_name}},", :public_body_name => public_body.name)
+ _("Dear {{public_body_name}},", public_body_name: public_body.name)
end
def self.fill_in_salutation(text, public_body)
@@ -159,14 +159,14 @@ def subject
if message_type == 'followup'
if what_doing == 'internal_review'
_("Internal review of {{email_subject}}",
- :email_subject => info_request.email_subject_request(:html => false))
+ email_subject: info_request.email_subject_request(html: false))
else
info_request.
- email_subject_followup(:incoming_message => incoming_message_followup,
- :html => false)
+ email_subject_followup(incoming_message: incoming_message_followup,
+ html: false)
end
else
- info_request.email_subject_request(:html => false)
+ info_request.email_subject_request(html: false)
end
end
@@ -368,7 +368,7 @@ def get_body_for_html_display
text = body.strip
remove_privacy_sensitive_things!(text)
text = CGI.escapeHTML(text)
- text = MySociety::Format.make_clickable(text, { :contract => 1, :nofollow => true })
+ text = MySociety::Format.make_clickable(text, { contract: 1, nofollow: true })
text.gsub!(/\[(email address|mobile number)\]/, '[\1]')
text = ActionController::Base.helpers.simple_format(text)
text.html_safe
@@ -480,7 +480,7 @@ def template_regex(template_text)
def body_has_signature
if raw_body =~ /#{template_regex(letter_template.signoff(default_message_replacements))}\s*\Z/m
- errors.add(:body, _("Please sign at the bottom with your name, or alter the \"{{signoff}}\" signature", :signoff => letter_template.signoff(default_message_replacements)))
+ errors.add(:body, _("Please sign at the bottom with your name, or alter the \"{{signoff}}\" signature", signoff: letter_template.signoff(default_message_replacements)))
end
end
@@ -517,7 +517,7 @@ def exim_mail_server_logs
end
smarthost_mta_ids = logs.flat_map do |log|
- line = log.line(:decorate => true)
+ line = log.line(decorate: true)
if line.delivery_status.try(:delivered?)
match = line.to_s.match(/C=".*?id=(?\w+-\w+-\w+).*"/)
match[:message_id] if match
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index 2de60a80d4..42fafa59bc 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -34,9 +34,9 @@ class PostRedirect < ApplicationRecord
# Optional, does a login confirm before redirect for use in email links.
belongs_to :user,
- :inverse_of => :post_redirects
+ inverse_of: :post_redirects
- validates :circumstance, :inclusion => CIRCUMSTANCES
+ validates :circumstance, inclusion: CIRCUMSTANCES
after_initialize :generate_token
after_initialize :generate_email_token
diff --git a/app/models/pro_account.rb b/app/models/pro_account.rb
index aabe7974de..32633e6440 100644
--- a/app/models/pro_account.rb
+++ b/app/models/pro_account.rb
@@ -17,7 +17,7 @@ class ProAccount < ApplicationRecord
attr_writer :source
belongs_to :user,
- :inverse_of => :pro_account
+ inverse_of: :pro_account
validates :user, presence: true
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index fb225c02ca..51a61e05f7 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -25,7 +25,7 @@ class ProfilePhoto < ApplicationRecord
MAX_DRAFT = 500 # keep even pre-cropped images reasonably small
belongs_to :user,
- :inverse_of => :profile_photo
+ inverse_of: :profile_photo
validate :data_and_draft_checks
@@ -89,10 +89,10 @@ def data_and_draft_checks
if !draft && (image.width != WIDTH || image.height != HEIGHT)
errors.add(:data, _("Failed to convert image to the correct size: at {{cols}}x{{rows}}, need {{width}}x{{height}}",
- :cols => image.width,
- :rows => image.height,
- :width => WIDTH,
- :height => HEIGHT))
+ cols: image.width,
+ rows: image.height,
+ width: WIDTH,
+ height: HEIGHT))
end
if draft && user_id
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index eb752f567d..9b18d78771 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -62,46 +62,46 @@ def self.admin_title
has_many :info_requests,
-> { order(created_at: :desc) },
- :inverse_of => :public_body
+ inverse_of: :public_body
has_many :track_things,
-> { order(created_at: :desc) },
- :inverse_of => :public_body,
- :dependent => :destroy
+ inverse_of: :public_body,
+ dependent: :destroy
has_many :censor_rules,
-> { order(created_at: :desc) },
- :inverse_of => :public_body,
- :dependent => :destroy
+ inverse_of: :public_body,
+ dependent: :destroy
has_many :track_things_sent_emails,
-> { order(created_at: :desc) },
- :inverse_of => :public_body,
- :dependent => :destroy
+ inverse_of: :public_body,
+ dependent: :destroy
has_many :public_body_change_requests,
-> { order(created_at: :desc) },
- :inverse_of => :public_body,
- :dependent => :destroy
+ inverse_of: :public_body,
+ dependent: :destroy
has_many :draft_info_requests,
-> { order(created_at: :desc) },
- :inverse_of => :public_body
+ inverse_of: :public_body
has_and_belongs_to_many :info_request_batches,
- :inverse_of => :public_bodies
+ inverse_of: :public_bodies
has_and_belongs_to_many :draft_info_request_batches,
- :class_name => 'AlaveteliPro::DraftInfoRequestBatch',
- :inverse_of => :public_bodies
+ class_name: 'AlaveteliPro::DraftInfoRequestBatch',
+ inverse_of: :public_bodies
- validates_presence_of :name, :message => N_("Name can't be blank")
- validates_presence_of :url_name, :message => N_("URL name can't be blank")
+ validates_presence_of :name, message: N_("Name can't be blank")
+ validates_presence_of :url_name, message: N_("URL name can't be blank")
validates_presence_of :last_edit_editor,
- :message => N_("Last edit editor can't be blank")
+ message: N_("Last edit editor can't be blank")
validates :request_email,
not_nil: { message: N_("Request email can't be nil") }
validates_uniqueness_of :short_name,
- :message => N_("Short name is already taken"),
- :allow_blank => true
- validates_uniqueness_of :url_name, :message => N_("URL name is already taken")
- validates_uniqueness_of :name, :message => N_("Name is already taken")
+ message: N_("Short name is already taken"),
+ allow_blank: true
+ validates_uniqueness_of :url_name, message: N_("URL name is already taken")
+ validates_uniqueness_of :name, message: N_("Name is already taken")
validates :last_edit_editor,
length: { maximum: 255,
@@ -110,7 +110,7 @@ def self.admin_title
validate :request_email_if_requestable
- before_save :set_api_key!, :unless => :api_key
+ before_save :set_api_key!, unless: :api_key
after_save :update_missing_email_tag
@@ -120,17 +120,17 @@ def self.admin_title
scope :visible, -> { where("public_bodies.id <> #{ PublicBody.internal_admin_body.id }") }
acts_as_versioned
- acts_as_xapian :texts => [:name, :short_name, :notes_as_string],
- :values => [
+ acts_as_xapian texts: [:name, :short_name, :notes_as_string],
+ values: [
# for sorting
[:created_at_numeric, 1, "created_at", :number]
],
- :terms => [
+ terms: [
[:name_for_search, 'N', 'name'],
[:variety, 'V', "variety"],
[:tag_array_for_search, 'U', "tag"]
],
- :eager_load => [:translations]
+ eager_load: [:translations]
strip_attributes allow_empty: false, except: %i[request_email]
strip_attributes allow_empty: true, only: %i[request_email]
@@ -207,9 +207,9 @@ def compare(previous = nil, &block)
updated_at).include?(c.name)
from = previous.send(c.name)
to = send(c.name)
- memo << { :name => c.name.humanize,
- :from => from,
- :to => to } if from != to
+ memo << { name: c.name.humanize,
+ from: from,
+ to: to } if from != to
end
memo
}
@@ -292,7 +292,7 @@ def self.find_by_url_name_with_historic(name)
# If none found, then search the history of short names and find unique
# public bodies in it
old = PublicBody::Version.
- where(:url_name => name).
+ where(url_name: name).
distinct.
pluck(:public_body_id)
@@ -437,14 +437,13 @@ def self.internal_admin_body
AlaveteliLocalization.
with_locale(AlaveteliLocalization.default_locale) do
default_scoped.
- create!(:name => 'Internal admin authority',
- :short_name => "",
- :request_email => AlaveteliConfiguration.contact_email,
- :home_page => nil,
- :publication_scheme => nil,
- :last_edit_editor => "internal_admin",
- :last_edit_comment =>
- "Made by PublicBody.internal_admin_body")
+ create!(name: 'Internal admin authority',
+ short_name: "",
+ request_email: AlaveteliConfiguration.contact_email,
+ home_page: nil,
+ publication_scheme: nil,
+ last_edit_editor: "internal_admin",
+ last_edit_comment: "Made by PublicBody.internal_admin_body")
end
end
elsif matching_pbs.length == 1
@@ -499,13 +498,13 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
field_names = { 'name' => 1, 'request_email' => 2 }
line = 0
- import_options = {:field_names => field_names,
- :available_locales => available_locales,
- :tag => tag,
- :tag_behaviour => tag_behaviour,
- :editor => editor,
- :notes => notes,
- :errors => errors }
+ import_options = {field_names: field_names,
+ available_locales: available_locales,
+ tag: tag,
+ tag_behaviour: tag_behaviour,
+ editor: editor,
+ notes: notes,
+ errors: errors }
CSV.foreach(csv_filename) do |row|
line = line + 1
@@ -534,9 +533,9 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
next
end
- public_body = bodies_by_name[name] || PublicBody.new(:name => "",
- :short_name => "",
- :request_email => "")
+ public_body = bodies_by_name[name] || PublicBody.new(name: "",
+ short_name: "",
+ request_email: "")
public_body.import_values_from_csv_row(row, line, name, import_options)
set_of_importing.add(name)
@@ -570,11 +569,11 @@ def self.localized_csv_field_name(locale, field_name)
def import_values_from_csv_row(row, line, name, options)
is_new = new_record?
edit_info = if is_new
- { :action => "creating new authority",
- :comment => 'Created from spreadsheet' }
+ { action: "creating new authority",
+ comment: 'Created from spreadsheet' }
else
- { :action => "updating authority",
- :comment => 'Updated from spreadsheet' }
+ { action: "updating authority",
+ comment: 'Updated from spreadsheet' }
end
locales = options[:available_locales]
locales = [AlaveteliLocalization.default_locale] if locales.empty?
@@ -681,28 +680,27 @@ def has_notes?
def json_for_api
{
- :id => id,
- :url_name => url_name,
- :name => name,
- :short_name => short_name,
+ id: id,
+ url_name: url_name,
+ name: name,
+ short_name: short_name,
# :request_email # we hide this behind a captcha, to stop people
# doing bulk requests easily
- :created_at => created_at,
- :updated_at => updated_at,
+ created_at: created_at,
+ updated_at: updated_at,
# don't add the history as some edit comments contain sensitive
# information
# :version, :last_edit_editor, :last_edit_comment
- :home_page => calculated_home_page,
- :notes => notes_as_string,
- :publication_scheme => publication_scheme.to_s,
- :tags => tag_array,
- :info => {
- :requests_count => info_requests_count,
- :requests_successful_count => info_requests_successful_count,
- :requests_not_held_count => info_requests_not_held_count,
- :requests_overdue_count => info_requests_overdue_count,
- :requests_visible_classified_count =>
- info_requests_visible_classified_count
+ home_page: calculated_home_page,
+ notes: notes_as_string,
+ publication_scheme: publication_scheme.to_s,
+ tags: tag_array,
+ info: {
+ requests_count: info_requests_count,
+ requests_successful_count: info_requests_successful_count,
+ requests_not_held_count: info_requests_not_held_count,
+ requests_overdue_count: info_requests_overdue_count,
+ requests_visible_classified_count: info_requests_visible_classified_count
},
}
end
diff --git a/app/models/public_body_change_request.rb b/app/models/public_body_change_request.rb
index e9d3a18970..bb0e523a70 100644
--- a/app/models/public_body_change_request.rb
+++ b/app/models/public_body_change_request.rb
@@ -19,22 +19,22 @@
class PublicBodyChangeRequest < ApplicationRecord
belongs_to :user,
- :inverse_of => :public_body_change_requests,
- :counter_cache => true
+ inverse_of: :public_body_change_requests,
+ counter_cache: true
belongs_to :public_body,
- :inverse_of => :public_body_change_requests
+ inverse_of: :public_body_change_requests
validates_presence_of :public_body_name,
- :message => N_("Please enter the name of the authority"),
- :unless => proc { |change_request| change_request.public_body }
+ message: N_("Please enter the name of the authority"),
+ unless: proc { |change_request| change_request.public_body }
validates_presence_of :user_name,
- :message => N_("Please enter your name"),
- :unless => proc { |change_request| change_request.user }
+ message: N_("Please enter your name"),
+ unless: proc { |change_request| change_request.user }
validates_presence_of :user_email,
- :message => N_("Please enter your email address"),
- :unless => proc { |change_request| change_request.user }
- validate :user_email_format, :unless => proc { |change_request| change_request.user_email.blank? }
- validate :body_email_format, :unless => proc { |change_request| change_request.public_body_email.blank? }
+ message: N_("Please enter your email address"),
+ unless: proc { |change_request| change_request.user }
+ validate :user_email_format, unless: proc { |change_request| change_request.user_email.blank? }
+ validate :body_email_format, unless: proc { |change_request| change_request.public_body_email.blank? }
scope :new_body_requests, -> {
where(public_body_id: nil).order(:created_at)
@@ -105,7 +105,7 @@ def thanks_notice
_("Your request to update the address for {{public_body_name}} has " \
"been sent. Thank you for getting in touch! We'll get back to you " \
"soon.",
- :public_body_name => get_public_body_name)
+ public_body_name: get_public_body_name)
end
end
@@ -126,10 +126,10 @@ def comment_for_public_body
def request_subject
if add_body_request?
_("Add authority - {{public_body_name}}",
- :public_body_name => public_body_name.html_safe).to_str
+ public_body_name: public_body_name.html_safe).to_str
else
_("Update email address - {{public_body_name}}",
- :public_body_name => public_body.name.html_safe).to_str
+ public_body_name: public_body.name.html_safe).to_str
end
end
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index c4f1ff3e2f..8167f697a6 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -18,7 +18,7 @@ class RawEmail < ApplicationRecord
# deliberately don't strip_attributes, so keeps raw email properly
has_one :incoming_message,
- :inverse_of => :raw_email
+ inverse_of: :raw_email
has_one_attached :file, service: :raw_emails
@@ -89,9 +89,9 @@ def data
end
def data_as_text
- data.encode("UTF-8", :invalid => :replace,
- :undef => :replace,
- :replace => "")
+ data.encode("UTF-8", invalid: :replace,
+ undef: :replace,
+ replace: "")
end
def from_name
diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb
index d0e4ff3889..32b3b07173 100644
--- a/app/models/request_classification.rb
+++ b/app/models/request_classification.rb
@@ -17,10 +17,10 @@ class RequestClassification < ApplicationRecord
].freeze
belongs_to :user,
- :inverse_of => :request_classifications,
- :counter_cache => true
+ inverse_of: :request_classifications,
+ counter_cache: true
belongs_to :info_request_event,
- :inverse_of => :request_classification
+ inverse_of: :request_classification
# return classification instances representing the top n
# users, with a 'cnt' attribute representing the number
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index eae54f40b0..4c1aa88755 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -30,34 +30,34 @@ class TrackThing < ApplicationRecord
TRACK_MEDIUMS = %w(email_daily feed)
belongs_to :info_request,
- :inverse_of => :track_things
+ inverse_of: :track_things
belongs_to :public_body,
- :inverse_of => :track_things
+ inverse_of: :track_things
belongs_to :tracking_user,
- :class_name => 'User',
- :inverse_of => :track_things,
- :counter_cache => true
+ class_name: 'User',
+ inverse_of: :track_things,
+ counter_cache: true
belongs_to :tracked_user,
- :class_name => 'User',
- :inverse_of => :track_things
+ class_name: 'User',
+ inverse_of: :track_things
has_many :track_things_sent_emails,
- :inverse_of => :track_thing,
- :dependent => :destroy
+ inverse_of: :track_thing,
+ dependent: :destroy
- validates_presence_of :track_query, :message => _("Query can't be blank")
+ validates_presence_of :track_query, message: _("Query can't be blank")
validates_presence_of :track_type
validates_inclusion_of :track_type,
- :in => TranslatedConstants.track_types.keys
- validates_inclusion_of :track_medium, :in => TRACK_MEDIUMS
- validates_length_of :track_query, :maximum => 500, :message => _("Query is too long")
+ in: TranslatedConstants.track_types.keys
+ validates_inclusion_of :track_medium, in: TRACK_MEDIUMS
+ validates_length_of :track_query, maximum: 500, message: _("Query is too long")
# When constructing a new track, use this to avoid duplicates / double
# posting
def self.find_existing(tracking_user, track)
return nil if tracking_user.nil?
- where(:tracking_user_id => tracking_user.id,
- :track_query => track.track_query,
- :track_type => track.track_type).first
+ where(tracking_user_id: tracking_user.id,
+ track_query: track.track_query,
+ track_type: track.track_type).first
end
def self.track_type_description(track_type)
@@ -66,19 +66,19 @@ def self.track_type_description(track_type)
end
def self.create_track_for_request(info_request)
- new(:track_type => 'request_updates',
- :info_request => info_request,
- :track_query => "request:#{ info_request.url_title }")
+ new(track_type: 'request_updates',
+ info_request: info_request,
+ track_query: "request:#{ info_request.url_title }")
end
def self.create_track_for_all_new_requests
- new(:track_type => 'all_new_requests',
- :track_query => 'variety:sent')
+ new(track_type: 'all_new_requests',
+ track_query: 'variety:sent')
end
def self.create_track_for_all_successful_requests
- new(:track_type => 'all_successful_requests',
- :track_query => 'variety:response ' \
+ new(track_type: 'all_successful_requests',
+ track_query: 'variety:response ' \
'(status:successful OR status:partially_successful)')
end
@@ -87,15 +87,15 @@ def self.create_track_for_public_body(public_body, event_type = nil)
if InfoRequestEvent::EVENT_TYPES.include?(event_type)
query += " variety:#{ event_type }"
end
- new(:track_type => 'public_body_updates',
- :public_body => public_body,
- :track_query => query)
+ new(track_type: 'public_body_updates',
+ public_body: public_body,
+ track_query: query)
end
def self.create_track_for_user(user)
- new(:track_type => 'user_updates',
- :tracked_user => user,
- :track_query => "requested_by:#{ user.url_name }" \
+ new(track_type: 'user_updates',
+ tracked_user: user,
+ track_query: "requested_by:#{ user.url_name }" \
" OR commented_by: #{ user.url_name }")
end
@@ -115,8 +115,8 @@ def self.create_track_for_search_query(query, variety_postfix = nil)
query += " variety:authority"
end
end
- new(:track_type => 'search_query',
- :track_query => query)
+ new(track_type: 'search_query',
+ track_query: query)
end
def track_type_description
@@ -125,16 +125,16 @@ def track_type_description
def track_query_description
filter_description = query_filter_description('(variety:sent OR variety:followup_sent OR variety:response OR variety:comment)',
- :no_query => N_("all requests or comments"),
- :query => N_("all requests or comments matching text '{{query}}'"))
+ no_query: N_("all requests or comments"),
+ query: N_("all requests or comments matching text '{{query}}'"))
return filter_description if filter_description
filter_description = query_filter_description('(latest_status:successful OR latest_status:partially_successful)',
- :no_query => N_("requests which are successful"),
- :query => N_("requests which are successful matching text '{{query}}'"))
+ no_query: N_("requests which are successful"),
+ query: N_("requests which are successful matching text '{{query}}'"))
return filter_description if filter_description
- _("anything matching text '{{query}}'", :query => track_query)
+ _("anything matching text '{{query}}'", query: track_query)
end
# Return a readable query description for queries involving commonly used
@@ -146,7 +146,7 @@ def query_filter_description(string, options)
if parsed_query.empty?
_(options[:no_query])
else
- _(options[:query], :query => parsed_query)
+ _(options[:query], query: parsed_query)
end
end
end
@@ -169,57 +169,57 @@ def params_for(track_type)
def request_updates_params
{ # Website
- :verb_on_page => _("Follow this request"),
- :verb_on_page_already => _("You are already following this request"),
+ verb_on_page: _("Follow this request"),
+ verb_on_page_already: _("You are already following this request"),
# Email
- :title_in_email => _("New updates for the request '{{request_title}}'",
- :request_title => info_request.title.html_safe),
- :title_in_rss => _("New updates for the request '{{request_title}}'",
- :request_title => info_request.title),
+ title_in_email: _("New updates for the request '{{request_title}}'",
+ request_title: info_request.title.html_safe),
+ title_in_rss: _("New updates for the request '{{request_title}}'",
+ request_title: info_request.title),
# Authentication
- :web => _("To follow the request '{{request_title}}'",
- :request_title => info_request.title.html_safe),
- :email => _("Then you will be updated whenever the request '{{request_title}}' is updated.",
- :request_title => info_request.title),
- :email_subject => _("Confirm you want to follow the request '{{request_title}}'",
- :request_title => info_request.title),
+ web: _("To follow the request '{{request_title}}'",
+ request_title: info_request.title.html_safe),
+ email: _("Then you will be updated whenever the request '{{request_title}}' is updated.",
+ request_title: info_request.title),
+ email_subject: _("Confirm you want to follow the request '{{request_title}}'",
+ request_title: info_request.title),
# RSS sorting
- :feed_sortby => 'newest'
+ feed_sortby: 'newest'
}
end
def all_new_requests_params
{ # Website
- :verb_on_page => _("Follow all new requests"),
- :verb_on_page_already => _("You are already following new requests"),
+ verb_on_page: _("Follow all new requests"),
+ verb_on_page_already: _("You are already following new requests"),
# Email
- :title_in_email => _("New Freedom of Information requests"),
- :title_in_rss => _("New Freedom of Information requests"),
+ title_in_email: _("New Freedom of Information requests"),
+ title_in_rss: _("New Freedom of Information requests"),
# Authentication
- :web => _("To follow new requests"),
- :email => _("Then you will be following all new FOI requests."),
- :email_subject => _("Confirm you want to follow new requests"),
+ web: _("To follow new requests"),
+ email: _("Then you will be following all new FOI requests."),
+ email_subject: _("Confirm you want to follow new requests"),
# RSS sorting
- :feed_sortby => 'newest'
+ feed_sortby: 'newest'
}
end
def all_successful_requests_params
{ # Website
- :verb_on_page => _("Follow new successful responses"),
- :verb_on_page_already => _("You are following all new successful responses"),
+ verb_on_page: _("Follow new successful responses"),
+ verb_on_page_already: _("You are following all new successful responses"),
# Email
- :title_in_email => _("Successful Freedom of Information requests"),
- :title_in_rss => _("Successful Freedom of Information requests"),
+ title_in_email: _("Successful Freedom of Information requests"),
+ title_in_rss: _("Successful Freedom of Information requests"),
# Authentication
- :web => _("To follow all successful requests"),
- :email => _("Then you will be notified whenever an FOI request succeeds."),
- :email_subject => _("Confirm you want to follow all successful FOI requests"),
+ web: _("To follow all successful requests"),
+ email: _("Then you will be notified whenever an FOI request succeeds."),
+ email_subject: _("Confirm you want to follow all successful FOI requests"),
# RSS sorting - used described date, as newest would give a
# date for responses possibly days before description, so
# wouldn't appear at top of list when description (known
# success) causes match.
- :feed_sortby => 'described'
+ feed_sortby: 'described'
}
end
@@ -253,36 +253,36 @@ def public_body_updates_params
def user_updates_params
{ # Website
- :verb_on_page => _("Follow this person"),
- :verb_on_page_already => _("You are already following this person"),
+ verb_on_page: _("Follow this person"),
+ verb_on_page_already: _("You are already following this person"),
# Email
- :title_in_email => _("FOI requests by '{{user_name}}'",
- :user_name => tracked_user.name.html_safe),
- :title_in_rss => _("FOI requests by '{{user_name}}'",
- :user_name => tracked_user.name),
+ title_in_email: _("FOI requests by '{{user_name}}'",
+ user_name: tracked_user.name.html_safe),
+ title_in_rss: _("FOI requests by '{{user_name}}'",
+ user_name: tracked_user.name),
# Authentication
- :web => _("To follow requests by '{{user_name}}'",
- :user_name => tracked_user.name.html_safe),
- :email => _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.",
- :user_name => tracked_user.name),
- :email_subject => _("Confirm you want to follow requests by '{{user_name}}'",
- :user_name => tracked_user.name),
+ web: _("To follow requests by '{{user_name}}'",
+ user_name: tracked_user.name.html_safe),
+ email: _("Then you will be notified whenever '{{user_name}}' requests something or gets a response.",
+ user_name: tracked_user.name),
+ email_subject: _("Confirm you want to follow requests by '{{user_name}}'",
+ user_name: tracked_user.name),
# RSS sorting
- :feed_sortby => 'newest'
+ feed_sortby: 'newest'
}
end
def search_query_params
{ # Website
- :verb_on_page => _("Follow things matching this search"),
- :verb_on_page_already => _("You are already following things matching this search"),
+ verb_on_page: _("Follow things matching this search"),
+ verb_on_page_already: _("You are already following things matching this search"),
# Email
- :title_in_email => _("Requests or responses matching your saved search"),
- :title_in_rss => _("Requests or responses matching your saved search"),
+ title_in_email: _("Requests or responses matching your saved search"),
+ title_in_rss: _("Requests or responses matching your saved search"),
# Authentication
- :web => _("To follow requests and responses matching your search"),
- :email => _("Then you will be notified whenever a new request or response matches your search."),
- :email_subject => _("Confirm you want to follow new requests or responses matching your search"),
+ web: _("To follow requests and responses matching your search"),
+ email: _("Then you will be notified whenever a new request or response matches your search."),
+ email_subject: _("Confirm you want to follow new requests or responses matching your search"),
# RSS sorting - TODO: hmmm, we don't really know which to use
# here for sorting. Might be a query term (e.g. 'cctv'), in
# which case newest is good, or might be something like
@@ -290,7 +290,7 @@ def search_query_params
# described (when we discover criteria is met). Rather
# conservatively am picking described, as that will make
# things appear in feed more than the should, rather than less.
- :feed_sortby => 'described'
+ feed_sortby: 'described'
}
end
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index deda1c2363..4b247982e9 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -20,13 +20,13 @@
class TrackThingsSentEmail < ApplicationRecord
belongs_to :info_request_event,
- :inverse_of => :track_things_sent_emails
+ inverse_of: :track_things_sent_emails
belongs_to :user,
- :inverse_of => :track_things_sent_emails
+ inverse_of: :track_things_sent_emails
belongs_to :public_body,
- :inverse_of => :track_things_sent_emails
+ inverse_of: :track_things_sent_emails
belongs_to :track_thing,
- :inverse_of => :track_things_sent_emails
+ inverse_of: :track_things_sent_emails
# Called from cron job delete-old-things
def self.delete_old_track_things_sent_email
diff --git a/app/models/user.rb b/app/models/user.rb
index 6f8b30a0f4..925eb71536 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -350,7 +350,7 @@ def update_url_name
unique_url_name = url_name
suffix_num = 2 # as there's already one without numeric suffix
conditions = id ? ["id <> ?", id] : []
- while !User.where(:url_name => unique_url_name).where(conditions).first.nil?
+ while !User.where(url_name: unique_url_name).where(conditions).first.nil?
unique_url_name = url_name + "_" + suffix_num.to_s
suffix_num = suffix_num + 1
end
diff --git a/app/models/user/transaction_calculator.rb b/app/models/user/transaction_calculator.rb
index 98fc229539..0f3db04cb1 100644
--- a/app/models/user/transaction_calculator.rb
+++ b/app/models/user/transaction_calculator.rb
@@ -94,7 +94,7 @@ def ==(other)
def range_total_count(range)
transaction_associations.
reduce(0) do |accum, assoc|
- accum += user.send(assoc).where(:created_at => range).count
+ accum += user.send(assoc).where(created_at: range).count
end
end
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index 6cf3af8097..0143b146c6 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -39,13 +39,13 @@ class UserInfoRequestSentAlert < ApplicationRecord
]
belongs_to :user,
- :inverse_of => :user_info_request_sent_alerts
+ inverse_of: :user_info_request_sent_alerts
belongs_to :info_request,
- :inverse_of => :user_info_request_sent_alerts
+ inverse_of: :user_info_request_sent_alerts
belongs_to :info_request_event,
- :inverse_of => :user_info_request_sent_alerts
+ inverse_of: :user_info_request_sent_alerts
- validates_inclusion_of :alert_type, :in => ALERT_TYPES
+ validates_inclusion_of :alert_type, in: ALERT_TYPES
scope :recent, -> { where(created_at: 1.year.ago.to_date..Float::INFINITY) }
end
diff --git a/app/models/widget_vote.rb b/app/models/widget_vote.rb
index 8281849773..85801e3ab3 100644
--- a/app/models/widget_vote.rb
+++ b/app/models/widget_vote.rb
@@ -12,9 +12,9 @@
class WidgetVote < ApplicationRecord
belongs_to :info_request,
- :inverse_of => :widget_votes
+ inverse_of: :widget_votes
- validates :info_request, :presence => true
+ validates :info_request, presence: true
validates :cookie, length: { is: 20 }
validates :cookie, uniqueness: { scope: :info_request_id }
end
From 561c57d30f455aac406d2c833a05c783e33f30a8 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:01:57 +0000
Subject: [PATCH 098/289] Style: HashSyntax Rubocop (spec models)
---
spec/models/ability_spec.rb | 4 +-
.../activity_list/comment_spec.rb | 19 +-
.../activity_list/embargo_expiry_spec.rb | 4 +-
.../alaveteli_pro/activity_list/list_spec.rb | 12 +-
.../activity_list/overdue_spec.rb | 4 +-
.../activity_list/very_overdue_spec.rb | 6 +-
.../draft_info_request_batch_spec.rb | 8 +-
spec/models/alaveteli_pro/embargo_spec.rb | 22 +-
.../alaveteli_pro/request_filter_spec.rb | 16 +-
.../to_do_list/expiring_embargo_spec.rb | 6 +-
.../alaveteli_pro/to_do_list/list_spec.rb | 6 +-
.../to_do_list/new_response_spec.rb | 6 +-
.../to_do_list/overdue_request_spec.rb | 6 +-
.../to_do_list/very_overdue_request_spec.rb | 6 +-
spec/models/censor_rule_spec.rb | 68 +-
spec/models/comment_spec.rb | 30 +-
spec/models/customstates.rb | 4 +-
spec/models/holiday_import_spec.rb | 48 +-
spec/models/incoming_message_error_spec.rb | 2 +-
spec/models/incoming_message_spec.rb | 88 +--
spec/models/info_request/pro_query_spec.rb | 2 +-
.../embargo_expired_today_query_spec.rb | 2 +-
.../prominence/embargo_expiring_query_spec.rb | 4 +-
.../prominence/public_query_spec.rb | 4 +-
.../prominence/searchable_query_spec.rb | 2 +-
.../response_gatekeeper/base_spec.rb | 2 +-
.../response_gatekeeper/spam_checker_spec.rb | 56 +-
.../response_rejection/bounce_spec.rb | 8 +-
spec/models/info_request/state_spec.rb | 14 +-
spec/models/info_request_batch_spec.rb | 58 +-
spec/models/info_request_event_spec.rb | 250 +++----
spec/models/info_request_spec.rb | 646 +++++++++---------
spec/models/mail_server_log_spec.rb | 76 +--
.../template/batch_request_spec.rb | 4 +-
.../incoming_message_followup_spec.rb | 10 +-
.../template/initial_request_spec.rb | 10 +-
.../template/internal_review_spec.rb | 30 +-
spec/models/outgoing_message_spec.rb | 402 +++++------
spec/models/post_redirect_spec.rb | 6 +-
spec/models/profile_photo_spec.rb | 12 +-
spec/models/public_body_category_link_spec.rb | 8 +-
spec/models/public_body_category_spec.rb | 80 +--
.../models/public_body_change_request_spec.rb | 58 +-
spec/models/public_body_heading_spec.rb | 52 +-
spec/models/public_body_spec.rb | 258 +++----
spec/models/raw_email_spec.rb | 6 +-
spec/models/request_classification_spec.rb | 6 +-
spec/models/role_spec.rb | 4 +-
spec/models/spam_address_spec.rb | 4 +-
spec/models/statistics_spec.rb | 4 +-
spec/models/track_thing_spec.rb | 6 +-
.../user/transaction_calculator_spec.rb | 58 +-
spec/models/user_spec.rb | 132 ++--
spec/models/widget_vote_spec.rb | 8 +-
spec/models/xapian_spec.rb | 112 +--
55 files changed, 1378 insertions(+), 1381 deletions(-)
diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb
index a6e547d36f..293184420a 100644
--- a/spec/models/ability_spec.rb
+++ b/spec/models/ability_spec.rb
@@ -1404,7 +1404,7 @@
context "when the comment's request is embargoed" do
let(:info_request) { FactoryBot.create(:embargoed_request) }
let(:comment) { FactoryBot.create(:comment,
- :info_request => info_request) }
+ info_request: info_request) }
it 'allows a pro admin user to administer' do
with_feature_enabled(:alaveteli_pro) do
@@ -1446,7 +1446,7 @@
context 'when the request is not embargoed' do
let(:info_request) { FactoryBot.create(:info_request) }
let(:comment) { FactoryBot.create(:comment,
- :info_request => info_request) }
+ info_request: info_request) }
it 'allows a pro admin user to administer' do
with_feature_enabled(:alaveteli_pro) do
diff --git a/spec/models/alaveteli_pro/activity_list/comment_spec.rb b/spec/models/alaveteli_pro/activity_list/comment_spec.rb
index 5715617175..4602cc5094 100644
--- a/spec/models/alaveteli_pro/activity_list/comment_spec.rb
+++ b/spec/models/alaveteli_pro/activity_list/comment_spec.rb
@@ -4,8 +4,8 @@
include Rails.application.routes.url_helpers
let!(:user) { FactoryBot.create(:user) }
- let!(:comment) { FactoryBot.create(:comment, :user => user) }
- let!(:event) { FactoryBot.create(:comment_event, :comment => comment) }
+ let!(:comment) { FactoryBot.create(:comment, user: user) }
+ let!(:event) { FactoryBot.create(:comment_event, comment: comment) }
let!(:activity) { described_class.new(event) }
describe '#description' do
@@ -33,15 +33,12 @@
:info_request_title' do
expected_urls =
{
- :commenter_name =>
- { :text => user.name,
- :url => user_path(user) },
- :public_body_name =>
- { :text => event.info_request.public_body.name,
- :url => public_body_path(event.info_request.public_body) },
- :info_request_title =>
- { :text => event.info_request.title,
- :url => request_path(event.info_request) }
+ commenter_name: { text: user.name,
+ url: user_path(user) },
+ public_body_name: { text: event.info_request.public_body.name,
+ url: public_body_path(event.info_request.public_body) },
+ info_request_title: { text: event.info_request.title,
+ url: request_path(event.info_request) }
}
expect(activity.description_urls).
to eq expected_urls
diff --git a/spec/models/alaveteli_pro/activity_list/embargo_expiry_spec.rb b/spec/models/alaveteli_pro/activity_list/embargo_expiry_spec.rb
index 78808626ec..dae38eec68 100644
--- a/spec/models/alaveteli_pro/activity_list/embargo_expiry_spec.rb
+++ b/spec/models/alaveteli_pro/activity_list/embargo_expiry_spec.rb
@@ -4,8 +4,8 @@
include Rails.application.routes.url_helpers
let!(:user) { FactoryBot.create(:user) }
- let!(:info_request) { FactoryBot.create(:info_request, :user => user) }
- let!(:event) { FactoryBot.create(:expire_embargo_event, :info_request => info_request) }
+ let!(:info_request) { FactoryBot.create(:info_request, user: user) }
+ let!(:event) { FactoryBot.create(:expire_embargo_event, info_request: info_request) }
let!(:activity) { described_class.new(event) }
describe '#description' do
diff --git a/spec/models/alaveteli_pro/activity_list/list_spec.rb b/spec/models/alaveteli_pro/activity_list/list_spec.rb
index 6f6c36184b..4b317973d6 100644
--- a/spec/models/alaveteli_pro/activity_list/list_spec.rb
+++ b/spec/models/alaveteli_pro/activity_list/list_spec.rb
@@ -37,9 +37,9 @@
it "returns the user's info_request_events if
included in the event types" do
user = FactoryBot.create(:user)
- info_request = FactoryBot.create(:info_request, :user => user)
+ info_request = FactoryBot.create(:info_request, user: user)
edit_event = FactoryBot.create(:edit_event,
- :info_request => info_request)
+ info_request: info_request)
list = described_class.new(user, 1, 10)
expect(list.events).
to eq([info_request.last_event_forming_initial_request])
@@ -51,13 +51,13 @@
it 'returns an array of items representing the current page of events' do
user = FactoryBot.create(:user)
- info_request = FactoryBot.create(:info_request, :user => user)
+ info_request = FactoryBot.create(:info_request, user: user)
response_event = FactoryBot.create(:response_event,
- :info_request => info_request)
+ info_request: info_request)
comment_event = FactoryBot.create(:comment_event,
- :info_request => info_request)
+ info_request: info_request)
resent_event = FactoryBot.create(:resent_event,
- :info_request => info_request)
+ info_request: info_request)
list = described_class.new(user, 1, 2)
expect(list.current_items.first).
to be_a(AlaveteliPro::ActivityList::RequestResent)
diff --git a/spec/models/alaveteli_pro/activity_list/overdue_spec.rb b/spec/models/alaveteli_pro/activity_list/overdue_spec.rb
index 13ee30dcef..f106a02c5c 100644
--- a/spec/models/alaveteli_pro/activity_list/overdue_spec.rb
+++ b/spec/models/alaveteli_pro/activity_list/overdue_spec.rb
@@ -30,8 +30,8 @@
it 'returns the url of the info_request' do
expect(activity.call_to_action_url).
- to eq new_request_followup_path(:request_id => event.info_request.id,
- :anchor => 'followup')
+ to eq new_request_followup_path(request_id: event.info_request.id,
+ anchor: 'followup')
end
end
diff --git a/spec/models/alaveteli_pro/activity_list/very_overdue_spec.rb b/spec/models/alaveteli_pro/activity_list/very_overdue_spec.rb
index 516e7559a2..625a504d92 100644
--- a/spec/models/alaveteli_pro/activity_list/very_overdue_spec.rb
+++ b/spec/models/alaveteli_pro/activity_list/very_overdue_spec.rb
@@ -30,9 +30,9 @@
it 'returns the url of the info_request' do
expect(activity.call_to_action_url).
- to eq new_request_followup_path(:request_id => event.info_request.id,
- :anchor => 'followup',
- :internal_review => 1)
+ to eq new_request_followup_path(request_id: event.info_request.id,
+ anchor: 'followup',
+ internal_review: 1)
end
end
diff --git a/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb b/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
index 1271a1bd65..5c8c104d3f 100644
--- a/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
+++ b/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
@@ -35,11 +35,11 @@
end
it "it imposes an alphabetical sort order on associated public bodies" do
- public_body1 = FactoryBot.create(:public_body, :name => "Body 1")
- public_body2 = FactoryBot.create(:public_body, :name => "A Public Body")
+ public_body1 = FactoryBot.create(:public_body, name: "Body 1")
+ public_body2 = FactoryBot.create(:public_body, name: "A Public Body")
draft = FactoryBot.create(:draft_info_request_batch,
- :public_bodies => [public_body1, public_body2],
- :user => pro_user)
+ public_bodies: [public_body1, public_body2],
+ user: pro_user)
draft.reload
expect(draft.public_bodies).to eq ([public_body2, public_body1])
end
diff --git a/spec/models/alaveteli_pro/embargo_spec.rb b/spec/models/alaveteli_pro/embargo_spec.rb
index b5aeff5720..288f12d182 100644
--- a/spec/models/alaveteli_pro/embargo_spec.rb
+++ b/spec/models/alaveteli_pro/embargo_spec.rb
@@ -14,7 +14,7 @@
require 'spec_helper'
-RSpec.describe AlaveteliPro::Embargo, :type => :model do
+RSpec.describe AlaveteliPro::Embargo, type: :model do
let(:embargo) { FactoryBot.create(:embargo) }
it 'belongs to an info_request' do
@@ -143,12 +143,12 @@
describe 'expiring scope' do
it 'includes embargoes expiring in less than a week' do
- embargo = FactoryBot.create(:embargo, :publish_at => Time.now + 6.days)
+ embargo = FactoryBot.create(:embargo, publish_at: Time.now + 6.days)
expect(AlaveteliPro::Embargo.expiring.include?(embargo)).to be true
end
it 'excludes embargoes expiring in more than a week' do
- embargo = FactoryBot.create(:embargo, :publish_at => Time.now + 8.days)
+ embargo = FactoryBot.create(:embargo, publish_at: Time.now + 8.days)
expect(AlaveteliPro::Embargo.expiring.include?(embargo)).to be false
end
@@ -158,25 +158,25 @@
it 'returns true if the embargo expires in less than a week' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now + 6.days)
+ publish_at: Time.zone.now + 6.days)
expect(embargo.expiring_soon?).to be true
end
it 'returns true if the embargo expires in a week' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now + 7.days)
+ publish_at: Time.zone.now + 7.days)
expect(embargo.expiring_soon?).to be true
end
it 'returns false if the embargo expires in more than a week' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now + 8.days)
+ publish_at: Time.zone.now + 8.days)
expect(embargo.expiring_soon?).to be false
end
it 'returns false if the embargo has already expired' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now.beginning_of_day)
+ publish_at: Time.zone.now.beginning_of_day)
expect(embargo.expiring_soon?).to be false
end
@@ -186,18 +186,18 @@
it 'returns false if the publication date is in the future' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now + 1.day)
+ publish_at: Time.zone.now + 1.day)
expect(embargo.expired?).to be false
end
it 'returns true if the publication date is in the past' do
embargo = FactoryBot.build(:embargo,
- :publish_at => Time.zone.now - 1.day)
+ publish_at: Time.zone.now - 1.day)
expect(embargo.expired?).to be true
end
it 'returns true on the publication date' do
- embargo = FactoryBot.build(:embargo, :publish_at => Time.zone.now)
+ embargo = FactoryBot.build(:embargo, publish_at: Time.zone.now)
expect(embargo.expired?).to be true
end
@@ -217,7 +217,7 @@
expiry_events = info_request.
reload.
info_request_events.
- where(:event_type => 'expire_embargo')
+ where(event_type: 'expire_embargo')
expect(expiry_events.size).to eq 1
end
diff --git a/spec/models/alaveteli_pro/request_filter_spec.rb b/spec/models/alaveteli_pro/request_filter_spec.rb
index 8082f2656f..046cadfdc3 100644
--- a/spec/models/alaveteli_pro/request_filter_spec.rb
+++ b/spec/models/alaveteli_pro/request_filter_spec.rb
@@ -6,25 +6,25 @@
it 'assigns the filter' do
request_filter = described_class.new
- request_filter.update(:filter => 'awaiting_response')
+ request_filter.update(filter: 'awaiting_response')
expect(request_filter.filter).to eq 'awaiting_response'
end
it 'assigns the search' do
request_filter = described_class.new
- request_filter.update(:search => 'lazy dog')
+ request_filter.update(search: 'lazy dog')
expect(request_filter.search).to eq 'lazy dog'
end
it 'assigns the order' do
request_filter = described_class.new
- request_filter.update(:order => 'created_at_asc')
+ request_filter.update(order: 'created_at_asc')
expect(request_filter.order).to eq 'created_at_asc'
end
it 'does not assign an empty filter' do
request_filter = described_class.new
- request_filter.update(:filter => '')
+ request_filter.update(filter: '')
expect(request_filter.filter).to be nil
end
@@ -34,7 +34,7 @@
def expect_label(label, filter)
request_filter = described_class.new
- request_filter.update(:filter => filter)
+ request_filter.update(filter: filter)
expect(request_filter.filter_capital_label).to eq label
end
@@ -76,7 +76,7 @@ def expect_label(label, filter)
def expect_label(label, filter)
request_filter = described_class.new
- request_filter.update(:filter => filter)
+ request_filter.update(filter: filter)
expect(request_filter.filter_label).to eq label
end
@@ -138,8 +138,8 @@ def expect_label(label, filter)
context 'when no attributes are supplied' do
it 'sorts the requests by most recently updated' do
- first_request = FactoryBot.create(:info_request, :user => user)
- second_request = FactoryBot.create(:info_request, :user => user)
+ first_request = FactoryBot.create(:info_request, user: user)
+ second_request = FactoryBot.create(:info_request, user: user)
request_filter = described_class.new
expected = [second_request.request_summary,
diff --git a/spec/models/alaveteli_pro/to_do_list/expiring_embargo_spec.rb b/spec/models/alaveteli_pro/to_do_list/expiring_embargo_spec.rb
index e4b6732483..8e85ecd316 100644
--- a/spec/models/alaveteli_pro/to_do_list/expiring_embargo_spec.rb
+++ b/spec/models/alaveteli_pro/to_do_list/expiring_embargo_spec.rb
@@ -18,7 +18,7 @@
end
it 'gives a description for multiple expiring embargoes' do
- embargo2 = FactoryBot.create(:expiring_embargo, :user => user)
+ embargo2 = FactoryBot.create(:expiring_embargo, user: user)
AlaveteliPro::RequestSummary.create_or_update_from(embargo2.info_request)
expect(@expiring_embargo.description).to eq "2 requests will be made public this week."
end
@@ -46,7 +46,7 @@
context 'when there is more than one item' do
it 'returns a link to the info request list with a "embargoed" filter' do
- embargo2 = FactoryBot.create(:expiring_embargo, :user => user)
+ embargo2 = FactoryBot.create(:expiring_embargo, user: user)
AlaveteliPro::RequestSummary.
create_or_update_from(embargo2.info_request)
expect(@expiring_embargo.url)
@@ -71,7 +71,7 @@
context 'when there is more than one item' do
it 'returns an appropriate text' do
- embargo2 = FactoryBot.create(:expiring_embargo, :user => user)
+ embargo2 = FactoryBot.create(:expiring_embargo, user: user)
AlaveteliPro::RequestSummary.
create_or_update_from(embargo2.info_request)
expect(@expiring_embargo.call_to_action).
diff --git a/spec/models/alaveteli_pro/to_do_list/list_spec.rb b/spec/models/alaveteli_pro/to_do_list/list_spec.rb
index e269496c65..e1f00b09da 100644
--- a/spec/models/alaveteli_pro/to_do_list/list_spec.rb
+++ b/spec/models/alaveteli_pro/to_do_list/list_spec.rb
@@ -31,9 +31,9 @@
it 'returns items whose count is greater than zero' do
user = FactoryBot.create(:user)
- new_response = double('new_response', :count => 1)
- expiring_embargo = double('expiring_embargo', :count => 0)
- overdue_request = double('overdue_request', :count => 2)
+ new_response = double('new_response', count: 1)
+ expiring_embargo = double('expiring_embargo', count: 0)
+ overdue_request = double('overdue_request', count: 2)
allow(AlaveteliPro::ToDoList::NewResponse).to receive(:new)
.and_return(new_response)
allow(AlaveteliPro::ToDoList::ExpiringEmbargo).to receive(:new)
diff --git a/spec/models/alaveteli_pro/to_do_list/new_response_spec.rb b/spec/models/alaveteli_pro/to_do_list/new_response_spec.rb
index 7f8a5393bd..3e440a281f 100644
--- a/spec/models/alaveteli_pro/to_do_list/new_response_spec.rb
+++ b/spec/models/alaveteli_pro/to_do_list/new_response_spec.rb
@@ -19,7 +19,7 @@
end
it 'gives a description for multiple responses' do
- request = FactoryBot.create(:old_unclassified_request, :user => user)
+ request = FactoryBot.create(:old_unclassified_request, user: user)
AlaveteliPro::RequestSummary.create_or_update_from(request)
expect(@new_response.description).
to eq "2 requests have received a response."
@@ -48,7 +48,7 @@
context 'when there is more than one item' do
it 'returns a link to the info request list with a "response_received" filter' do
- request = FactoryBot.create(:old_unclassified_request, :user => user)
+ request = FactoryBot.create(:old_unclassified_request, user: user)
AlaveteliPro::RequestSummary.create_or_update_from(request)
expect(@new_response.url)
.to eq alaveteli_pro_info_requests_path('alaveteli_pro_request_filter[filter]' =>
@@ -72,7 +72,7 @@
context 'when there is more than one item' do
it 'returns an appropriate text' do
- request = FactoryBot.create(:old_unclassified_request, :user => user)
+ request = FactoryBot.create(:old_unclassified_request, user: user)
AlaveteliPro::RequestSummary.create_or_update_from(request)
expect(@new_response.call_to_action).to eq 'Update statuses.'
end
diff --git a/spec/models/alaveteli_pro/to_do_list/overdue_request_spec.rb b/spec/models/alaveteli_pro/to_do_list/overdue_request_spec.rb
index d9d308e7d4..e4a8711d1c 100644
--- a/spec/models/alaveteli_pro/to_do_list/overdue_request_spec.rb
+++ b/spec/models/alaveteli_pro/to_do_list/overdue_request_spec.rb
@@ -23,7 +23,7 @@
it 'gives a description for multiple responses' do
request = travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2015-12-01')) do
AlaveteliPro::RequestSummary.create_or_update_from(info_request)
@@ -60,7 +60,7 @@
it 'returns a link to the info request list with a "overdue" filter' do
request = travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2015-12-01')) do
AlaveteliPro::RequestSummary.create_or_update_from(info_request)
@@ -94,7 +94,7 @@
it 'returns an appropriate text' do
travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2015-12-01')) do
expect(@overdue_request.call_to_action)
diff --git a/spec/models/alaveteli_pro/to_do_list/very_overdue_request_spec.rb b/spec/models/alaveteli_pro/to_do_list/very_overdue_request_spec.rb
index 31381e9f5b..374be5288e 100644
--- a/spec/models/alaveteli_pro/to_do_list/very_overdue_request_spec.rb
+++ b/spec/models/alaveteli_pro/to_do_list/very_overdue_request_spec.rb
@@ -22,7 +22,7 @@
it 'gives a description for multiple responses' do
request = travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2016-01-01')) do
AlaveteliPro::RequestSummary.create_or_update_from(request)
@@ -58,7 +58,7 @@
it 'returns a link to the info request list with a "very_overdue" filter' do
request = travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2016-01-01')) do
AlaveteliPro::RequestSummary.create_or_update_from(info_request)
@@ -91,7 +91,7 @@
it 'returns an appropriate text' do
request = travel_to(Time.zone.parse('2015-11-01')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2016-01-01')) do
AlaveteliPro::RequestSummary.create_or_update_from(request)
diff --git a/spec/models/censor_rule_spec.rb b/spec/models/censor_rule_spec.rb
index 20cac4a89e..0d165521fd 100644
--- a/spec/models/censor_rule_spec.rb
+++ b/spec/models/censor_rule_spec.rb
@@ -23,28 +23,28 @@
describe '#apply_to_text' do
it 'applies the rule to the text' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some secret text'
expect(rule.apply_to_text(text)).to eq('Some [REDACTED] text')
end
it 'does not mutate the input' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some secret text'
rule.apply_to_text(text)
expect(text).to eq('Some secret text')
end
it 'returns the text if the rule is unmatched' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some text'
expect(rule.apply_to_text(text)).to eq('Some text')
end
it 'replaces the regexp with the replacement text when applied to text' do
- attrs = { :text => '--PRIVATE.*--PRIVATE',
- :replacement => "--REMOVED\nHidden private info\n--REMOVED",
- :regexp => true }
+ attrs = { text: '--PRIVATE.*--PRIVATE',
+ replacement: "--REMOVED\nHidden private info\n--REMOVED",
+ regexp: true }
rule = FactoryBot.build(:censor_rule, attrs)
text = <<-EOF.strip_heredoc
Some public information
@@ -66,13 +66,13 @@
describe '#apply_to_binary' do
it 'applies the rule to the text' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some secret text'
expect(rule.apply_to_binary(text)).to eq('Some xxxxxx text')
end
it 'does not modify the size of the string' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some secret text'
original_text = text.dup
redacted = rule.apply_to_binary(text)
@@ -88,14 +88,14 @@
end
it 'does not mutate the input' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some secret text'
rule.apply_to_binary(text)
expect(text).to eq('Some secret text')
end
it 'returns the text if the rule is unmatched' do
- rule = FactoryBot.build(:censor_rule, :text => 'secret')
+ rule = FactoryBot.build(:censor_rule, text: 'secret')
text = 'Some text'
expect(rule.apply_to_binary(text)).to eq('Some text')
end
@@ -108,7 +108,7 @@
end
it 'handles a UTF-8 rule and ASCII-8BIT text' do
- rule = FactoryBot.build(:censor_rule, :text => 'sécret')
+ rule = FactoryBot.build(:censor_rule, text: 'sécret')
text = 'Some sécret text'
text.force_encoding('ASCII-8BIT')
expect(rule.apply_to_binary(text)).to eq("Some xxxxxxx text")
@@ -116,9 +116,9 @@
it "replaces the regexp with the same number of 'x' characters as the text
replaced when applied to binary" do
- attrs = { :text => '--PRIVATE.*--PRIVATE',
- :replacement => "--REMOVED\nHidden private info\n--REMOVED",
- :regexp => true }
+ attrs = { text: '--PRIVATE.*--PRIVATE',
+ replacement: "--REMOVED\nHidden private info\n--REMOVED",
+ regexp: true }
rule = FactoryBot.build(:censor_rule, attrs)
text = <<-EOF.strip_heredoc
Some public information
@@ -136,9 +136,9 @@
end
it 'handles a UTF-8 rule with ASCII-8BIT text' do
- attrs = { :text => '--PRIVATE.*--P‘RIVATE',
- :replacement => "--REMOVED\nHidden private info\n--REMOVED",
- :regexp => true }
+ attrs = { text: '--PRIVATE.*--P‘RIVATE',
+ replacement: "--REMOVED\nHidden private info\n--REMOVED",
+ regexp: true }
rule = FactoryBot.build(:censor_rule, attrs)
text = <<-EOF.strip_heredoc
Some public information
@@ -163,21 +163,21 @@
it 'calls expire on the request if it is a request rule' do
request = FactoryBot.create(:info_request)
rule = FactoryBot.create(:info_request_censor_rule,
- :info_request => request)
+ info_request: request)
expect(request).to receive(:expire)
rule.expire_requests
end
it 'calls expire_requests on the user if it is a user rule' do
user = FactoryBot.create(:user)
- rule = FactoryBot.create(:user_censor_rule, :user => user)
+ rule = FactoryBot.create(:user_censor_rule, user: user)
expect(user).to receive(:expire_requests)
rule.expire_requests
end
it 'calls expire_requests on the public body if it is a public body rule' do
body = FactoryBot.create(:public_body)
- rule = FactoryBot.create(:public_body_censor_rule, :public_body => body)
+ rule = FactoryBot.create(:public_body_censor_rule, public_body: body)
expect(body).to receive(:expire_requests)
rule.expire_requests
end
@@ -284,11 +284,11 @@
describe 'when validating a regexp rule' do
before do
- @censor_rule = CensorRule.new(:regexp => true,
- :text => '*',
- :replacement => '---',
- :last_edit_comment => 'test',
- :last_edit_editor => 'rspec')
+ @censor_rule = CensorRule.new(regexp: true,
+ text: '*',
+ replacement: '---',
+ last_edit_comment: 'test',
+ last_edit_editor: 'rspec')
end
it 'should try to create a regexp from the text' do
@@ -351,15 +351,15 @@
describe '.global' do
before do
- @global_rule = CensorRule.create!(:text => 'hide me',
- :replacement => 'nothing to see here',
- :last_edit_editor => 1,
- :last_edit_comment => 'comment')
- @user_rule = CensorRule.create!(:user_id => 1,
- :text => 'hide me',
- :replacement => 'nothing to see here',
- :last_edit_editor => 1,
- :last_edit_comment => 'comment')
+ @global_rule = CensorRule.create!(text: 'hide me',
+ replacement: 'nothing to see here',
+ last_edit_editor: 1,
+ last_edit_comment: 'comment')
+ @user_rule = CensorRule.create!(user_id: 1,
+ text: 'hide me',
+ replacement: 'nothing to see here',
+ last_edit_editor: 1,
+ last_edit_comment: 'comment')
end
it 'should include an instance without user_id, request_id or public_body_id' do
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index 6b7f5b5c9b..5d2b4f231c 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -23,22 +23,22 @@
describe '.visible' do
before(:each) do
- @visible_request = FactoryBot.create(:info_request, :prominence => "normal")
- @hidden_request = FactoryBot.create(:info_request, :prominence => "hidden")
+ @visible_request = FactoryBot.create(:info_request, prominence: "normal")
+ @hidden_request = FactoryBot.create(:info_request, prominence: "hidden")
end
it 'should treat new comments to be visible by default' do
- comment = FactoryBot.create(:comment, :info_request => @visible_request)
+ comment = FactoryBot.create(:comment, info_request: @visible_request)
expect(@visible_request.comments.visible).to eq([comment])
end
it 'should treat comments which have be hidden as not visible' do
- comment = FactoryBot.create(:hidden_comment, :info_request => @visible_request)
+ comment = FactoryBot.create(:hidden_comment, info_request: @visible_request)
expect(@visible_request.comments.visible).to eq([])
end
it 'should treat visible comments attached to a hidden request as not visible' do
- comment = FactoryBot.create(:comment, :info_request => @hidden_request)
+ comment = FactoryBot.create(:comment, info_request: @hidden_request)
expect(comment.visible).to eq(true)
expect(@hidden_request.comments.visible).to eq([])
end
@@ -50,10 +50,10 @@
before(:each) do
@info_request = FactoryBot.create(:info_request)
@request_comment = FactoryBot.create(:comment,
- :info_request => @info_request)
+ info_request: @info_request)
@embargoed_request = FactoryBot.create(:embargoed_request)
@embargoed_comment = FactoryBot.create(:comment,
- :info_request => @embargoed_request)
+ info_request: @embargoed_request)
end
it 'includes comments on embargoed requests' do
@@ -71,10 +71,10 @@
before(:each) do
@info_request = FactoryBot.create(:info_request)
@request_comment = FactoryBot.create(:comment,
- :info_request => @info_request)
+ info_request: @info_request)
@embargoed_request = FactoryBot.create(:embargoed_request)
@embargoed_comment = FactoryBot.create(:comment,
- :info_request => @embargoed_request)
+ info_request: @embargoed_request)
end
it 'does not include comments on embargoed requests' do
@@ -104,12 +104,12 @@
describe '#hidden?' do
it 'returns true if the comment is not visible' do
- comment = Comment.new(:visible => false)
+ comment = Comment.new(visible: false)
expect(comment.hidden?).to eq(true)
end
it 'returns false if the comment is visible' do
- comment = Comment.new(:visible => true)
+ comment = Comment.new(visible: true)
expect(comment.hidden?).to eq(false)
end
@@ -165,7 +165,7 @@
it "includes a note about the comment in the admin email" do
expected =
"The user wishes to draw attention to the comment: " \
- "#{comment_url(comment, :host => AlaveteliConfiguration.domain)}"
+ "#{comment_url(comment, host: AlaveteliConfiguration.domain)}"
comment.report!("Vexatious comment", "Comment is bad, please hide", user)
notification = ActionMailer::Base.deliveries.last
expect(notification.body).to match(expected)
@@ -173,16 +173,16 @@
it 'logs the report_comment event' do
comment.info_request_events.
- where(:event_type => 'report_comment').destroy_all
+ where(event_type: 'report_comment').destroy_all
comment.report!("Vexatious comment", "Comment is bad, please hide", user)
comment.reload
most_recent_event = comment.info_request_events.last
expect(most_recent_event.event_type).to eq('report_comment')
expect(most_recent_event.params).
- to include(:reason => "Vexatious comment")
+ to include(reason: "Vexatious comment")
expect(most_recent_event.params).
- to include(:message => "Comment is bad, please hide")
+ to include(message: "Comment is bad, please hide")
end
end
diff --git a/spec/models/customstates.rb b/spec/models/customstates.rb
index a02c0488f0..94037a304c 100644
--- a/spec/models/customstates.rb
+++ b/spec/models/customstates.rb
@@ -37,7 +37,7 @@ def theme_display_status(status)
elsif status == 'wrong_response'
_("Wrong Response.")
else
- raise _("unknown status {{status}}", :status => status)
+ raise _("unknown status {{status}}", status: status)
end
end
@@ -47,7 +47,7 @@ def theme_short_description(status)
elsif status == 'wrong_response'
_("Wrong Response")
else
- raise _("unknown status {{status}}", :status => status)
+ raise _("unknown status {{status}}", status: status)
end
end
diff --git a/spec/models/holiday_import_spec.rb b/spec/models/holiday_import_spec.rb
index 3d0e4a8c2c..f6a6c2f0e9 100644
--- a/spec/models/holiday_import_spec.rb
+++ b/spec/models/holiday_import_spec.rb
@@ -3,25 +3,25 @@
RSpec.describe HolidayImport do
it 'validates the presence of a feed if the source is a feed' do
- holiday_import = HolidayImport.new(:source => 'feed')
+ holiday_import = HolidayImport.new(source: 'feed')
expect(holiday_import.valid?).to be false
expect(holiday_import.errors[:ical_feed_url]).to eq(["can't be blank"])
end
it 'does not validate the presence of a feed if the source is suggestions' do
- holiday_import = HolidayImport.new(:source => 'suggestions')
+ holiday_import = HolidayImport.new(source: 'suggestions')
expect(holiday_import.valid?).to be true
end
it 'validates that the source is either "feed" or "suggestions"' do
- holiday_import = HolidayImport.new(:source => 'something')
+ holiday_import = HolidayImport.new(source: 'something')
expect(holiday_import.valid?).to be false
expect(holiday_import.errors[:source]).to eq(["is not included in the list"])
end
it 'validates that all holidays create from attributes are valid' do
- holiday_import = HolidayImport.new(:source => 'suggestions',
- :holidays_attributes => {"0" => {:description => '',
+ holiday_import = HolidayImport.new(source: 'suggestions',
+ holidays_attributes: {"0" => {:description => '',
"day(1i)"=>"",
"day(2i)"=>"",
"day(3i)"=>""}})
@@ -43,13 +43,13 @@
end
it 'allows the start and end year to be set' do
- holiday_import = HolidayImport.new(:start_year => 2011, :end_year => 2012)
+ holiday_import = HolidayImport.new(start_year: 2011, end_year: 2012)
expect(holiday_import.start_year).to eq(2011)
expect(holiday_import.end_year).to eq(2012)
end
it 'sets the start and end dates to the beginning and end of the year' do
- holiday_import = HolidayImport.new(:start_year => 2011, :end_year => 2012)
+ holiday_import = HolidayImport.new(start_year: 2011, end_year: 2012)
expect(holiday_import.start_date).to eq(Date.new(2011, 1, 1))
expect(holiday_import.end_date).to eq(Date.new(2012, 12, 31))
end
@@ -60,12 +60,12 @@
end
it 'allows the source to be set' do
- holiday_import = HolidayImport.new(:source => 'feed')
+ holiday_import = HolidayImport.new(source: 'feed')
expect(holiday_import.source).to eq('feed')
end
it 'allows an iCal feed URL to be set' do
- holiday_import = HolidayImport.new(:ical_feed_url => 'http://www.example.com')
+ holiday_import = HolidayImport.new(ical_feed_url: 'http://www.example.com')
expect(holiday_import.ical_feed_url).to eq('http://www.example.com')
end
@@ -75,11 +75,11 @@
end
it 'returns a readable description of the period for multiple years' do
- expect(HolidayImport.new(:start_year => 2011, :end_year => 2012).period).to eq('2011-2012')
+ expect(HolidayImport.new(start_year: 2011, end_year: 2012).period).to eq('2011-2012')
end
it 'returns a readable description of the period for a single year' do
- expect(HolidayImport.new(:start_year => 2011, :end_year => 2011).period).to eq('2011')
+ expect(HolidayImport.new(start_year: 2011, end_year: 2011).period).to eq('2011')
end
it 'returns the country name for which suggestions are generated' do
@@ -89,11 +89,11 @@
describe 'when populating a set of holidays to import from suggestions' do
it 'should populate holidays from the suggestions' do
- holidays = [ { :date => Date.new(2014, 1, 1),
- :name => "New Year's Day",
- :regions => [:gb] } ]
+ holidays = [ { date: Date.new(2014, 1, 1),
+ name: "New Year's Day",
+ regions: [:gb] } ]
allow(Holidays).to receive(:between).and_return(holidays)
- @holiday_import = HolidayImport.new(:source => 'suggestions')
+ @holiday_import = HolidayImport.new(source: 'suggestions')
@holiday_import.populate
expect(@holiday_import.holidays.size).to eq(1)
@@ -104,17 +104,17 @@
it 'returns an empty array for an unknown country code' do
allow(AlaveteliConfiguration).to receive(:iso_country_code).and_return('UNKNOWN_COUNTRY_CODE')
- @holiday_import = HolidayImport.new(:source => 'suggestions')
+ @holiday_import = HolidayImport.new(source: 'suggestions')
@holiday_import.populate
expect(@holiday_import.holidays).to be_empty
end
it 'should return a flag that it has been populated' do
- holidays = [ { :date => Date.new(2014, 1, 1),
- :name => "New Year's Day",
- :regions => [:gb] } ]
+ holidays = [ { date: Date.new(2014, 1, 1),
+ name: "New Year's Day",
+ regions: [:gb] } ]
allow(Holidays).to receive(:between).and_return(holidays)
- @holiday_import = HolidayImport.new(:source => 'suggestions')
+ @holiday_import = HolidayImport.new(source: 'suggestions')
@holiday_import.populate
expect(@holiday_import.populated).to eq(true)
@@ -125,10 +125,10 @@
describe 'when populating a set of holidays to import from a feed' do
before do
- @holiday_import = HolidayImport.new(:source => 'feed',
- :ical_feed_url => 'http://www.example.com',
- :start_year => 2014,
- :end_year => 2014)
+ @holiday_import = HolidayImport.new(source: 'feed',
+ ical_feed_url: 'http://www.example.com',
+ start_year: 2014,
+ end_year: 2014)
end
it 'should populate holidays from the feed that are between the dates' do
diff --git a/spec/models/incoming_message_error_spec.rb b/spec/models/incoming_message_error_spec.rb
index 5cf41999a7..fcfbbcec19 100644
--- a/spec/models/incoming_message_error_spec.rb
+++ b/spec/models/incoming_message_error_spec.rb
@@ -19,7 +19,7 @@
it 'requres a unique ID' do
expect(IncomingMessageError.new).not_to be_valid
- expect(IncomingMessageError.new(:unique_id => 'xxx')).to be_valid
+ expect(IncomingMessageError.new(unique_id: 'xxx')).to be_valid
end
end
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index d9104f94e1..19b57b375f 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -131,8 +131,8 @@
message.parse_raw_email!(true)
message.reload
FactoryBot.create(:censor_rule,
- :text => 'Person',
- :info_request => message.info_request)
+ text: 'Person',
+ info_request: message.info_request)
expect(message.safe_from_name).to eq('FOI [REDACTED]')
end
@@ -327,8 +327,8 @@
before(:each) do
@im = incoming_messages(:useless_incoming_message)
- @default_opts = { :last_edit_editor => 'unknown',
- :last_edit_comment => 'none' }
+ @default_opts = { last_edit_editor: 'unknown',
+ last_edit_comment: 'none' }
load_raw_emails_data
end
@@ -337,8 +337,8 @@
data = 'There was a mouse called Stilton, he wished that he was blue'
expected = 'There was a mouse called Stilton, he said that he was blue'
- opts = { :text => 'wished',
- :replacement => 'said' }.merge(@default_opts)
+ opts = { text: 'wished',
+ replacement: 'said' }.merge(@default_opts)
CensorRule.create!(opts)
result = @im.apply_masks(data, 'text/plain')
@@ -351,8 +351,8 @@
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -368,8 +368,8 @@
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -443,7 +443,7 @@
it 'strips null bytes from the extracted clipped text' do
message = FactoryBot.create(:incoming_message)
FactoryBot.
- create(:body_text, :body => "hi\u0000", :incoming_message => message)
+ create(:body_text, body: "hi\u0000", incoming_message: message)
message.reload
expect(message.get_attachment_text_clipped).to eq("hi\n\n")
end
@@ -455,13 +455,13 @@
it 'does not generate incompatible character encodings' do
message = FactoryBot.create(:incoming_message)
FactoryBot.create(:body_text,
- :body => 'hí',
- :incoming_message => message,
- :url_part_number => 2)
+ body: 'hí',
+ incoming_message: message,
+ url_part_number: 2)
FactoryBot.create(:pdf_attachment,
- :body => load_file_fixture('pdf-with-utf8-characters.pdf'),
- :incoming_message => message,
- :url_part_number => 3)
+ body: load_file_fixture('pdf-with-utf8-characters.pdf'),
+ incoming_message: message,
+ url_part_number: 3)
message.reload
expect { message._extract_text }.
@@ -544,11 +544,11 @@
let(:request) { FactoryBot.create(:info_request) }
it "updates the info_request's last_public_response_at to nil when hidden" do
- im = FactoryBot.create(:incoming_message, :info_request => request)
+ im = FactoryBot.create(:incoming_message, info_request: request)
response_event = FactoryBot.
- create(:info_request_event, :event_type => 'response',
- :info_request => request,
- :incoming_message => im)
+ create(:info_request_event, event_type: 'response',
+ info_request: request,
+ incoming_message: im)
im.prominence = 'hidden'
im.save!
expect(request.last_public_response_at).to be_nil
@@ -556,12 +556,12 @@
it "updates the info_request's last_public_response_at to a timestamp \
when unhidden" do
- im = FactoryBot.create(:incoming_message, :prominence => 'hidden',
- :info_request => request)
+ im = FactoryBot.create(:incoming_message, prominence: 'hidden',
+ info_request: request)
response_event = FactoryBot.
- create(:info_request_event, :event_type => 'response',
- :info_request => request,
- :incoming_message => im)
+ create(:info_request_event, event_type: 'response',
+ info_request: request,
+ incoming_message: im)
im.prominence = 'normal'
im.save!
expect(request.last_public_response_at).to be_within(1.second).
@@ -575,7 +575,7 @@
it 'destroys the incoming message' do
incoming_message.destroy
- expect(IncomingMessage.where(:id => incoming_message.id)).to be_empty
+ expect(IncomingMessage.where(id: incoming_message.id)).to be_empty
end
it 'should destroy the related info_request_event' do
@@ -586,28 +586,28 @@
)
incoming_message.reload
incoming_message.destroy
- expect(InfoRequestEvent.where(:incoming_message_id => incoming_message.id)).
+ expect(InfoRequestEvent.where(incoming_message_id: incoming_message.id)).
to be_empty
end
it 'should nullify outgoing_message_followups' do
outgoing_message = FactoryBot.
create(:initial_request,
- :info_request => incoming_message.info_request,
- :incoming_message_followup_id => incoming_message.id)
+ info_request: incoming_message.info_request,
+ incoming_message_followup_id: incoming_message.id)
incoming_message.reload
incoming_message.destroy
expect(OutgoingMessage.
- where(:incoming_message_followup_id => incoming_message.id)).to be_empty
- expect(OutgoingMessage.where(:id => outgoing_message.id)).
+ where(incoming_message_followup_id: incoming_message.id)).to be_empty
+ expect(OutgoingMessage.where(id: outgoing_message.id)).
to eq([outgoing_message])
end
it 'destroys the associated raw email' do
raw_email = incoming_message.raw_email
incoming_message.destroy
- expect(RawEmail.where(:id => raw_email.id)).to be_empty
+ expect(RawEmail.where(id: raw_email.id)).to be_empty
end
context 'with attachments' do
@@ -617,14 +617,14 @@
it 'destroys the incoming message' do
incoming_with_attachment.destroy
- expect(IncomingMessage.where(:id => incoming_with_attachment.id)).
+ expect(IncomingMessage.where(id: incoming_with_attachment.id)).
to be_empty
end
it 'should destroy associated attachments' do
incoming_with_attachment.destroy
expect(
- FoiAttachment.where(:incoming_message_id => incoming_with_attachment.id)
+ FoiAttachment.where(incoming_message_id: incoming_with_attachment.id)
).to be_empty
end
end
@@ -1035,17 +1035,17 @@ def populate_raw_email(fixture)
it 'handles the case where reparsing changes the body of the main part
and the cached attachment has been deleted' do
# original set of attachment attributes
- attachment_attributes = { :url_part_number => 1,
- :within_rfc822_subject => nil,
- :content_type => "text/plain",
- :charset => nil,
- :body => "No way!\n",
- :hexdigest => "0c8b1b0f5cb9c94ed15a180e73b5c7d1",
- :filename => nil }
+ attachment_attributes = { url_part_number: 1,
+ within_rfc822_subject: nil,
+ content_type: "text/plain",
+ charset: nil,
+ body: "No way!\n",
+ hexdigest: "0c8b1b0f5cb9c94ed15a180e73b5c7d1",
+ filename: nil }
# Make a small change in the body returned for the attachment
- new_attachment_attributes = attachment_attributes.merge(:body => "No way!",
- :hexdigest => "74d2c0a41e074f9cebe49324d5b47414")
+ new_attachment_attributes = attachment_attributes.merge(body: "No way!",
+ hexdigest: "74d2c0a41e074f9cebe49324d5b47414")
# Simulate parsing with the original attachments
diff --git a/spec/models/info_request/pro_query_spec.rb b/spec/models/info_request/pro_query_spec.rb
index 6f2db42272..d26998a8f6 100644
--- a/spec/models/info_request/pro_query_spec.rb
+++ b/spec/models/info_request/pro_query_spec.rb
@@ -6,7 +6,7 @@
it 'includes requests made by pro users' do
pro_user = FactoryBot.create(:pro_user)
- info_request = FactoryBot.create(:info_request, :user => pro_user)
+ info_request = FactoryBot.create(:info_request, user: pro_user)
expect(described_class.new.call.include?(info_request)).to be true
end
diff --git a/spec/models/info_request/prominence/embargo_expired_today_query_spec.rb b/spec/models/info_request/prominence/embargo_expired_today_query_spec.rb
index 22dbafacd8..7fca8db55a 100644
--- a/spec/models/info_request/prominence/embargo_expired_today_query_spec.rb
+++ b/spec/models/info_request/prominence/embargo_expired_today_query_spec.rb
@@ -7,7 +7,7 @@
it 'excludes requests that are currently under embargo' do
embargo = FactoryBot.create(:embargo,
- :publish_at => Time.now + 4.days)
+ publish_at: Time.now + 4.days)
expect(described_class.new.call).not_to include embargo.info_request
end
diff --git a/spec/models/info_request/prominence/embargo_expiring_query_spec.rb b/spec/models/info_request/prominence/embargo_expiring_query_spec.rb
index 589666c8e8..d0df8d6a89 100644
--- a/spec/models/info_request/prominence/embargo_expiring_query_spec.rb
+++ b/spec/models/info_request/prominence/embargo_expiring_query_spec.rb
@@ -6,13 +6,13 @@
it 'includes requests that have embargoes expiring within a week' do
embargo = FactoryBot.create(:embargo,
- :publish_at => Time.now + 4.days)
+ publish_at: Time.now + 4.days)
expect(described_class.new.call).to include embargo.info_request
end
it 'excludes requests that have embargoes expiring in over a week' do
embargo = FactoryBot.create(:embargo,
- :publish_at => Time.now + 8.days)
+ publish_at: Time.now + 8.days)
expect(described_class.new.call).not_to include embargo.info_request
end
diff --git a/spec/models/info_request/prominence/public_query_spec.rb b/spec/models/info_request/prominence/public_query_spec.rb
index dd9d067ffb..24ef44582e 100644
--- a/spec/models/info_request/prominence/public_query_spec.rb
+++ b/spec/models/info_request/prominence/public_query_spec.rb
@@ -6,8 +6,8 @@
it 'returns only results with a normal or backpaged prominence' do
normal_request = FactoryBot.create(:info_request)
- backpaged_request = FactoryBot.create(:info_request, :prominence => 'backpage')
- hidden_request = FactoryBot.create(:info_request, :prominence => 'hidden')
+ backpaged_request = FactoryBot.create(:info_request, prominence: 'backpage')
+ hidden_request = FactoryBot.create(:info_request, prominence: 'hidden')
requests = described_class.new.call
expect(requests).to include(normal_request)
expect(requests).to include(backpaged_request)
diff --git a/spec/models/info_request/prominence/searchable_query_spec.rb b/spec/models/info_request/prominence/searchable_query_spec.rb
index dee48488b3..7c03c0c721 100644
--- a/spec/models/info_request/prominence/searchable_query_spec.rb
+++ b/spec/models/info_request/prominence/searchable_query_spec.rb
@@ -6,7 +6,7 @@
it 'returns only results with a normal prominence' do
normal_request = FactoryBot.create(:info_request)
- hidden_request = FactoryBot.create(:info_request, :prominence => 'hidden')
+ hidden_request = FactoryBot.create(:info_request, prominence: 'hidden')
expect(described_class.new.call).to include(normal_request)
expect(described_class.new.call).not_to include(hidden_request)
end
diff --git a/spec/models/info_request/response_gatekeeper/base_spec.rb b/spec/models/info_request/response_gatekeeper/base_spec.rb
index dcacc681bf..f443067b47 100644
--- a/spec/models/info_request/response_gatekeeper/base_spec.rb
+++ b/spec/models/info_request/response_gatekeeper/base_spec.rb
@@ -57,7 +57,7 @@
it 'delegates to the info_request' do
info_request = FactoryBot.
- build(:info_request, :handle_rejected_responses => 'holding_pen')
+ build(:info_request, handle_rejected_responses: 'holding_pen')
gatekeeper = described_class.new(info_request)
expect(gatekeeper.rejection_action).to eq('holding_pen')
end
diff --git a/spec/models/info_request/response_gatekeeper/spam_checker_spec.rb b/spec/models/info_request/response_gatekeeper/spam_checker_spec.rb
index 395418f0f5..dd35def57d 100644
--- a/spec/models/info_request/response_gatekeeper/spam_checker_spec.rb
+++ b/spec/models/info_request/response_gatekeeper/spam_checker_spec.rb
@@ -10,7 +10,7 @@
end
it 'allows a custom spam_action' do
- expect(described_class.new(:spam_action => 'x').spam_action).to eq('x')
+ expect(described_class.new(spam_action: 'x').spam_action).to eq('x')
end
it 'sets a default spam_header' do
@@ -19,7 +19,7 @@
end
it 'allows a custom spam_header' do
- expect(described_class.new(:spam_header => 'x').spam_header).to eq('x')
+ expect(described_class.new(spam_header: 'x').spam_header).to eq('x')
end
it 'sets a default spam_threshold' do
@@ -28,7 +28,7 @@
end
it 'allows a custom spam_threshold' do
- expect(described_class.new(:spam_threshold => 'x').spam_threshold).
+ expect(described_class.new(spam_threshold: 'x').spam_threshold).
to eq('x')
end
@@ -37,7 +37,7 @@
describe '#spam_action' do
it 'returns the spam_action' do
- expect(described_class.new(:spam_action => 'x').spam_action).to eq('x')
+ expect(described_class.new(spam_action: 'x').spam_action).to eq('x')
end
end
@@ -54,7 +54,7 @@
describe '#spam_header' do
it 'returns the spam_header' do
- expect(described_class.new(:spam_header => 'x').spam_header).to eq('x')
+ expect(described_class.new(spam_header: 'x').spam_header).to eq('x')
end
end
@@ -62,7 +62,7 @@
describe '#spam_threshold' do
it 'returns the spam_threshold' do
- expect(described_class.new(:spam_threshold => 'x').spam_threshold).
+ expect(described_class.new(spam_threshold: 'x').spam_threshold).
to eq('x')
end
@@ -79,8 +79,8 @@
Plz buy my spam
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- attrs = { :spam_header => nil,
- :spam_threshold => 100 }
+ attrs = { spam_header: nil,
+ spam_threshold: 100 }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.allow?(email)).to eq(true)
end
@@ -94,9 +94,9 @@
Hello, World
EOF
email = MailHandler.mail_from_raw_email(raw_email)
- attrs = { :spam_header => 'X-Spam-Score',
- :spam_threshold => 100,
- :spam_action => 'discard' }
+ attrs = { spam_header: 'X-Spam-Score',
+ spam_threshold: 100,
+ spam_action: 'discard' }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.allow?(email)).to eq(true)
end
@@ -110,9 +110,9 @@
Plz buy my spam
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- attrs = { :spam_header => 'X-Spam-Score',
- :spam_threshold => 100,
- :spam_action => 'discard' }
+ attrs = { spam_header: 'X-Spam-Score',
+ spam_threshold: 100,
+ spam_action: 'discard' }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.allow?(email)).to eq(false)
end
@@ -121,7 +121,7 @@
describe '#reason' do
it 'returns the reason that the email was rejected' do
- gatekeeper = described_class.new(:spam_threshold => 10.0)
+ gatekeeper = described_class.new(spam_threshold: 10.0)
message = 'Incoming message has a spam score above the configured ' \
'threshold (10.0).'
expect(gatekeeper.reason).to eq(message)
@@ -140,8 +140,8 @@
Plz buy my spam
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- attrs = { :spam_header => 'X-Spam-Score',
- :spam_threshold => 100 }
+ attrs = { spam_header: 'X-Spam-Score',
+ spam_threshold: 100 }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.spam?(email)).to eq(true)
end
@@ -155,8 +155,8 @@
Hello, World
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- attrs = { :spam_header => 'X-Spam-Score',
- :spam_threshold => 100 }
+ attrs = { spam_header: 'X-Spam-Score',
+ spam_threshold: 100 }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.spam?(email)).to eq(false)
end
@@ -169,8 +169,8 @@
Hello, World
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- attrs = { :spam_header => 'X-Spam-Score',
- :spam_threshold => 100 }
+ attrs = { spam_header: 'X-Spam-Score',
+ spam_threshold: 100 }
gatekeeper = described_class.new(attrs)
expect(gatekeeper.spam?(email)).to eq(false)
end
@@ -188,7 +188,7 @@
Plz buy my spam
EOF
email = MailHandler.mail_from_raw_email(spam_email)
- gatekeeper = described_class.new(:spam_header => 'X-Spam-Score')
+ gatekeeper = described_class.new(spam_header: 'X-Spam-Score')
expect(gatekeeper.spam_score(email)).to eq(1000.4)
end
@@ -209,24 +209,24 @@
describe '#configured?' do
it 'requires a spam_action to be configured' do
- gatekeeper = described_class.new(:spam_action => nil)
+ gatekeeper = described_class.new(spam_action: nil)
expect(gatekeeper).to_not be_configured
end
it 'requires a spam_header to be configured' do
- gatekeeper = described_class.new(:spam_header => nil)
+ gatekeeper = described_class.new(spam_header: nil)
expect(gatekeeper).to_not be_configured
end
it 'requires a spam_threshold to be configured' do
- gatekeeper = described_class.new(:spam_threshold => nil)
+ gatekeeper = described_class.new(spam_threshold: nil)
expect(gatekeeper).to_not be_configured
end
it 'is configured if a spam_action, spam_header and spam_threshold exist' do
- attrs = { :spam_action => 'discard',
- :spam_header => 'X-Spam-Score',
- :spam_threshold => 10.0 }
+ attrs = { spam_action: 'discard',
+ spam_header: 'X-Spam-Score',
+ spam_threshold: 10.0 }
expect(described_class.new(attrs)).to be_configured
end
diff --git a/spec/models/info_request/response_rejection/bounce_spec.rb b/spec/models/info_request/response_rejection/bounce_spec.rb
index 8d6669d561..a682f9e705 100644
--- a/spec/models/info_request/response_rejection/bounce_spec.rb
+++ b/spec/models/info_request/response_rejection/bounce_spec.rb
@@ -24,7 +24,7 @@
it 'does nothing and returns true if the mail is from the ' \
'request address' do
info_request = object_double(InfoRequest.new,
- :incoming_email => 'request-333-xxx@example.com')
+ incoming_email: 'request-333-xxx@example.com')
raw_email = <<-EOF.strip_heredoc
To: Requester
From: Bad person
@@ -40,7 +40,7 @@
it 'does nothing and returns true if the mail is from the ' \
'request address regardless of case' do
info_request = object_double(InfoRequest.new,
- :incoming_email => 'request-333-xxx@example.com')
+ incoming_email: 'request-333-xxx@example.com')
raw_email = <<-EOF.strip_heredoc
To: Requester
From: Bad person
@@ -55,8 +55,8 @@
it 'does nothing and returns true if the info_request is external' do
info_request = object_double(InfoRequest.new,
- :is_external? => true,
- :incoming_email => 'request-333-xxx@example.com')
+ is_external?: true,
+ incoming_email: 'request-333-xxx@example.com')
raw_email = <<-EOF.strip_heredoc
From: sender@example.com
To: Requester
diff --git a/spec/models/info_request/state_spec.rb b/spec/models/info_request/state_spec.rb
index b1d990fd08..8e330c0556 100644
--- a/spec/models/info_request/state_spec.rb
+++ b/spec/models/info_request/state_spec.rb
@@ -86,13 +86,13 @@
it 'returns hyphenised versions of the phases' do
expect(InfoRequest::State.phase_params)
- .to eq({ :awaiting_response => "awaiting-response",
- :overdue => "overdue",
- :very_overdue => "very-overdue",
- :response_received => "response-received",
- :clarification_needed => "clarification-needed",
- :complete => "complete",
- :other => "other" })
+ .to eq({ awaiting_response: "awaiting-response",
+ overdue: "overdue",
+ very_overdue: "very-overdue",
+ response_received: "response-received",
+ clarification_needed: "clarification-needed",
+ complete: "complete",
+ other: "other" })
end
end
diff --git a/spec/models/info_request_batch_spec.rb b/spec/models/info_request_batch_spec.rb
index 3cc96db7cb..40bf919b73 100644
--- a/spec/models/info_request_batch_spec.rb
+++ b/spec/models/info_request_batch_spec.rb
@@ -92,9 +92,9 @@
let(:first_body) { FactoryBot.create(:public_body) }
let(:second_body) { FactoryBot.create(:public_body) }
let(:info_request_batch) do
- FactoryBot.create(:info_request_batch, :title => 'Matched title',
- :body => 'Matched body',
- :public_bodies => [first_body,
+ FactoryBot.create(:info_request_batch, title: 'Matched title',
+ body: 'Matched body',
+ public_bodies: [first_body,
second_body])
end
@@ -215,8 +215,8 @@
let(:info_request_batch) do
FactoryBot.create(
:info_request_batch,
- :body => "Dear [Authority name],\nA message\nYours faithfully,\nRequester",
- :public_bodies => [first_public_body, second_public_body])
+ body: "Dear [Authority name],\nA message\nYours faithfully,\nRequester",
+ public_bodies: [first_public_body, second_public_body])
end
it 'should substitute authority name for the placeholder in each request' do
@@ -251,10 +251,10 @@
it "it imposes an alphabetical sort order on associated public bodies" do
third_public_body = FactoryBot.create(:public_body,
- :name => "Another Body")
+ name: "Another Body")
batch = FactoryBot.create(
:info_request_batch,
- :public_bodies => [first_public_body,
+ public_bodies: [first_public_body,
third_public_body])
batch.reload
expect(batch.public_bodies).to eq ([third_public_body,
@@ -305,8 +305,8 @@
let!(:sent_batch) do
FactoryBot.create(
:info_request_batch,
- :public_bodies => [first_public_body, second_public_body],
- :sent_at => Time.zone.now)
+ public_bodies: [first_public_body, second_public_body],
+ sent_at: Time.zone.now)
end
it 'should send requests and notifications for only unsent batch requests' do
@@ -362,7 +362,7 @@
let(:draft) do
FactoryBot.create(
:draft_info_request_batch,
- :public_bodies => [first_public_body, second_public_body])
+ public_bodies: [first_public_body, second_public_body])
end
it "copies across all of the attributes from the draft" do
@@ -401,8 +401,8 @@
let(:info_request_batch) do
FactoryBot.create(
:info_request_batch,
- :public_bodies => [first_public_body, second_public_body],
- :embargo_duration => "3_months")
+ public_bodies: [first_public_body, second_public_body],
+ embargo_duration: "3_months")
end
let(:example) { info_request_batch.example_request }
@@ -437,7 +437,7 @@
let(:info_request_batch) do
FactoryBot.create(
:info_request_batch,
- :public_bodies => [first_public_body, second_public_body])
+ public_bodies: [first_public_body, second_public_body])
end
let(:example) { info_request_batch.example_request }
@@ -493,7 +493,7 @@
let(:info_request_batch) do
FactoryBot.create(
:info_request_batch,
- :public_bodies => [first_public_body, second_public_body])
+ public_bodies: [first_public_body, second_public_body])
end
before do
@@ -549,7 +549,7 @@
describe "#request_phases" do
let(:public_bodies) { FactoryBot.create_list(:public_body, 3) }
let(:info_request_batch) do
- FactoryBot.create(:info_request_batch, :public_bodies => public_bodies)
+ FactoryBot.create(:info_request_batch, public_bodies: public_bodies)
end
before do
@@ -571,7 +571,7 @@
describe "#request_phases_summary" do
let(:public_bodies) { FactoryBot.create_list(:public_body, 10) }
let(:info_request_batch) do
- FactoryBot.create(:info_request_batch, :public_bodies => public_bodies)
+ FactoryBot.create(:info_request_batch, public_bodies: public_bodies)
end
before do
@@ -592,21 +592,21 @@
it "returns summarised counts of each request phase grouping" do
expected = {
- :in_progress => {
- :label => _('In progress'),
- :count => 4
+ in_progress: {
+ label: _('In progress'),
+ count: 4
},
- :action_needed => {
- :label => _('Action needed'),
- :count => 3
+ action_needed: {
+ label: _('Action needed'),
+ count: 3
},
- :complete => {
- :label => _('Complete'),
- :count => 2
+ complete: {
+ label: _('Complete'),
+ count: 2
},
- :other => {
- :label => _('Other'),
- :count => 1
+ other: {
+ label: _('Other'),
+ count: 1
}
}
expect(info_request_batch.request_phases_summary).to eq expected
@@ -729,7 +729,7 @@
describe "#log_event" do
let(:public_bodies) { FactoryBot.create_list(:public_body, 3) }
let(:info_request_batch) do
- FactoryBot.create(:info_request_batch, :public_bodies => public_bodies)
+ FactoryBot.create(:info_request_batch, public_bodies: public_bodies)
end
before do
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index 4894db65bb..64c4a03ab5 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -22,13 +22,13 @@
RSpec.describe InfoRequestEvent do
describe "when checking for a valid state" do
it 'should add an error message for described_state if it is not valid' do
- ire = InfoRequestEvent.new(:described_state => 'nope')
+ ire = InfoRequestEvent.new(described_state: 'nope')
ire.valid?
expect(ire.errors.messages[:described_state]).to eq ["is not a valid state"]
end
it 'should not add an error message for described_state if it is valid' do
- ire = InfoRequestEvent.new(:described_state => 'waiting_response')
+ ire = InfoRequestEvent.new(described_state: 'waiting_response')
ire.valid?
expect(ire.errors.messages[:described_state]).to be_blank
end
@@ -38,16 +38,16 @@
let(:ire) { InfoRequestEvent.new }
it "should convert event parameters into YAML and back successfully" do
- example_params = { :foo => 'this is stuff', :bar => 83, :humbug => "yikes!!!" }
+ example_params = { foo: 'this is stuff', bar: 83, humbug: "yikes!!!" }
ire.params = example_params
expect(ire.params).to eq(example_params)
end
it "should store the incoming_message, outgoing_messsage and comment ids" do
comment = FactoryBot.create(:comment)
- example_params = {:incoming_message_id => 1,
- :outgoing_message_id => 2,
- :comment_id => comment.id}
+ example_params = {incoming_message_id: 1,
+ outgoing_message_id: 2,
+ comment_id: comment.id}
ire.params = example_params
expect(ire.incoming_message_id).to eq(1)
expect(ire.outgoing_message_id).to eq(2)
@@ -88,41 +88,41 @@
it 'returns a falsey value for a comment that is not visible' do
comment = FactoryBot.create(:hidden_comment)
- comment_event = FactoryBot.build(:comment_event, :comment => comment)
+ comment_event = FactoryBot.build(:comment_event, comment: comment)
expect(comment_event.indexed_by_search?).to be_falsey
end
it 'returns a truthy value for a comment that is visible' do
comment = FactoryBot.create(:comment)
- comment_event = FactoryBot.build(:comment_event, :comment => comment)
+ comment_event = FactoryBot.build(:comment_event, comment: comment)
expect(comment_event.indexed_by_search?).to be_truthy
end
it 'returns a falsey value for an incoming message that is not indexed by search' do
incoming_message = FactoryBot.create(:incoming_message, :hidden)
response_event = FactoryBot.build(:response_event,
- :incoming_message => incoming_message)
+ incoming_message: incoming_message)
expect(response_event.indexed_by_search?).to be_falsey
end
it 'returns a truthy value for an incoming message that is indexed by search' do
incoming_message = FactoryBot.create(:incoming_message)
response_event = FactoryBot.build(:response_event,
- :incoming_message => incoming_message)
+ incoming_message: incoming_message)
expect(response_event.indexed_by_search?).to be_truthy
end
it 'returns a falsey value for an outgoing message that is not indexed by search' do
outgoing_message = FactoryBot.create(:hidden_followup)
followup_event = FactoryBot.build(:followup_sent_event,
- :outgoing_message => outgoing_message)
+ outgoing_message: outgoing_message)
expect(followup_event.indexed_by_search?).to be_falsey
end
it 'returns a truthy value for an outgoing message that is indexed by search' do
outgoing_message = FactoryBot.create(:new_information_followup)
followup_event = FactoryBot.build(:followup_sent_event,
- :outgoing_message => outgoing_message)
+ outgoing_message: outgoing_message)
expect(followup_event.indexed_by_search?).to be_truthy
end
@@ -191,10 +191,10 @@
context 'if it is a comment event' do
it "should return the commenter's url_name" do
user = FactoryBot.create(:user)
- comment = FactoryBot.create(:comment, :user => user)
+ comment = FactoryBot.create(:comment, user: user)
ire = FactoryBot.create(:info_request_event,
- :event_type => 'comment',
- :comment => comment)
+ event_type: 'comment',
+ comment: comment)
expect(ire.commented_by).to eq(user.url_name)
end
end
@@ -219,8 +219,8 @@
ire = FactoryBot.create(:info_request_event)
request = ire.info_request
new_event = FactoryBot.create(:info_request_event,
- :event_type => 'comment',
- :info_request => request)
+ event_type: 'comment',
+ info_request: request)
request.reload
expect(ire.latest_variety).to eq('comment')
end
@@ -231,8 +231,8 @@
ire = FactoryBot.create(:info_request_event)
request = ire.info_request
new_event = FactoryBot.create(:info_request_event,
- :event_type => 'comment',
- :info_request => request)
+ event_type: 'comment',
+ info_request: request)
new_event.set_calculated_state!('internal_review')
request.reload
expect(ire.latest_status).to eq('internal_review')
@@ -242,10 +242,10 @@
describe '#title' do
context 'a sent event' do
it 'should return the related info_request title' do
- info_request = FactoryBot.create(:info_request, :title => "Hi!")
+ info_request = FactoryBot.create(:info_request, title: "Hi!")
ire = FactoryBot.create(:info_request_event,
- :info_request => info_request,
- :event_type => 'sent')
+ info_request: info_request,
+ event_type: 'sent')
expect(ire.title).to eq("Hi!")
end
@@ -277,7 +277,7 @@
it 'should return a space separated list of the attachment file types' do
info_request = ire.info_request
incoming = FactoryBot.create(:incoming_message_with_attachments,
- :info_request => info_request)
+ info_request: info_request)
ire.incoming_message = incoming
expect(ire.filetype).to eq('pdf')
end
@@ -285,7 +285,7 @@
context 'not a response event' do
it 'should return a blank string' do
- ire = FactoryBot.create(:info_request_event, :event_type => 'comment')
+ ire = FactoryBot.create(:info_request_event, event_type: 'comment')
expect(ire.filetype).to eq('')
end
end
@@ -294,10 +294,10 @@
describe '#visible' do
context 'is a comment' do
it 'should return the visibility of the comment' do
- comment = FactoryBot.create(:comment, :visible => false)
+ comment = FactoryBot.create(:comment, visible: false)
ire = FactoryBot.create(:info_request_event,
- :event_type => 'comment',
- :comment => comment)
+ event_type: 'comment',
+ comment: comment)
expect(ire.visible).to eq(false)
end
end
@@ -314,7 +314,7 @@
let(:ire) { InfoRequestEvent.new }
it "should return old, new and other params" do
- ire.params = {:old_foo => 'this is stuff', :foo => 'stuff', :bar => 84}
+ ire.params = {old_foo: 'this is stuff', foo: 'stuff', bar: 84}
expected_hash = {
new: { foo: 'stuff' },
old: { foo: 'this is stuff' },
@@ -324,14 +324,14 @@
end
it 'should drop matching old and new values' do
- ire.params = {:old_foo => 'stuff', :foo => 'stuff', :bar => 84}
+ ire.params = {old_foo: 'stuff', foo: 'stuff', bar: 84}
expected_hash = { new: {}, old: {}, other: { bar: 84 } }
expect(ire.params_diff).to eq(expected_hash)
end
it 'returns a url_name if passed a User' do
user = FactoryBot.create(:user)
- ire.params = {:old_foo => "", :foo => user}
+ ire.params = {old_foo: "", foo: user}
expected_hash = {
new: { foo: { gid: user.to_global_id.to_s } },
old: { foo: '' },
@@ -345,9 +345,9 @@
let(:request) { FactoryBot.create(:info_request) }
it 'should mark the model for reindexing in xapian if there is no no_xapian_reindex flag on the object' do
- event = InfoRequestEvent.new(:info_request => request,
- :event_type => 'sent',
- :params => {})
+ event = InfoRequestEvent.new(info_request: request,
+ event_type: 'sent',
+ params: {})
expect(event).to receive(:xapian_mark_needs_index)
event.run_callbacks(:save)
end
@@ -357,9 +357,9 @@
it "updates the parent info_request's last_public_response_at value" do
im = FactoryBot.create(:incoming_message)
response_event = FactoryBot.
- create(:info_request_event, :event_type => 'response',
- :info_request => request,
- :incoming_message => im)
+ create(:info_request_event, event_type: 'response',
+ info_request: request,
+ incoming_message: im)
expect(request.last_public_response_at).to be_within(1.second).
of response_event.created_at
end
@@ -370,8 +370,8 @@
it "does not update the info_request's last_public_response_at value" do
expect_any_instance_of(InfoRequestEvent).not_to receive(:update_request)
- event = FactoryBot.create(:info_request_event, :event_type => 'comment',
- :info_request => request)
+ event = FactoryBot.create(:info_request_event, event_type: 'comment',
+ info_request: request)
expect(request.last_public_response_at).to be_nil
end
@@ -380,11 +380,11 @@
context "the incoming_message is hidden" do
it "sets the parent info_request's last_public_response_at to nil" do
- im = FactoryBot.create(:incoming_message, :prominence => 'hidden')
+ im = FactoryBot.create(:incoming_message, prominence: 'hidden')
response_event = FactoryBot.
- create(:info_request_event, :event_type => 'response',
- :info_request => request,
- :incoming_message => im)
+ create(:info_request_event, event_type: 'response',
+ info_request: request,
+ incoming_message: im)
expect(request.last_public_response_at).to be_nil
end
@@ -401,14 +401,14 @@
describe "should know" do
it "that it's an incoming message" do
- event = InfoRequestEvent.new(:incoming_message => mock_model(IncomingMessage))
+ event = InfoRequestEvent.new(incoming_message: mock_model(IncomingMessage))
expect(event.is_incoming_message?).to be_truthy
expect(event.is_outgoing_message?).to be_falsey
expect(event.is_comment?).to be_falsey
end
it "that it's an outgoing message" do
- event = InfoRequestEvent.new(:outgoing_message => mock_model(OutgoingMessage))
+ event = InfoRequestEvent.new(outgoing_message: mock_model(OutgoingMessage))
event.id = 1
expect(event.is_incoming_message?).to be_falsey
expect(event.is_outgoing_message?).to be_truthy
@@ -416,7 +416,7 @@
end
it "that it's a comment" do
- event = InfoRequestEvent.new(:comment => mock_model(Comment))
+ event = InfoRequestEvent.new(comment: mock_model(Comment))
event.id = 1
expect(event.is_incoming_message?).to be_falsey
expect(event.is_outgoing_message?).to be_falsey
@@ -460,32 +460,32 @@
end
it 'should return false if one email address exists and the other does not' do
- allow(info_request_event).to receive(:params).and_return(:email => 'test@example.com')
+ allow(info_request_event).to receive(:params).and_return(email: 'test@example.com')
allow(info_request_event).to receive_message_chain(:info_request, :get_previous_email_sent_to).and_return(nil)
expect(info_request_event.same_email_as_previous_send?).to be false
end
it 'should return true if the addresses are identical' do
- allow(info_request_event).to receive(:params).and_return(:email => 'test@example.com')
+ allow(info_request_event).to receive(:params).and_return(email: 'test@example.com')
allow(info_request_event).to receive_message_chain(:info_request, :get_previous_email_sent_to).and_return('test@example.com')
expect(info_request_event.same_email_as_previous_send?).to be true
end
it 'should return false if the addresses are different' do
- allow(info_request_event).to receive(:params).and_return(:email => 'test@example.com')
+ allow(info_request_event).to receive(:params).and_return(email: 'test@example.com')
allow(info_request_event).to receive_message_chain(:info_request, :get_previous_email_sent_to).and_return('different@example.com')
expect(info_request_event.same_email_as_previous_send?).to be false
end
it 'should return true if the addresses have different formats' do
- allow(info_request_event).to receive(:params).and_return(:email => 'A Test ')
+ allow(info_request_event).to receive(:params).and_return(email: 'A Test ')
allow(info_request_event).to receive_message_chain(:info_request, :get_previous_email_sent_to).and_return('test@example.com')
expect(info_request_event.same_email_as_previous_send?).to be true
end
it 'should handle non-ascii characters in the name input' do
address = "\"Someone’s name\" "
- allow(info_request_event).to receive(:params).and_return(:email => address)
+ allow(info_request_event).to receive(:params).and_return(email: address)
allow(info_request_event).to receive_message_chain(:info_request, :get_previous_email_sent_to).and_return(address)
expect(info_request_event.same_email_as_previous_send?).to be true
end
@@ -521,35 +521,35 @@
describe '#destroy' do
let (:info_request) { FactoryBot.create(:info_request) }
- let (:event) { InfoRequestEvent.create(:info_request => info_request,
- :event_type => 'sent',
- :params => {})
+ let (:event) { InfoRequestEvent.create(info_request: info_request,
+ event_type: 'sent',
+ params: {})
}
it 'should destroy the info_request_event' do
event.destroy
- expect(InfoRequestEvent.where(:id => event.id)).to be_empty
+ expect(InfoRequestEvent.where(id: event.id)).to be_empty
end
it 'should destroy associated user_info_request_sent_alerts' do
user = FactoryBot.create(:user)
- UserInfoRequestSentAlert.create(:info_request_event_id => event.id,
- :alert_type => 'overdue_1',
- :user => user,
- :info_request => info_request)
+ UserInfoRequestSentAlert.create(info_request_event_id: event.id,
+ alert_type: 'overdue_1',
+ user: user,
+ info_request: info_request)
event.destroy
- expect(UserInfoRequestSentAlert.where(:info_request_event_id => event.id)).
+ expect(UserInfoRequestSentAlert.where(info_request_event_id: event.id)).
to be_empty
end
it 'should destroy associated track_things_sent_emails' do
track_thing = FactoryBot.create(:search_track,
- :info_request => info_request)
- TrackThingsSentEmail.create(:track_thing => track_thing,
- :info_request_event => event)
+ info_request: info_request)
+ TrackThingsSentEmail.create(track_thing: track_thing,
+ info_request_event: event)
event.reload
event.destroy
- expect(TrackThingsSentEmail.where(:info_request_event_id => event.id)).
+ expect(TrackThingsSentEmail.where(info_request_event_id: event.id)).
to be_empty
end
@@ -557,49 +557,49 @@
describe "editing requests" do
let(:unchanged_params) do
- { :editor => "henare",
- :old_title => "How much wood does a woodpecker peck?",
- :title => "How much wood does a woodpecker peck?",
- :old_described_state => "rejected",
- :described_state => "rejected",
- :old_awaiting_description => false,
- :awaiting_description => false,
- :old_allow_new_responses_from => "anybody",
- :allow_new_responses_from => "anybody",
- :old_handle_rejected_responses => "bounce",
- :handle_rejected_responses => "bounce",
- :old_tag_string => "",
- :tag_string => "",
- :old_comments_allowed => true,
- :comments_allowed => true }
+ { editor: "henare",
+ old_title: "How much wood does a woodpecker peck?",
+ title: "How much wood does a woodpecker peck?",
+ old_described_state: "rejected",
+ described_state: "rejected",
+ old_awaiting_description: false,
+ awaiting_description: false,
+ old_allow_new_responses_from: "anybody",
+ allow_new_responses_from: "anybody",
+ old_handle_rejected_responses: "bounce",
+ handle_rejected_responses: "bounce",
+ old_tag_string: "",
+ tag_string: "",
+ old_comments_allowed: true,
+ comments_allowed: true }
end
it "should change type to hidden when only editing prominence to hidden" do
- params = unchanged_params.merge({:old_prominence => "normal", :prominence => "hidden"})
+ params = unchanged_params.merge({old_prominence: "normal", prominence: "hidden"})
- ire = InfoRequestEvent.create!(:info_request => FactoryBot.create(:info_request),
- :event_type => "edit",
- :params => params)
+ ire = InfoRequestEvent.create!(info_request: FactoryBot.create(:info_request),
+ event_type: "edit",
+ params: params)
expect(ire.event_type).to eql "hide"
end
it "should change type to hidden when only editing prominence to requester_only" do
- params = unchanged_params.merge({:old_prominence => "normal", :prominence => "requester_only"})
+ params = unchanged_params.merge({old_prominence: "normal", prominence: "requester_only"})
- ire = InfoRequestEvent.create!(:info_request => FactoryBot.create(:info_request),
- :event_type => "edit",
- :params => params)
+ ire = InfoRequestEvent.create!(info_request: FactoryBot.create(:info_request),
+ event_type: "edit",
+ params: params)
expect(ire.event_type).to eql "hide"
end
it "should change type to hidden when only editing prominence to backpage" do
- params = unchanged_params.merge({:old_prominence => "normal", :prominence => "backpage"})
+ params = unchanged_params.merge({old_prominence: "normal", prominence: "backpage"})
- ire = InfoRequestEvent.create!(:info_request => FactoryBot.create(:info_request),
- :event_type => "edit",
- :params => params)
+ ire = InfoRequestEvent.create!(info_request: FactoryBot.create(:info_request),
+ event_type: "edit",
+ params: params)
expect(ire.event_type).to eql "hide"
end
@@ -607,101 +607,101 @@
describe "#only_editing_prominence_to_hide?" do
let(:unchanged_params) do
- { :editor => "henare",
- :old_title => "How much wood does a woodpecker peck?",
- :title => "How much wood does a woodpecker peck?",
- :old_described_state => "rejected",
- :described_state => "rejected",
- :old_awaiting_description => false,
- :awaiting_description => false,
- :old_allow_new_responses_from => "anybody",
- :allow_new_responses_from => "anybody",
- :old_handle_rejected_responses => "bounce",
- :handle_rejected_responses => "bounce",
- :old_tag_string => "",
- :tag_string => "",
- :old_comments_allowed => true,
- :comments_allowed => true }
+ { editor: "henare",
+ old_title: "How much wood does a woodpecker peck?",
+ title: "How much wood does a woodpecker peck?",
+ old_described_state: "rejected",
+ described_state: "rejected",
+ old_awaiting_description: false,
+ awaiting_description: false,
+ old_allow_new_responses_from: "anybody",
+ allow_new_responses_from: "anybody",
+ old_handle_rejected_responses: "bounce",
+ handle_rejected_responses: "bounce",
+ old_tag_string: "",
+ tag_string: "",
+ old_comments_allowed: true,
+ comments_allowed: true }
end
it "should be false if it's not an edit" do
- ire = InfoRequestEvent.new(:event_type => "resent")
+ ire = InfoRequestEvent.new(event_type: "resent")
expect(ire.only_editing_prominence_to_hide?).to be false
end
it "should be false if it's already a hide event" do
- ire = InfoRequestEvent.new(:event_type => "hide")
+ ire = InfoRequestEvent.new(event_type: "hide")
expect(ire.only_editing_prominence_to_hide?).to be false
end
it "should be false if editing multiple conditions" do
- params = unchanged_params.merge({ :old_prominence => "normal",
- :prominence => "backpage",
- :old_comments_allowed => true,
- :comments_allowed => false })
+ params = unchanged_params.merge({ old_prominence: "normal",
+ prominence: "backpage",
+ old_comments_allowed: true,
+ comments_allowed: false })
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be false
end
context "when only editing prominence to hidden" do
- let(:params) { unchanged_params.merge({:old_prominence => "normal", :prominence => "hidden"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "hidden"}) }
it do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be true
end
end
context "when only editing prominence to requester_only" do
- let(:params) { unchanged_params.merge({:old_prominence => "normal", :prominence => "requester_only"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "requester_only"}) }
it "should be true if only editing prominence to requester_only" do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be true
end
end
context "when only editing prominence to backpage" do
- let(:params) { unchanged_params.merge({:old_prominence => "normal", :prominence => "backpage"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "backpage"}) }
it "should be true if only editing prominence to backpage" do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be true
end
end
context "when the old prominence was hidden" do
- let(:params) { unchanged_params.merge({:old_prominence => "hidden", :prominence => "requester_only"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "hidden", prominence: "requester_only"}) }
it do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be false
end
end
context "when the old prominence was requester_only" do
- let(:params) { unchanged_params.merge({:old_prominence => "requester_only", :prominence => "hidden"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "requester_only", prominence: "hidden"}) }
it do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be false
end
end
context "when the old prominence was backpage" do
- let(:params) { unchanged_params.merge({:old_prominence => "backpage", :prominence => "hidden"}) }
+ let(:params) { unchanged_params.merge({old_prominence: "backpage", prominence: "hidden"}) }
it do
- ire = InfoRequestEvent.new(:event_type => "edit", :params => params)
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
expect(ire.only_editing_prominence_to_hide?).to be false
end
@@ -831,7 +831,7 @@
context 'if there is a subsequent followup' do
let!(:followup) do
FactoryBot.create(:followup_sent_event,
- :info_request => response_event.info_request)
+ info_request: response_event.info_request)
end
it 'resets the due dates on the request' do
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index fccec20439..415e28fa5c 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -160,31 +160,31 @@
describe 'creating a new request' do
it "sets the url_title from the supplied title" do
- info_request = FactoryBot.create(:info_request, :title => "Test title")
+ info_request = FactoryBot.create(:info_request, title: "Test title")
expect(info_request.url_title).to eq("test_title")
end
it "ignores any supplied url_title and sets it from the title instead" do
- info_request = FactoryBot.create(:info_request, :title => "Real title",
- :url_title => "ignore_me")
+ info_request = FactoryBot.create(:info_request, title: "Real title",
+ url_title: "ignore_me")
expect(info_request.url_title).to eq("real_title")
end
it "adds the next sequential number to the url_title to make it unique" do
- 2.times { FactoryBot.create(:info_request, :title => 'Test title') }
- info_request = InfoRequest.new(:title => "Test title")
+ 2.times { FactoryBot.create(:info_request, title: 'Test title') }
+ info_request = InfoRequest.new(title: "Test title")
expect(info_request.url_title).to eq("test_title_3")
end
it "strips line breaks from the title" do
info_request = FactoryBot.create(:info_request,
- :title => "Title\rwith\nline\r\nbreaks")
+ title: "Title\rwith\nline\r\nbreaks")
expect(info_request.title).to eq("Title with line breaks")
end
it "strips extra spaces from the title" do
info_request = FactoryBot.create(:info_request,
- :title => "Title\rwith\nline\r\n breaks")
+ title: "Title\rwith\nline\r\n breaks")
expect(info_request.title).to eq("Title with line breaks")
end
@@ -195,10 +195,10 @@
it "picks the next available url_title instead of failing" do
public_body = FactoryBot.create(:public_body)
user = FactoryBot.create(:user)
- first_request = InfoRequest.new(:title => "Test title",
- :user => user,
- :public_body => public_body)
- second_request = FactoryBot.create(:info_request, :title => "Test title")
+ first_request = InfoRequest.new(title: "Test title",
+ user: user,
+ public_body: public_body)
+ second_request = FactoryBot.create(:info_request, title: "Test title")
first_request.save!
expect(first_request.url_title).to eq("test_title_2")
end
@@ -307,7 +307,7 @@
context 'when the holding pen exists' do
it 'finds a request with title "Holding pen"' do
- holding_pen = FactoryBot.create(:info_request, :title => 'Holding pen')
+ holding_pen = FactoryBot.create(:info_request, title: 'Holding pen')
expect(InfoRequest.holding_pen_request).to eq(holding_pen)
end
@@ -316,7 +316,7 @@
context 'when no holding pen exists' do
before do
- InfoRequest.where(:title => 'Holding pen').destroy_all
+ InfoRequest.where(title: 'Holding pen').destroy_all
@holding_pen = InfoRequest.holding_pen_request
end
@@ -353,16 +353,16 @@
before do
@request = FactoryBot.create(:info_request)
- @request.update(:updated_at => 6.months.ago,
- :rejected_incoming_count => 3,
- :allow_new_responses_from => 'nobody')
- @options = {:rejection_threshold => 2,
- :age_in_months => 5,
- :dryrun => true}
+ @request.update(updated_at: 6.months.ago,
+ rejected_incoming_count: 3,
+ allow_new_responses_from: 'nobody')
+ @options = {rejection_threshold: 2,
+ age_in_months: 5,
+ dryrun: true}
end
it 'returns an count of requests updated ' do
- expect(InfoRequest.reject_incoming_at_mta(@options.merge(:dryrun => false))).
+ expect(InfoRequest.reject_incoming_at_mta(@options.merge(dryrun: false))).
to eq(1)
end
@@ -372,14 +372,14 @@
end
it 'sets reject_incoming_at_mta on a request meeting the criteria passed' do
- InfoRequest.reject_incoming_at_mta(@options.merge(:dryrun => false))
+ InfoRequest.reject_incoming_at_mta(@options.merge(dryrun: false))
expect(InfoRequest.find(@request.id).reject_incoming_at_mta).to be true
end
it 'does not set reject_incoming_at_mta on a request not meeting the
criteria passed' do
- InfoRequest.reject_incoming_at_mta(@options.merge(:dryrun => false,
- :age_in_months => 7))
+ InfoRequest.reject_incoming_at_mta(@options.merge(dryrun: false,
+ age_in_months: 7))
expect(InfoRequest.find(@request.id).reject_incoming_at_mta).to be false
end
@@ -507,7 +507,7 @@
it 'does not mark requests marked as withdrawn as awaiting description' do
info_request = FactoryBot.create(:info_request,
- :awaiting_description => false)
+ awaiting_description: false)
info_request.described_state = "user_withdrawn"
info_request.save!
email, raw_email = email_and_raw_email
@@ -531,7 +531,7 @@
info_request.
receive(email,
raw_email,
- :rejected_reason => 'rejected for testing')
+ rejected_reason: 'rejected for testing')
expect(info_request.info_request_events.last.params[:rejected_reason]).
to eq('rejected for testing')
end
@@ -610,7 +610,7 @@
it 'processes mail from the poller' do
with_feature_enabled(:accept_mail_from_anywhere) do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :poller)
+ info_request.receive(email, raw_email, source: :poller)
expect(info_request.incoming_messages.count).to eq(1)
expect(info_request.incoming_messages.last).to be_persisted
end
@@ -619,7 +619,7 @@
it 'processes mail from mailin' do
with_feature_enabled(:accept_mail_from_anywhere) do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :poller)
+ info_request.receive(email, raw_email, source: :poller)
expect(info_request.incoming_messages.count).to eq(1)
expect(info_request.incoming_messages.last).to be_persisted
end
@@ -643,14 +643,14 @@
it 'processes mail from the poller' do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :poller)
+ info_request.receive(email, raw_email, source: :poller)
expect(info_request.incoming_messages.count).to eq(1)
expect(info_request.incoming_messages.last).to be_persisted
end
it 'ignores mail from mailin' do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :mailin)
+ info_request.receive(email, raw_email, source: :mailin)
expect(info_request.incoming_messages.count).to eq(0)
end
@@ -661,13 +661,13 @@
it 'ignores mail from the poller' do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :poller)
+ info_request.receive(email, raw_email, source: :poller)
expect(info_request.incoming_messages.count).to eq(0)
end
it 'processes mail from mailin' do
email, raw_email = email_and_raw_email
- info_request.receive(email, raw_email, :source => :mailin)
+ info_request.receive(email, raw_email, source: :mailin)
expect(info_request.incoming_messages.count).to eq(1)
expect(info_request.incoming_messages.last).to be_persisted
end
@@ -681,8 +681,8 @@
it 'from nobody' do
travel_to(5.days.ago)
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
travel_back
@@ -704,8 +704,8 @@
end
it 'from anybody' do
- attrs = { :allow_new_responses_from => 'anybody',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'anybody',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
email, raw_email = email_and_raw_email
info_request.receive(email, raw_email)
@@ -713,10 +713,10 @@
end
it 'from authority_only receives if the mail is from the authority' do
- attrs = { :allow_new_responses_from => 'authority_only',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'authority_only',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request_with_incoming, attrs)
- email, raw_email = email_and_raw_email(:from => 'bob@example.com')
+ email, raw_email = email_and_raw_email(from: 'bob@example.com')
info_request.receive(email, raw_email)
expect(info_request.reload.incoming_messages.count).to eq(2)
end
@@ -724,14 +724,14 @@
it 'from authority_only rejects if there is no from address' do
travel_to(5.days.ago)
- attrs = { :allow_new_responses_from => 'authority_only',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'authority_only',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
travel_back
updated_at = info_request.updated_at
- email, raw_email = email_and_raw_email(:from => '')
+ email, raw_email = email_and_raw_email(from: '')
info_request.receive(email, raw_email)
expect(info_request.reload.incoming_messages.count).to eq(0)
holding_pen = InfoRequest.holding_pen_request
@@ -748,14 +748,14 @@
it 'from authority_only rejects if the mail is not from the authority' do
travel_to(5.days.ago)
- attrs = { :allow_new_responses_from => 'authority_only',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'authority_only',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
travel_back
updated_at = info_request.updated_at
- email, raw_email = email_and_raw_email(:from => 'spam@example.net')
+ email, raw_email = email_and_raw_email(from: 'spam@example.net')
info_request.receive(email, raw_email)
expect(info_request.reload.incoming_messages.count).to eq(0)
holding_pen = InfoRequest.holding_pen_request
@@ -779,21 +779,21 @@
end
it 'can override the stop new responses status of a request' do
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
email, raw_email = email_and_raw_email
info_request.receive(email,
raw_email,
- :override_stop_new_responses => true)
+ override_stop_new_responses: true)
expect(info_request.incoming_messages.count).to eq(1)
end
it 'does not check spam when overriding the stop new responses status of a request' do
mocked_default_config = {
- :spam_action => 'holding_pen',
- :spam_header => 'X-Spam-Score',
- :spam_threshold => 100
+ spam_action: 'holding_pen',
+ spam_header: 'X-Spam-Score',
+ spam_threshold: 100
}
const = 'InfoRequest::' \
@@ -810,13 +810,13 @@
Plz buy my spam
EOF
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
- email, raw_email = email_and_raw_email(:raw_email => spam_email)
+ email, raw_email = email_and_raw_email(raw_email: spam_email)
info_request.receive(email,
raw_email,
- :override_stop_new_responses => true)
+ override_stop_new_responses: true)
expect(info_request.incoming_messages.count).to eq(1)
end
@@ -825,10 +825,10 @@
context 'handling rejected responses' do
it 'bounces rejected responses if the mail has a from address' do
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'bounce' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'bounce' }
info_request = FactoryBot.create(:info_request, attrs)
- email, raw_email = email_and_raw_email(:from => 'bounce@example.com')
+ email, raw_email = email_and_raw_email(from: 'bounce@example.com')
info_request.receive(email, raw_email)
bounce = ActionMailer::Base.deliveries.first
expect(bounce.to).to include('bounce@example.com')
@@ -837,25 +837,25 @@
it 'does not bounce responses to external requests' do
info_request = FactoryBot.create(:external_request)
- email, raw_email = email_and_raw_email(:from => 'bounce@example.com')
+ email, raw_email = email_and_raw_email(from: 'bounce@example.com')
info_request.receive(email, raw_email)
expect(ActionMailer::Base.deliveries).to be_empty
ActionMailer::Base.deliveries.clear
end
it 'discards rejected responses if the mail has no from address' do
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'bounce' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'bounce' }
info_request = FactoryBot.create(:info_request, attrs)
- email, raw_email = email_and_raw_email(:from => '')
+ email, raw_email = email_and_raw_email(from: '')
info_request.receive(email, raw_email)
expect(ActionMailer::Base.deliveries).to be_empty
ActionMailer::Base.deliveries.clear
end
it 'sends rejected responses to the holding pen' do
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'holding_pen' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'holding_pen' }
info_request = FactoryBot.create(:info_request, attrs)
email, raw_email = email_and_raw_email
info_request.receive(email, raw_email)
@@ -867,8 +867,8 @@
end
it 'discards rejected responses' do
- attrs = { :allow_new_responses_from => 'nobody',
- :handle_rejected_responses => 'blackhole' }
+ attrs = { allow_new_responses_from: 'nobody',
+ handle_rejected_responses: 'blackhole' }
info_request = FactoryBot.create(:info_request, attrs)
email, raw_email = email_and_raw_email
info_request.receive(email, raw_email)
@@ -878,7 +878,7 @@
end
it 'raises an error if there is an unknown handle_rejected_responses' do
- attrs = { :allow_new_responses_from => 'nobody' }
+ attrs = { allow_new_responses_from: 'nobody' }
info_request = FactoryBot.create(:info_request, attrs)
info_request.update_attribute(:handle_rejected_responses, 'unknown_value')
email, raw_email = email_and_raw_email
@@ -891,8 +891,8 @@
it "uses instance-specific spam handling first" do
info_request = FactoryBot.create(:info_request)
- info_request.update!(:handle_rejected_responses => 'bounce',
- :allow_new_responses_from => 'nobody')
+ info_request.update!(handle_rejected_responses: 'bounce',
+ allow_new_responses_from: 'nobody')
allow(AlaveteliConfiguration).
to receive(:incoming_email_spam_action).and_return('holding_pen')
allow(AlaveteliConfiguration).
@@ -917,9 +917,9 @@
info_request = FactoryBot.create(:info_request)
mocked_default_config = {
- :spam_action => 'holding_pen',
- :spam_header => 'X-Spam-Score',
- :spam_threshold => 100
+ spam_action: 'holding_pen',
+ spam_header: 'X-Spam-Score',
+ spam_threshold: 100
}
const = 'InfoRequest::' \
@@ -946,9 +946,9 @@
info_request = FactoryBot.create(:info_request)
mocked_default_config = {
- :spam_action => 'discard',
- :spam_header => 'X-Spam-Score',
- :spam_threshold => 10
+ spam_action: 'discard',
+ spam_header: 'X-Spam-Score',
+ spam_threshold: 10
}
const = 'InfoRequest::' \
@@ -1022,14 +1022,14 @@
end
describe "#url_title" do
- let(:request) { FactoryBot.create(:info_request, :title => "Test 101") }
+ let(:request) { FactoryBot.create(:info_request, title: "Test 101") }
it "returns the url_title" do
expect(request.url_title).to eq('test_101')
end
it "collapses the url title if requested" do
- expect(request.url_title(:collapse => true)).to eq("test")
+ expect(request.url_title(collapse: true)).to eq("test")
end
end
@@ -1053,7 +1053,7 @@
request = FactoryBot.create(:info_request)
new_body = FactoryBot.create(:public_body)
editor = FactoryBot.create(:user)
- request.move_to_public_body(new_body, :editor => editor)
+ request.move_to_public_body(new_body, editor: editor)
request.reload
expect(request.public_body).to eq(new_body)
end
@@ -1063,7 +1063,7 @@
old_body = request.public_body
new_body = FactoryBot.create(:public_body)
editor = FactoryBot.create(:user)
- request.move_to_public_body(new_body, :editor => editor)
+ request.move_to_public_body(new_body, editor: editor)
request.reload
event = request.info_request_events.last
@@ -1089,14 +1089,14 @@
request = FactoryBot.create(:info_request)
new_body = FactoryBot.create(:public_body)
editor = FactoryBot.create(:user)
- expect(request.move_to_public_body(new_body, :editor => editor)).to eq(new_body)
+ expect(request.move_to_public_body(new_body, editor: editor)).to eq(new_body)
end
it 'retains the existing body if the new body does not exist' do
request = FactoryBot.create(:info_request)
editor = FactoryBot.create(:user)
existing_body = request.public_body
- request.move_to_public_body(nil, :editor => editor)
+ request.move_to_public_body(nil, editor: editor)
request.reload
expect(request.public_body).to eq(existing_body)
end
@@ -1106,7 +1106,7 @@
new_body = FactoryBot.build(:public_body)
editor = FactoryBot.create(:user)
existing_body = request.public_body
- request.move_to_public_body(new_body, :editor => editor)
+ request.move_to_public_body(new_body, editor: editor)
request.reload
expect(request.public_body).to eq(existing_body)
end
@@ -1114,7 +1114,7 @@
it 'returns nil if the body cannot be updated' do
request = FactoryBot.create(:info_request)
editor = FactoryBot.create(:user)
- expect(request.move_to_public_body(nil, :editor => editor)).to eq(nil)
+ expect(request.move_to_public_body(nil, editor: editor)).to eq(nil)
end
it 'reindexes the info request' do
@@ -1122,14 +1122,14 @@
new_body = FactoryBot.create(:public_body)
editor = FactoryBot.create(:user)
reindex_job = ActsAsXapian::ActsAsXapianJob.
- where(:model => 'InfoRequestEvent').
+ where(model: 'InfoRequestEvent').
delete_all
- request.move_to_public_body(new_body, :editor => editor)
+ request.move_to_public_body(new_body, editor: editor)
request.reload
reindex_job = ActsAsXapian::ActsAsXapianJob.
- where(:model => 'InfoRequestEvent').
+ where(model: 'InfoRequestEvent').
last
expect(reindex_job.model_id).to eq(request.info_request_events.last.id)
end
@@ -1142,65 +1142,65 @@
let(:editor) { FactoryBot.create(:user) }
it "increments the new authority's info_requests_count " do
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { new_body.reload.info_requests_count }.from(0).to(1)
end
it "decrements the old authority's info_requests_count " do
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { old_body.reload.info_requests_count }.from(1).to(0)
end
it "increments the new authority's info_requests_visible_count " do
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { new_body.reload.info_requests_visible_count }.
from(0).to(1)
end
it "decrements the old authority's info_requests_visible_count " do
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { old_body.reload.info_requests_visible_count }.
from(1).to(0)
end
it "increments the new authority's info_requests_successful_count " do
- request.update!(:described_state => 'successful')
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(described_state: 'successful')
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { new_body.reload.info_requests_successful_count }.
from(nil).to(1)
end
it "decrements the old authority's info_requests_successful_count " do
- request.update!(:described_state => 'successful')
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(described_state: 'successful')
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { old_body.reload.info_requests_successful_count }.
from(1).to(0)
end
it "increments the new authority's info_requests_not_held_count " do
- request.update!(:described_state => 'not_held')
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(described_state: 'not_held')
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { new_body.reload.info_requests_not_held_count }.
from(nil).to(1)
end
it "decrements the old authority's info_requests_not_held_count " do
- request.update!(:described_state => 'not_held')
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(described_state: 'not_held')
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { old_body.reload.info_requests_not_held_count }.
from(1).to(0)
end
it "increments the new authority's info_requests_visible_classified_count " do
- request.update!(:awaiting_description => false)
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(awaiting_description: false)
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { new_body.reload.info_requests_visible_classified_count }.
from(nil).to(1)
end
it "decrements the old authority's info_requests_visible_classified_count " do
- request.update!(:awaiting_description => false)
- expect { request.move_to_public_body(new_body, :editor => editor) }.
+ request.update!(awaiting_description: false)
+ expect { request.move_to_public_body(new_body, editor: editor) }.
to change { old_body.reload.info_requests_visible_classified_count }.
from(1).to(0)
end
@@ -1231,7 +1231,7 @@
request = FactoryBot.create(:info_request)
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
- request.move_to_user(new_user, :editor => editor)
+ request.move_to_user(new_user, editor: editor)
request.reload
expect(request.user).to eq(new_user)
end
@@ -1241,7 +1241,7 @@
old_user = request.user
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
- request.move_to_user(new_user, :editor => editor)
+ request.move_to_user(new_user, editor: editor)
request.reload
event = request.info_request_events.last
@@ -1257,7 +1257,7 @@
request = FactoryBot.create(:info_request)
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
- expect(request.move_to_user(new_user, :editor => editor)).
+ expect(request.move_to_user(new_user, editor: editor)).
to eq(new_user)
end
@@ -1265,7 +1265,7 @@
request = FactoryBot.create(:info_request)
editor = FactoryBot.create(:user)
existing_user = request.user
- request.move_to_user(nil, :editor => editor)
+ request.move_to_user(nil, editor: editor)
request.reload
expect(request.user).to eq(existing_user)
end
@@ -1275,7 +1275,7 @@
new_user = FactoryBot.build(:user)
editor = FactoryBot.create(:user)
existing_user = request.user
- request.move_to_user(new_user, :editor => editor)
+ request.move_to_user(new_user, editor: editor)
request.reload
expect(request.user).to eq(existing_user)
end
@@ -1283,7 +1283,7 @@
it 'returns nil if the user cannot be updated' do
request = FactoryBot.create(:info_request)
editor = FactoryBot.create(:user)
- expect(request.move_to_user(nil, :editor => editor)).to eq(nil)
+ expect(request.move_to_user(nil, editor: editor)).to eq(nil)
end
it 'reindexes the info request' do
@@ -1291,14 +1291,14 @@
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
reindex_job = ActsAsXapian::ActsAsXapianJob.
- where(:model => 'InfoRequestEvent').
+ where(model: 'InfoRequestEvent').
delete_all
- request.move_to_user(new_user, :editor => editor)
+ request.move_to_user(new_user, editor: editor)
request.reload
reindex_job = ActsAsXapian::ActsAsXapianJob.
- where(:model => 'InfoRequestEvent').
+ where(model: 'InfoRequestEvent').
last
expect(reindex_job.model_id).to eq(request.info_request_events.last.id)
end
@@ -1310,7 +1310,7 @@
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
- expect { request.move_to_user(new_user, :editor => editor) }.
+ expect { request.move_to_user(new_user, editor: editor) }.
to change { new_user.reload.info_requests_count }.from(0).to(1)
end
@@ -1320,7 +1320,7 @@
new_user = FactoryBot.create(:user)
editor = FactoryBot.create(:user)
- expect { request.move_to_user(new_user, :editor => editor) }.
+ expect { request.move_to_user(new_user, editor: editor) }.
to change { old_user.reload.info_requests_count }.from(1).to(0)
end
@@ -1345,62 +1345,62 @@
end
it 'destroys associated widget_votes' do
- info_request.widget_votes.create(:cookie => 'x' * 20)
+ info_request.widget_votes.create(cookie: 'x' * 20)
info_request.destroy
- expect(WidgetVote.where(:info_request_id => info_request.id)).to be_empty
+ expect(WidgetVote.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated censor_rules' do
- censor_rule = FactoryBot.create(:censor_rule, :info_request => info_request)
+ censor_rule = FactoryBot.create(:censor_rule, info_request: info_request)
info_request.reload
info_request.destroy
- expect(CensorRule.where(:info_request_id => info_request.id)).to be_empty
+ expect(CensorRule.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated comments' do
- comment = FactoryBot.create(:comment, :info_request => info_request)
+ comment = FactoryBot.create(:comment, info_request: info_request)
info_request.reload
info_request.destroy
- expect(Comment.where(:info_request_id => info_request.id)).to be_empty
+ expect(Comment.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated info_request_events' do
info_request.destroy
- expect(InfoRequestEvent.where(:info_request_id => info_request.id)).to be_empty
+ expect(InfoRequestEvent.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated outgoing_messages' do
info_request.destroy
- expect(OutgoingMessage.where(:info_request_id => info_request.id)).to be_empty
+ expect(OutgoingMessage.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated incoming_messages' do
ir_with_incoming = FactoryBot.create(:info_request_with_incoming)
ir_with_incoming.destroy
- expect(IncomingMessage.where(:info_request_id => ir_with_incoming.id)).to be_empty
+ expect(IncomingMessage.where(info_request_id: ir_with_incoming.id)).to be_empty
end
it 'destroys associated mail_server_logs' do
- MailServerLog.create(:line => 'hi!', :order => 1, :info_request => info_request)
+ MailServerLog.create(line: 'hi!', order: 1, info_request: info_request)
info_request.destroy
- expect(MailServerLog.where(:info_request_id => info_request.id)).to be_empty
+ expect(MailServerLog.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated track_things' do
FactoryBot.create(:request_update_track,
- :track_medium => 'email_daily',
- :info_request => info_request,
- :track_query => 'Example Query')
+ track_medium: 'email_daily',
+ info_request: info_request,
+ track_query: 'Example Query')
info_request.destroy
- expect(TrackThing.where(:info_request_id => info_request.id)).to be_empty
+ expect(TrackThing.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated user_info_request_sent_alerts' do
- UserInfoRequestSentAlert.create(:info_request => info_request,
- :user => info_request.user,
- :alert_type => 'comment_1')
+ UserInfoRequestSentAlert.create(info_request: info_request,
+ user: info_request.user,
+ alert_type: 'comment_1')
info_request.destroy
- expect(UserInfoRequestSentAlert.where(:info_request_id => info_request.id)).to be_empty
+ expect(UserInfoRequestSentAlert.where(info_request_id: info_request.id)).to be_empty
end
it 'destroys associated embargoes' do
@@ -1422,7 +1422,7 @@
it "does not clear the database caches if passed the preserve_database_cache option" do
expect(info_request).not_to receive(:clear_in_database_caches!)
- info_request.expire(:preserve_database_cache => true)
+ info_request.expire(preserve_database_cache: true)
end
it 'updates the search index' do
@@ -1514,12 +1514,12 @@
describe '#is_external?' do
it 'returns true if there is an external url' do
- info_request = InfoRequest.new(:external_url => "demo_url")
+ info_request = InfoRequest.new(external_url: "demo_url")
expect(info_request.is_external?).to eq(true)
end
it 'returns false if there is not an external url' do
- info_request = InfoRequest.new(:external_url => nil)
+ info_request = InfoRequest.new(external_url: nil)
expect(info_request.is_external?).to eq(false)
end
@@ -1542,7 +1542,7 @@
let(:message_without_reply_to) { FactoryBot.create(:incoming_message) }
let(:valid_request) { FactoryBot.create(:info_request) }
- let(:unfollowupable_body) { FactoryBot.create(:public_body, :request_email => "") }
+ let(:unfollowupable_body) { FactoryBot.create(:public_body, request_email: "") }
context "it is possible to reply to the public body" do
@@ -1562,7 +1562,7 @@
context "the message has a valid reply address" do
let(:request) do
- FactoryBot.create(:info_request, :public_body => unfollowupable_body)
+ FactoryBot.create(:info_request, public_body: unfollowupable_body)
end
let(:dummy_message) { double(IncomingMessage) }
@@ -1583,7 +1583,7 @@
context "an external request" do
- let(:info_request) { InfoRequest.new(:external_url => "demo_url") }
+ let(:info_request) { InfoRequest.new(external_url: "demo_url") }
it "returns false" do
expect(info_request.is_followupable?(message_without_reply_to)).
@@ -1600,7 +1600,7 @@
context "belongs to an unfollowupable PublicBody" do
let(:request) do
- FactoryBot.create(:info_request, :public_body => unfollowupable_body)
+ FactoryBot.create(:info_request, public_body: unfollowupable_body)
end
it "returns false" do
@@ -1724,7 +1724,7 @@
end
it 'rejects an invalid prominence' do
- info_request = InfoRequest.new(:prominence => 'something')
+ info_request = InfoRequest.new(prominence: 'something')
info_request.valid?
expect(info_request.errors[:prominence]).to include("is not included in the list")
end
@@ -2173,13 +2173,13 @@
describe "#postal_email" do
let(:public_body) do
- FactoryBot.create(:public_body, :request_email => "test@localhost")
+ FactoryBot.create(:public_body, request_email: "test@localhost")
end
context "there is no list of incoming messages to followup" do
it "returns the public body's request_email" do
- request = FactoryBot.create(:info_request, :public_body => public_body)
+ request = FactoryBot.create(:info_request, public_body: public_body)
expect(request.postal_email).to eq("test@localhost")
end
@@ -2188,9 +2188,9 @@
context "there is a list of incoming messages to followup" do
it "returns the email address from the last message in the chain" do
- request = FactoryBot.create(:info_request, :public_body => public_body)
+ request = FactoryBot.create(:info_request, public_body: public_body)
incoming_message = FactoryBot.create(:plain_incoming_message,
- :info_request => request)
+ info_request: request)
request.log_event(
'response',
incoming_message_id: incoming_message.id
@@ -2204,12 +2204,12 @@
describe "#postal_email_name" do
- let(:public_body) { FactoryBot.create(:public_body, :name => "Ministry of Test") }
+ let(:public_body) { FactoryBot.create(:public_body, name: "Ministry of Test") }
context "there is no list of incoming messages to followup" do
it "returns the public body name" do
- request = FactoryBot.create(:info_request, :public_body => public_body)
+ request = FactoryBot.create(:info_request, public_body: public_body)
expect(request.postal_email_name).to eq("Ministry of Test")
end
@@ -2218,9 +2218,9 @@
context "there is a list of incoming messages to followup" do
it "returns the email name from the last message in the chain" do
- request = FactoryBot.create(:info_request, :public_body => public_body)
+ request = FactoryBot.create(:info_request, public_body: public_body)
incoming_message = FactoryBot.create(:plain_incoming_message,
- :info_request => request)
+ info_request: request)
request.log_event(
'response',
incoming_message_id: incoming_message.id
@@ -2383,7 +2383,7 @@
before do
@mock_user = mock_model(User)
- @info_request = InfoRequest.new(:user => @mock_user)
+ @info_request = InfoRequest.new(user: @mock_user)
@other_mock_user = mock_model(User)
end
@@ -2438,71 +2438,71 @@
let(:user) { FactoryBot.create(:user) }
def create_recent_unclassified_request
- request = FactoryBot.create(:info_request, :user => user,
- :created_at => recent_date)
- message = FactoryBot.create(:incoming_message, :created_at => recent_date,
- :info_request => request)
- FactoryBot.create(:info_request_event, :incoming_message => message,
- :event_type => "response",
- :info_request => request,
- :created_at => recent_date)
+ request = FactoryBot.create(:info_request, user: user,
+ created_at: recent_date)
+ message = FactoryBot.create(:incoming_message, created_at: recent_date,
+ info_request: request)
+ FactoryBot.create(:info_request_event, incoming_message: message,
+ event_type: "response",
+ info_request: request,
+ created_at: recent_date)
request.awaiting_description = true
request.save!
request
end
def create_old_unclassified_request
- request = FactoryBot.create(:info_request, :user => user,
- :created_at => old_date)
- message = FactoryBot.create(:incoming_message, :created_at => old_date,
- :info_request => request)
- FactoryBot.create(:info_request_event, :incoming_message => message,
- :event_type => "response",
- :info_request => request,
- :created_at => old_date)
+ request = FactoryBot.create(:info_request, user: user,
+ created_at: old_date)
+ message = FactoryBot.create(:incoming_message, created_at: old_date,
+ info_request: request)
+ FactoryBot.create(:info_request_event, incoming_message: message,
+ event_type: "response",
+ info_request: request,
+ created_at: old_date)
request.awaiting_description = true
request.save!
request
end
def create_old_unclassified_described
- request = FactoryBot.create(:info_request, :user => user,
- :created_at => old_date)
- message = FactoryBot.create(:incoming_message, :created_at => old_date,
- :info_request => request)
- FactoryBot.create(:info_request_event, :incoming_message => message,
- :event_type => "response",
- :info_request => request,
- :created_at => old_date)
+ request = FactoryBot.create(:info_request, user: user,
+ created_at: old_date)
+ message = FactoryBot.create(:incoming_message, created_at: old_date,
+ info_request: request)
+ FactoryBot.create(:info_request_event, incoming_message: message,
+ event_type: "response",
+ info_request: request,
+ created_at: old_date)
request
end
def create_old_unclassified_no_user
- request = FactoryBot.create(:info_request, :user => nil,
- :external_user_name => 'test_user',
- :external_url => 'test',
- :created_at => old_date)
- message = FactoryBot.create(:incoming_message, :created_at => old_date,
- :info_request => request)
- FactoryBot.create(:info_request_event, :incoming_message => message,
- :event_type => "response",
- :info_request => request,
- :created_at => old_date)
+ request = FactoryBot.create(:info_request, user: nil,
+ external_user_name: 'test_user',
+ external_url: 'test',
+ created_at: old_date)
+ message = FactoryBot.create(:incoming_message, created_at: old_date,
+ info_request: request)
+ FactoryBot.create(:info_request_event, incoming_message: message,
+ event_type: "response",
+ info_request: request,
+ created_at: old_date)
request.awaiting_description = true
request.save!
request
end
def create_old_unclassified_holding_pen
- request = FactoryBot.create(:info_request, :user => user,
- :title => 'Holding pen',
- :created_at => old_date)
- message = FactoryBot.create(:incoming_message, :created_at => old_date,
- :info_request => request)
- FactoryBot.create(:info_request_event, :incoming_message => message,
- :event_type => "response",
- :info_request => request,
- :created_at => old_date)
+ request = FactoryBot.create(:info_request, user: user,
+ title: 'Holding pen',
+ created_at: old_date)
+ message = FactoryBot.create(:incoming_message, created_at: old_date,
+ info_request: request)
+ FactoryBot.create(:info_request_event, incoming_message: message,
+ event_type: "response",
+ info_request: request,
+ created_at: old_date)
request.awaiting_description = true
request.save!
request
@@ -2548,20 +2548,20 @@ def create_old_unclassified_holding_pen
dog_request = info_requests(:fancy_dog_request)
old_unclassified =
InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').limit(1).order(Arel.sql('random()'))
+ where(prominence: 'normal').limit(1).order(Arel.sql('random()'))
expect(old_unclassified.length).to eq(1)
expect(old_unclassified.first).to eq(dog_request)
dog_request.prominence = 'requester_only'
dog_request.save!
old_unclassified =
InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').limit(1).order(Arel.sql('random()'))
+ where(prominence: 'normal').limit(1).order(Arel.sql('random()'))
expect(old_unclassified.length).to eq(0)
dog_request.prominence = 'hidden'
dog_request.save!
old_unclassified =
InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').limit(1).order(Arel.sql('random()'))
+ where(prominence: 'normal').limit(1).order(Arel.sql('random()'))
expect(old_unclassified.length).to eq(0)
end
@@ -2572,17 +2572,17 @@ def create_old_unclassified_holding_pen
it "does not return requests that don't have normal prominence" do
dog_request = info_requests(:fancy_dog_request)
old_unclassified = InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').count
+ where(prominence: 'normal').count
expect(old_unclassified).to eq(1)
dog_request.prominence = 'requester_only'
dog_request.save!
old_unclassified = InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').count
+ where(prominence: 'normal').count
expect(old_unclassified).to eq(0)
dog_request.prominence = 'hidden'
dog_request.save!
old_unclassified = InfoRequest.where_old_unclassified.
- where(:prominence => 'normal').count
+ where(prominence: 'normal').count
expect(old_unclassified).to eq(0)
end
@@ -2593,20 +2593,20 @@ def create_old_unclassified_holding_pen
before do
allow(Time).to receive(:now).and_return(Time.utc(2007, 11, 9, 23, 59))
@info_request = FactoryBot.create(:info_request,
- :prominence => 'normal',
- :awaiting_description => true)
+ prominence: 'normal',
+ awaiting_description: true)
@comment_event = FactoryBot.create(:info_request_event,
- :created_at => Time.zone.now - 23.days,
- :event_type => 'comment',
- :info_request => @info_request)
+ created_at: Time.zone.now - 23.days,
+ event_type: 'comment',
+ info_request: @info_request)
@incoming_message = FactoryBot.create(:incoming_message,
- :prominence => 'normal',
- :info_request => @info_request)
+ prominence: 'normal',
+ info_request: @info_request)
@response_event = FactoryBot.create(:info_request_event,
- :info_request => @info_request,
- :created_at => Time.zone.now - 22.days,
- :event_type => 'response',
- :incoming_message => @incoming_message)
+ info_request: @info_request,
+ created_at: Time.zone.now - 22.days,
+ event_type: 'response',
+ incoming_message: @incoming_message)
@info_request.update_attribute(:awaiting_description, true)
end
@@ -2634,8 +2634,8 @@ def create_old_unclassified_holding_pen
describe '#apply_censor_rules_to_text' do
it 'applies each censor rule to the text' do
- rule_1 = FactoryBot.build(:censor_rule, :text => '1')
- rule_2 = FactoryBot.build(:censor_rule, :text => '2')
+ rule_1 = FactoryBot.build(:censor_rule, text: '1')
+ rule_2 = FactoryBot.build(:censor_rule, text: '2')
info_request = FactoryBot.build(:info_request)
allow(info_request).
to receive(:applicable_censor_rules).and_return([rule_1, rule_2])
@@ -2650,8 +2650,8 @@ def create_old_unclassified_holding_pen
describe '#apply_censor_rules_to_binary' do
it 'applies each censor rule to the text' do
- rule_1 = FactoryBot.build(:censor_rule, :text => '1')
- rule_2 = FactoryBot.build(:censor_rule, :text => '2')
+ rule_1 = FactoryBot.build(:censor_rule, text: '1')
+ rule_2 = FactoryBot.build(:censor_rule, text: '2')
info_request = FactoryBot.build(:info_request)
allow(info_request).
to receive(:applicable_censor_rules).and_return([rule_1, rule_2])
@@ -2669,16 +2669,16 @@ def create_old_unclassified_holding_pen
before(:each) do
@request = FactoryBot.create(:info_request)
- @default_opts = { :last_edit_editor => 'unknown',
- :last_edit_comment => 'none' }
+ @default_opts = { last_edit_editor: 'unknown',
+ last_edit_comment: 'none' }
end
it 'replaces text with global censor rules' do
data = 'There was a mouse called Stilton, he wished that he was blue'
expected = 'There was a mouse called Stilton, he said that he was blue'
- opts = { :text => 'wished',
- :replacement => 'said' }.merge(@default_opts)
+ opts = { text: 'wished',
+ replacement: 'said' }.merge(@default_opts)
CensorRule.create!(opts)
result = @request.apply_masks(data, 'text/plain')
@@ -2691,8 +2691,8 @@ def create_old_unclassified_holding_pen
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -2708,8 +2708,8 @@ def create_old_unclassified_holding_pen
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -2754,7 +2754,7 @@ def create_old_unclassified_holding_pen
context ':decorate option is true' do
it 'returns a prominence calculator' do
- expect(InfoRequest.new.prominence(:decorate => true))
+ expect(InfoRequest.new.prominence(decorate: true))
.to be_a(InfoRequest::Prominence::Calculator)
end
@@ -2799,37 +2799,37 @@ def create_old_unclassified_holding_pen
end
it 'sets last_public_response_at when a public response is added' do
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.create(:incoming_message, :info_request => request)
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.create(:incoming_message, info_request: request)
event =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message,
+ event_type: 'response')
expect(request.last_public_response_at).
to be_within(1.second).of(event.created_at)
end
it 'does not set last_public_response_at when a hidden response is added' do
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.create(:incoming_message, :info_request => request,
- :prominence => 'hidden')
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.create(:incoming_message, info_request: request,
+ prominence: 'hidden')
event =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message,
+ event_type: 'response')
expect(request.last_public_response_at).to be_nil
end
it 'sets last_public_response_at to nil when the only response is hidden' do
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.create(:incoming_message, :info_request => request)
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message,
- :event_type => 'response')
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.create(:incoming_message, info_request: request)
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message,
+ event_type: 'response')
- message.update(:prominence => 'hidden')
+ message.update(prominence: 'hidden')
expect(request.last_public_response_at).to be_nil
end
@@ -2837,39 +2837,39 @@ def create_old_unclassified_holding_pen
it 'reverts last_public_response_at when the latest response is hidden' do
travel_to(21.days.ago)
- request = FactoryBot.create(:info_request, :user => user)
- message1 = FactoryBot.create(:incoming_message, :info_request => request)
+ request = FactoryBot.create(:info_request, user: user)
+ message1 = FactoryBot.create(:incoming_message, info_request: request)
event1 =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message1,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message1,
+ event_type: 'response')
travel_back
travel_to(2.days.ago)
- message2 = FactoryBot.create(:incoming_message, :info_request => request)
+ message2 = FactoryBot.create(:incoming_message, info_request: request)
event2 =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message2,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message2,
+ event_type: 'response')
travel_back
expect(request.last_public_response_at).
to be_within(1.second).of(event2.created_at)
- message2.update(:prominence => 'hidden')
+ message2.update(prominence: 'hidden')
expect(request.last_public_response_at).
to be_within(1.second).of(event1.created_at)
end
it 'sets last_public_response_at to nil when the only response is destroyed' do
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.create(:incoming_message, :info_request => request)
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message,
- :event_type => 'response')
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.create(:incoming_message, info_request: request)
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message,
+ event_type: 'response')
message.destroy
expect(request.last_public_response_at).to be_nil
end
@@ -2877,21 +2877,21 @@ def create_old_unclassified_holding_pen
it 'reverts last_public_response_at when the latest response is destroyed' do
travel_to(21.days.ago)
- request = FactoryBot.create(:info_request, :user => user)
- message1 = FactoryBot.create(:incoming_message, :info_request => request)
+ request = FactoryBot.create(:info_request, user: user)
+ message1 = FactoryBot.create(:incoming_message, info_request: request)
event1 =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message1,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message1,
+ event_type: 'response')
travel_back
travel_to(2.days.ago)
- message2 = FactoryBot.create(:incoming_message, :info_request => request)
+ message2 = FactoryBot.create(:incoming_message, info_request: request)
event2 =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message2,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message2,
+ event_type: 'response')
travel_back
@@ -2907,16 +2907,16 @@ def create_old_unclassified_holding_pen
it 'sets last_public_response_at when a hidden response is unhidden' do
travel_to(21.days.ago)
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.create(:incoming_message, :info_request => request,
- :prominence => 'hidden')
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.create(:incoming_message, info_request: request,
+ prominence: 'hidden')
event =
- FactoryBot.create(:info_request_event, :info_request => request,
- :incoming_message => message,
- :event_type => 'response')
+ FactoryBot.create(:info_request_event, info_request: request,
+ incoming_message: message,
+ event_type: 'response')
travel_back
- message.update(:prominence => 'normal')
+ message.update(prominence: 'normal')
expect(request.last_public_response_at).
to be_within(1.second).of(event.created_at)
@@ -3006,20 +3006,20 @@ def create_old_unclassified_holding_pen
describe 'when generating json for the api' do
before do
- @user = mock_model(User, :json_for_api => { :id => 20,
- :url_name => 'alaveteli_user',
- :name => 'Alaveteli User',
- :ban_text => '',
- :about_me => 'Hi' })
+ @user = mock_model(User, json_for_api: { id: 20,
+ url_name: 'alaveteli_user',
+ name: 'Alaveteli User',
+ ban_text: '',
+ about_me: 'Hi' })
end
it 'returns full user info for an internal request' do
- @info_request = InfoRequest.new(:user => @user)
- expect(@info_request.user_json_for_api).to eq({ :id => 20,
- :url_name => 'alaveteli_user',
- :name => 'Alaveteli User',
- :ban_text => '',
- :about_me => 'Hi' })
+ @info_request = InfoRequest.new(user: @user)
+ expect(@info_request.user_json_for_api).to eq({ id: 20,
+ url_name: 'alaveteli_user',
+ name: 'Alaveteli User',
+ ban_text: '',
+ about_me: 'Hi' })
end
end
@@ -3039,21 +3039,21 @@ def create_old_unclassified_holding_pen
it "is not confused by an nil subject in the incoming message" do
ir = info_requests(:fancy_dog_request)
im = mock_model(IncomingMessage,
- :subject => nil,
- :valid_to_reply_to? => true)
- subject = ir.email_subject_followup(:incoming_message => im, :html => false)
+ subject: nil,
+ valid_to_reply_to?: true)
+ subject = ir.email_subject_followup(incoming_message: im, html: false)
expect(subject).to match(/^Re: Freedom of Information request.*fancy dog/)
end
it "returns a hash with the user's name for an external request" do
- @info_request = InfoRequest.new(:external_url => 'http://www.example.com',
- :external_user_name => 'External User')
- expect(@info_request.user_json_for_api).to eq({:name => 'External User'})
+ @info_request = InfoRequest.new(external_url: 'http://www.example.com',
+ external_user_name: 'External User')
+ expect(@info_request.user_json_for_api).to eq({name: 'External User'})
end
it 'returns "Anonymous user" for an anonymous external user' do
- @info_request = InfoRequest.new(:external_url => 'http://www.example.com')
- expect(@info_request.user_json_for_api).to eq({:name => 'Anonymous user'})
+ @info_request = InfoRequest.new(external_url: 'http://www.example.com')
+ expect(@info_request.user_json_for_api).to eq({name: 'Anonymous user'})
end
end
@@ -3062,9 +3062,9 @@ def create_old_unclassified_holding_pen
context "a request" do
- let(:request) { InfoRequest.create!(:title => "My request",
- :public_body => public_bodies(:geraldine_public_body),
- :user => users(:bob_smith_user)) }
+ let(:request) { InfoRequest.create!(title: "My request",
+ public_body: public_bodies(:geraldine_public_body),
+ user: users(:bob_smith_user)) }
context "a series of events on a request" do
@@ -3345,11 +3345,11 @@ def create_old_unclassified_holding_pen
old_successful_count = pb.info_requests_successful_count
old_not_held_count = pb.info_requests_not_held_count
old_visible_count = pb.info_requests_visible_count
- ir = InfoRequest.new(:external_url => 'http://www.example.com',
- :external_user_name => 'Example User',
- :title => 'Some request or other',
- :described_state => 'partially_successful',
- :public_body => pb)
+ ir = InfoRequest.new(external_url: 'http://www.example.com',
+ external_user_name: 'Example User',
+ title: 'Some request or other',
+ described_state: 'partially_successful',
+ public_body: pb)
ir.save!
expect(pb.info_requests_successful_count).to eq(old_successful_count + 1)
expect(pb.info_requests_visible_count).to eq(old_visible_count + 1)
@@ -3381,11 +3381,11 @@ def create_old_unclassified_holding_pen
old_successful_count = pb.info_requests_successful_count
old_not_held_count = pb.info_requests_not_held_count
old_visible_count = pb.info_requests_visible_count
- ir = InfoRequest.new(:external_url => 'http://www.example.com',
- :external_user_name => 'Example User',
- :title => 'Some request or other',
- :described_state => 'partially_successful',
- :public_body => pb)
+ ir = InfoRequest.new(external_url: 'http://www.example.com',
+ external_user_name: 'Example User',
+ title: 'Some request or other',
+ described_state: 'partially_successful',
+ public_body: pb)
ir.save!
expect(pb.info_requests_successful_count).to eq(old_successful_count + 1)
expect(pb.info_requests_visible_count).to eq(old_visible_count + 1)
@@ -3487,7 +3487,7 @@ def apply_filters(filters)
end
it "filters requests" do
- expect(apply_filters(:latest_status => 'all')).to match_array(InfoRequest.all)
+ expect(apply_filters(latest_status: 'all')).to match_array(InfoRequest.all)
# default sort order is the request with the most recently created event first
order_sql = <<-EOF.strip_heredoc
@@ -3496,7 +3496,7 @@ def apply_filters(filters)
WHERE info_request_events.info_request_id = info_requests.id)
DESC
EOF
- expect(apply_filters(:latest_status => 'all')).
+ expect(apply_filters(latest_status: 'all')).
to eq(InfoRequest.all.order(Arel.sql(order_sql)))
conditions = <<-EOF.strip_heredoc
@@ -3514,14 +3514,14 @@ def apply_filters(filters)
IN ('successful', 'partially_successful')
)
EOF
- expect(apply_filters(:latest_status => 'successful')).
+ expect(apply_filters(latest_status: 'successful')).
to match_array(InfoRequest.where(conditions))
end
it "filters requests by date" do
# The semantics of the search are that it finds any InfoRequest
# that has any InfoRequestEvent created in the specified range
- filters = {:latest_status => 'all', :request_date_before => '13/10/2007'}
+ filters = {latest_status: 'all', request_date_before: '13/10/2007'}
conditions1 = <<-EOF
id IN (SELECT info_request_id
FROM info_request_events
@@ -3530,7 +3530,7 @@ def apply_filters(filters)
expect(apply_filters(filters)).
to match_array(InfoRequest.where(conditions1))
- filters = {:latest_status => 'all', :request_date_after => '13/10/2007'}
+ filters = {latest_status: 'all', request_date_after: '13/10/2007'}
conditions2 = <<-EOF
id IN (SELECT info_request_id
FROM info_request_events
@@ -3539,9 +3539,9 @@ def apply_filters(filters)
expect(apply_filters(filters)).
to match_array(InfoRequest.where(conditions2))
- filters = {:latest_status => 'all',
- :request_date_after => '13/10/2007',
- :request_date_before => '01/11/2007'}
+ filters = {latest_status: 'all',
+ request_date_after: '13/10/2007',
+ request_date_before: '01/11/2007'}
conditions3 = <<-EOF
id IN (SELECT info_request_id
FROM info_request_events
@@ -3556,7 +3556,7 @@ def apply_filters(filters)
# This doesn’t precisely duplicate the logic of the actual
# query, but it is close enough to give the same result with
# the current set of test data.
- results = apply_filters(:latest_status => 'awaiting')
+ results = apply_filters(latest_status: 'awaiting')
conditions = <<-EOF
id IN (
SELECT info_request_id
@@ -3583,7 +3583,7 @@ def apply_filters(filters)
event.described_state = event.calculated_state = "internal_review"
event.save!
destroy_and_rebuild_xapian_index
- results = apply_filters(:latest_status => 'awaiting')
+ results = apply_filters(latest_status: 'awaiting')
expect(results.include?(info_requests(:fancy_dog_request))).to eq(true)
end
@@ -4157,11 +4157,11 @@ def email_and_raw_email(opts = {})
info_request.set_described_state('waiting_clarification')
# Followup message is sent
- outgoing_message = OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :info_request_id => info_request.id,
- :body => 'Some text',
- :what_doing => 'normal_sort')
+ outgoing_message = OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ info_request_id: info_request.id,
+ body: 'Some text',
+ what_doing: 'normal_sort')
outgoing_message.record_email_delivery('', '')
followup_event = info_request.
info_request_events.reload.
@@ -4287,7 +4287,7 @@ def email_and_raw_email(opts = {})
info_request.log_event('resent', param: 'value')
event = info_request.info_request_events.reload.last
expect(event.event_type).to eq 'resent'
- expect(event.params).to eq :param => 'value'
+ expect(event.params).to eq param: 'value'
end
context 'if options are passed' do
@@ -4405,7 +4405,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_overdue_events
overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'overdue')
+ where(event_type: 'overdue')
expect(overdue_events.size).to eq 0
end
end
@@ -4422,7 +4422,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_overdue_events
overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'overdue')
+ where(event_type: 'overdue')
expect(overdue_events.size).to eq 1
overdue_event = overdue_events.first
expect(overdue_event.created_at).to eq Time.zone.parse('2015-01-29').beginning_of_day
@@ -4473,7 +4473,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_overdue_events
overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'overdue')
+ where(event_type: 'overdue')
expect(overdue_events.size).to eq 2
overdue_event = overdue_events.first
expect(overdue_event.created_at)
@@ -4506,7 +4506,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_very_overdue_events
very_overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'very_overdue')
+ where(event_type: 'very_overdue')
expect(very_overdue_events.size).to eq 0
end
end
@@ -4522,7 +4522,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_very_overdue_events
very_overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'very_overdue')
+ where(event_type: 'very_overdue')
expect(very_overdue_events.size).to eq 1
very_overdue_event = very_overdue_events.first
expect(very_overdue_event.created_at).
@@ -4574,7 +4574,7 @@ def email_and_raw_email(opts = {})
InfoRequest.log_very_overdue_events
very_overdue_events = info_request.
info_request_events.reload.
- where(:event_type => 'very_overdue')
+ where(event_type: 'very_overdue')
expect(very_overdue_events.size).to eq 2
very_overdue_event = very_overdue_events.first
expect(very_overdue_event.created_at).
diff --git a/spec/models/mail_server_log_spec.rb b/spec/models/mail_server_log_spec.rb
index 68b2122f29..85e160f7f3 100644
--- a/spec/models/mail_server_log_spec.rb
+++ b/spec/models/mail_server_log_spec.rb
@@ -143,8 +143,8 @@
# things go wrong.
fixture_path = file_fixture_name('exim-bad-utf8-exim-log')
log = File.open(fixture_path, 'r')
- done = MailServerLogDone.new(:filename => "foo",
- :last_stat => DateTime.new(2012, 10, 10))
+ done = MailServerLogDone.new(filename: "foo",
+ last_stat: DateTime.new(2012, 10, 10))
expect(ir.mail_server_logs.count).to eq 0
# This will error if we don't sanitize the lines
@@ -179,7 +179,7 @@
info_request = FactoryBot.create(:info_request)
allow(info_request).to receive(:incoming_email).
and_return('foi+request-331612-13811a2b@example.com')
- info_request.mail_server_logs.create!(:line => line, :order => 1)
+ info_request.mail_server_logs.create!(line: line, order: 1)
expect(MailServerLog.request_exim_sent?(info_request)).to be true
end
@@ -195,7 +195,7 @@
info_request = FactoryBot.create(:info_request)
allow(info_request).to receive(:incoming_email).
and_return('foi+request-331612-13811a2b@example.com')
- info_request.mail_server_logs.create!(:line => line, :order => 1)
+ info_request.mail_server_logs.create!(line: line, order: 1)
expect(MailServerLog.request_exim_sent?(info_request)).to be false
end
@@ -229,7 +229,7 @@
ir2 = info_requests(:naughty_chicken_request)
allow(InfoRequest).to receive(:find_by_incoming_email).with("foi+request-14-e0e09f97@example.com").and_return(ir1)
allow(InfoRequest).to receive(:find_by_incoming_email).with("foi+request-10-1234@example.com").and_return(ir2)
- MailServerLog.load_postfix_log_data(log, MailServerLogDone.new(:filename => "foo", :last_stat => Time.zone.now))
+ MailServerLog.load_postfix_log_data(log, MailServerLogDone.new(filename: "foo", last_stat: Time.zone.now))
# TODO: Check that each log line is attached to the correct request
expect(ir1.mail_server_logs.count).to eq(5)
expect(ir1.mail_server_logs[0].order).to eq(1)
@@ -269,13 +269,13 @@
describe ".request_postfix_sent?" do
it "returns true when the logs say the message was sent" do
ir = info_requests(:fancy_dog_request)
- ir.mail_server_logs.create!(:line => "Oct 10 16:58:38 kedumba postfix/smtp[26358]: A664436F218D: to=, relay=aspmx.l.google.com[74.125.25.26]:25, delay=2.7, delays=0.16/0.02/1.8/0.67, dsn=2.0.0, status=sent (250 2.0.0 OK 1349848723 e6si653316paw.346)", :order => 1)
+ ir.mail_server_logs.create!(line: "Oct 10 16:58:38 kedumba postfix/smtp[26358]: A664436F218D: to=, relay=aspmx.l.google.com[74.125.25.26]:25, delay=2.7, delays=0.16/0.02/1.8/0.67, dsn=2.0.0, status=sent (250 2.0.0 OK 1349848723 e6si653316paw.346)", order: 1)
expect(MailServerLog.request_postfix_sent?(ir)).to be true
end
it "returns false when the logs say the message hasn't been sent" do
ir = info_requests(:fancy_dog_request)
- ir.mail_server_logs.create!(:line => "Oct 10 13:22:49 kedumba postfix/smtp[11876]: 6FB9036F1307: to=, relay=mta7.am0.yahoodns.net[74.6.136.244]:25, delay=1.5, delays=0.03/0/0.48/1, dsn=5.0.0, status=bounced (host mta7.am0.yahoodns.net[74.6.136.244] said: 554 delivery error: dd Sorry your message to foo@example.com cannot be delivered. This account has been disabled or discontinued [#102]. - mta1272.mail.sk1.yahoo.com (in reply to end of DATA command))", :order => 1)
+ ir.mail_server_logs.create!(line: "Oct 10 13:22:49 kedumba postfix/smtp[11876]: 6FB9036F1307: to=, relay=mta7.am0.yahoodns.net[74.6.136.244]:25, delay=1.5, delays=0.03/0/0.48/1, dsn=5.0.0, status=bounced (host mta7.am0.yahoodns.net[74.6.136.244] said: 554 delivery error: dd Sorry your message to foo@example.com cannot be delivered. This account has been disabled or discontinued [#102]. - mta1272.mail.sk1.yahoo.com (in reply to end of DATA command))", order: 1)
expect(MailServerLog.request_postfix_sent?(ir)).to be false
end
end
@@ -284,7 +284,7 @@
describe '#line' do
it 'returns the line attribute' do
- log = MailServerLog.new(:line => 'log line')
+ log = MailServerLog.new(line: 'log line')
expect(log.line).to eq('log line')
end
@@ -293,8 +293,8 @@
context 'using the :exim MTA' do
it 'returns an EximLine containing the line attribute' do
- log = MailServerLog.new(:line => 'log line')
- expect(log.line(:decorate => true)).
+ log = MailServerLog.new(line: 'log line')
+ expect(log.line(decorate: true)).
to eq(MailServerLog::EximLine.new('log line'))
end
@@ -307,8 +307,8 @@
end
it 'returns a PostfixLine containing the line attribute' do
- log = MailServerLog.new(:line => 'log line')
- expect(log.line(:decorate => true)).
+ log = MailServerLog.new(line: 'log line')
+ expect(log.line(decorate: true)).
to eq(MailServerLog::PostfixLine.new('log line'))
end
@@ -322,62 +322,62 @@
log = FactoryBot.create(:mail_server_log)
line = log.line += " #{ log.info_request.incoming_email }"
idhash = log.info_request.idhash
- log.update!(:line => line)
- expect(log.line(:redact => true)).to_not include(idhash)
+ log.update!(line: line)
+ expect(log.line(redact: true)).to_not include(idhash)
end
it 'redacts the info request id when decorated' do
log = FactoryBot.create(:mail_server_log)
line = log.line += " #{ log.info_request.incoming_email }"
idhash = log.info_request.idhash
- log.update!(:line => line)
- expect(log.line(:redact => true, :decorate => true).to_s).
+ log.update!(line: line)
+ expect(log.line(redact: true, decorate: true).to_s).
to_not include(idhash)
end
it 'handles not having an associated info request' do
- log = MailServerLog.new(:line => 'log line')
- expect(log.line(:redact => true)).to eq('log line')
+ log = MailServerLog.new(line: 'log line')
+ expect(log.line(redact: true)).to eq('log line')
end
it 'handles the info request not having an idhash' do
request = FactoryBot.build(:info_request)
- log = MailServerLog.new(:line => 'log line', :info_request => request)
- expect(log.line(:redact => true)).to eq('log line')
+ log = MailServerLog.new(line: 'log line', info_request: request)
+ expect(log.line(redact: true)).to eq('log line')
end
it 'redacts the hostname if the router is sent_to_smarthost' do
- log = MailServerLog.new(:line => <<-EOF.squish)
+ log = MailServerLog.new(line: <<-EOF.squish)
R=send_to_smarthost
H=secret.ukcod.org.uk [127.0.0.1]:25
EOF
- redacted = log.line(:redact => true)
+ redacted = log.line(redact: true)
expect(redacted).to match(/H\=\[REDACTED\]/)
expect(redacted).to_not include('secret.ukcod.org.uk [127.0.0.1]:25')
end
it 'does not redact the hostname unless the router is sent_to_smarthost' do
- log = MailServerLog.new(:line => <<-EOF.squish)
+ log = MailServerLog.new(line: <<-EOF.squish)
R=dnslookup_returnpath_dkim
H=notsecret.ukcod.org.uk [127.0.0.1]:25
EOF
- redacted = log.line(:redact => true)
+ redacted = log.line(redact: true)
expect(redacted).to include('secret.ukcod.org.uk [127.0.0.1]:25')
end
it 'strips syslog prefixes' do
- log = MailServerLog.new(:line => <<-EOF.squish)
+ log = MailServerLog.new(line: <<-EOF.squish)
Jan 1 16:26:57 secret exim[15407]: 2017-01-01 16:26:57
[15407] 1cNiyG-00040U-Ls => body@example.com…
EOF
- expect(log.line(:redact => true)).to eq(<<-EOF.squish)
+ expect(log.line(redact: true)).to eq(<<-EOF.squish)
2017-01-01 16:26:57 [15407] 1cNiyG-00040U-Ls => body@example.com…
EOF
end
it 'strips syslog prefixes when the line ends in a newline' do
- log = MailServerLog.new(:line => <<-EOF.squish)
+ log = MailServerLog.new(line: <<-EOF.squish)
Jan 1 16:26:57 secret exim[15407]: 2017-01-01 16:26:57
[15407] 1cNiyG-00040U-Ls => body@example.com…
EOF
@@ -387,7 +387,7 @@
expected =
"2017-01-01 16:26:57 [15407] 1cNiyG-00040U-Ls => body@example.com…\n"
- expect(log.line(:redact => true)).to eq(expected)
+ expect(log.line(redact: true)).to eq(expected)
end
end
end
@@ -396,7 +396,7 @@
context 'if there is a stored value' do
let(:log) do
- FactoryBot.create(:mail_server_log, :line => "log text **")
+ FactoryBot.create(:mail_server_log, line: "log text **")
end
it 'returns the stored value' do
@@ -425,7 +425,7 @@
# statuses
context 'if there is a stored value from an MTA-specific status' do
let(:log) do
- FactoryBot.create(:mail_server_log, :line => "log text <=")
+ FactoryBot.create(:mail_server_log, line: "log text <=")
end
it 'recalculates the value' do
@@ -459,7 +459,7 @@
context 'there is not a stored value' do
it 'parses the line text' do
- log = MailServerLog.new(:line => "…<=…")
+ log = MailServerLog.new(line: "…<=…")
expect(log.delivery_status).
to eq(MailServerLog::DeliveryStatus.new(:sent))
end
@@ -476,7 +476,7 @@
end
it 'returns a delivery status for the log line' do
- log = MailServerLog.new(:line => line)
+ log = MailServerLog.new(line: line)
status = MailServerLog::DeliveryStatus.new(:sent)
expect(log.delivery_status).to eq(status)
end
@@ -498,7 +498,7 @@
end
it 'returns a delivery status for the log line' do
- log = MailServerLog.new(:line => line)
+ log = MailServerLog.new(line: line)
status = MailServerLog::DeliveryStatus.new(:delivered)
expect(log.delivery_status).to eq(status)
end
@@ -513,14 +513,14 @@
it 'returns true if the user is the owning user of the info request' do
log = FactoryBot.build(:mail_server_log)
- request = mock_model(InfoRequest, :is_owning_user? => true)
+ request = mock_model(InfoRequest, is_owning_user?: true)
allow(log).to receive(:info_request).and_return(request)
expect(log.is_owning_user?(double(:user))).to eq(true)
end
it 'returns false if the user is not the owning user of the info request' do
log = FactoryBot.build(:mail_server_log)
- request = mock_model(InfoRequest, :is_owning_user? => false)
+ request = mock_model(InfoRequest, is_owning_user?: false)
allow(log).to receive(:info_request).and_return(request)
expect(log.is_owning_user?(double(:user))).to eq(false)
end
@@ -533,7 +533,7 @@
it 'returns true' do
info_request = FactoryBot.create(:info_request,
- :created_at => Time.zone.now - 5.days)
+ created_at: Time.zone.now - 5.days)
allow(MailServerLog).to receive(:request_sent?).with(info_request).
and_return(true)
expect(MailServerLog.check_recent_requests_have_been_sent).to eq(true)
@@ -545,7 +545,7 @@
it 'returns false' do
info_request = FactoryBot.create(:info_request,
- :created_at => Time.zone.now - 5.days)
+ created_at: Time.zone.now - 5.days)
allow(MailServerLog).to receive(:request_sent?).with(info_request).
and_return(false)
allow($stderr).to receive(:puts)
@@ -554,7 +554,7 @@
it 'outputs a message to stderr' do
info_request = FactoryBot.create(:info_request,
- :created_at => Time.zone.now - 5.days)
+ created_at: Time.zone.now - 5.days)
allow(MailServerLog).to receive(:request_sent?).with(info_request).
and_return(false)
expected_message = "failed to find request sending in MTA logs for request " \
diff --git a/spec/models/outgoing_message/template/batch_request_spec.rb b/spec/models/outgoing_message/template/batch_request_spec.rb
index c064ba5623..9f4bc0ac77 100644
--- a/spec/models/outgoing_message/template/batch_request_spec.rb
+++ b/spec/models/outgoing_message/template/batch_request_spec.rb
@@ -19,7 +19,7 @@
end
it 'allows a custom message letter' do
- opts = { :letter => 'A custom letter' }
+ opts = { letter: 'A custom letter' }
expected = "Dear [Authority name],\n\nA custom letter\n\n\n\nYours faithfully,\n\n"
expect(subject.body(opts)).to eq(expected)
end
@@ -41,7 +41,7 @@
end
it 'returns a custom letter' do
- expect(subject.letter(:letter => 'custom')).to eq("\n\ncustom")
+ expect(subject.letter(letter: 'custom')).to eq("\n\ncustom")
end
end
diff --git a/spec/models/outgoing_message/template/incoming_message_followup_spec.rb b/spec/models/outgoing_message/template/incoming_message_followup_spec.rb
index aeebf81d95..21be1cde5d 100644
--- a/spec/models/outgoing_message/template/incoming_message_followup_spec.rb
+++ b/spec/models/outgoing_message/template/incoming_message_followup_spec.rb
@@ -11,12 +11,12 @@
it 'returns the expected template text' do
expected = "Dear A body,\n\n\n\nYours sincerely,\n\n"
- expect(subject.body(:public_body_name => 'A body')).to eq(expected)
+ expect(subject.body(public_body_name: 'A body')).to eq(expected)
end
it 'allows a custom message letter' do
- opts = { :public_body_name => 'A body',
- :letter => 'A custom letter' }
+ opts = { public_body_name: 'A body',
+ letter: 'A custom letter' }
expected = "Dear A body,\n\nA custom letter\n\n\n\nYours sincerely,\n\n"
expect(subject.body(opts)).to eq(expected)
end
@@ -26,7 +26,7 @@
describe '#salutation' do
it 'returns the salutation' do
- expect(subject.salutation(:public_body_name => 'A body')).
+ expect(subject.salutation(public_body_name: 'A body')).
to eq('Dear A body,')
end
@@ -39,7 +39,7 @@
end
it 'returns a custom letter' do
- expect(subject.letter(:letter => 'custom')).to eq("\n\ncustom")
+ expect(subject.letter(letter: 'custom')).to eq("\n\ncustom")
end
end
diff --git a/spec/models/outgoing_message/template/initial_request_spec.rb b/spec/models/outgoing_message/template/initial_request_spec.rb
index a86ac30a5e..33170a9921 100644
--- a/spec/models/outgoing_message/template/initial_request_spec.rb
+++ b/spec/models/outgoing_message/template/initial_request_spec.rb
@@ -11,12 +11,12 @@
it 'returns the expected template text' do
expected = "Dear A body,\n\n\n\nYours faithfully,\n\n"
- expect(subject.body(:public_body_name => 'A body')).to eq(expected)
+ expect(subject.body(public_body_name: 'A body')).to eq(expected)
end
it 'allows a custom message letter' do
- opts = { :public_body_name => 'A body',
- :letter => 'A custom letter' }
+ opts = { public_body_name: 'A body',
+ letter: 'A custom letter' }
expected = "Dear A body,\n\nA custom letter\n\n\n\nYours faithfully,\n\n"
expect(subject.body(opts)).to eq(expected)
end
@@ -27,7 +27,7 @@
context 'when a public_body_name is given' do
it 'returns the salutation' do
- expect(subject.salutation(:public_body_name => 'A body')).
+ expect(subject.salutation(public_body_name: 'A body')).
to eq('Dear A body,')
end
end
@@ -47,7 +47,7 @@
end
it 'returns a custom letter' do
- expect(subject.letter(:letter => 'custom')).to eq("\n\ncustom")
+ expect(subject.letter(letter: 'custom')).to eq("\n\ncustom")
end
end
diff --git a/spec/models/outgoing_message/template/internal_review_spec.rb b/spec/models/outgoing_message/template/internal_review_spec.rb
index 8e2497df6f..a9ed1b8b60 100644
--- a/spec/models/outgoing_message/template/internal_review_spec.rb
+++ b/spec/models/outgoing_message/template/internal_review_spec.rb
@@ -14,27 +14,27 @@
describe '#body' do
it 'requires a :public_body_name key' do
- attrs = { :info_request_title => 'a', :url => 'b' }
+ attrs = { info_request_title: 'a', url: 'b' }
msg = 'Missing required key: public_body_name'
expect { subject.body(attrs) }.to raise_error(ArgumentError, msg)
end
it 'requires an :info_request_title key' do
- attrs = { :public_body_name => 'a', :url => 'b' }
+ attrs = { public_body_name: 'a', url: 'b' }
msg = 'Missing required key: info_request_title'
expect { subject.body(attrs) }.to raise_error(ArgumentError, msg)
end
it 'requires a :url key' do
- attrs = { :public_body_name => 'a', :info_request_title => 'b' }
+ attrs = { public_body_name: 'a', info_request_title: 'b' }
msg = 'Missing required key: url'
expect { subject.body(attrs) }.to raise_error(ArgumentError, msg)
end
it 'returns the expected template text' do
- attrs = { :public_body_name => 'A body',
- :info_request_title => 'a test title',
- :url => 'http://test.host/request/a_test_title' }
+ attrs = { public_body_name: 'A body',
+ info_request_title: 'a test title',
+ url: 'http://test.host/request/a_test_title' }
expected = <<-EOF.strip_heredoc
Dear A body,
@@ -60,10 +60,10 @@
end
it 'allows a custom message letter' do
- attrs = { :public_body_name => 'A body',
- :info_request_title => 'a test title',
- :url => 'http://test.host/request/a_test_title',
- :letter => 'A custom letter' }
+ attrs = { public_body_name: 'A body',
+ info_request_title: 'a test title',
+ url: 'http://test.host/request/a_test_title',
+ letter: 'A custom letter' }
expected = "Dear A body,\n\nA custom letter\n\n\nYours faithfully,\n\n"
expect(subject.body(attrs)).to eq(expected)
end
@@ -73,7 +73,7 @@
describe '#salutation' do
it 'returns the salutation' do
- expect(subject.salutation(:public_body_name => 'A body')).
+ expect(subject.salutation(public_body_name: 'A body')).
to eq('Dear A body,')
end
@@ -82,9 +82,9 @@
describe '#letter' do
it 'returns the letter' do
- attrs = { :public_body_name => 'A body',
- :info_request_title => 'a test title',
- :url => 'http://test.host/request/a_test_title' }
+ attrs = { public_body_name: 'A body',
+ info_request_title: 'a test title',
+ url: 'http://test.host/request/a_test_title' }
expected = <<-EOF.strip_heredoc
@@ -107,7 +107,7 @@
end
it 'returns a custom letter' do
- expect(subject.letter(:letter => 'custom')).to eq("\n\ncustom")
+ expect(subject.letter(letter: 'custom')).to eq("\n\ncustom")
end
end
diff --git a/spec/models/outgoing_message_spec.rb b/spec/models/outgoing_message_spec.rb
index 09d9e2b813..55e12ff775 100644
--- a/spec/models/outgoing_message_spec.rb
+++ b/spec/models/outgoing_message_spec.rb
@@ -112,10 +112,10 @@ class TestError < StandardError; end
describe '#initialize' do
it 'does not censor the #body' do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => 'abc',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: 'abc',
+ what_doing: 'normal_sort' }
message = FactoryBot.create(:outgoing_message, attrs)
@@ -129,14 +129,14 @@ class TestError < StandardError; end
it 'reloads the default body when set after initialization' do
req = FactoryBot.build(:info_request)
- message = described_class.new(:info_request => req)
+ message = described_class.new(info_request: req)
message.default_letter = 'test'
expect(message.body).to include('test')
end
it 'does not replace the body if it has already been changed' do
req = FactoryBot.build(:info_request)
- message = described_class.new(:info_request => req)
+ message = described_class.new(info_request: req)
message.body = 'toast'
message.default_letter = 'test'
expect(message.body).not_to include('test')
@@ -148,30 +148,30 @@ class TestError < StandardError; end
it 'allows a value of normal_sort' do
message =
- FactoryBot.build(:initial_request, :what_doing => 'normal_sort')
+ FactoryBot.build(:initial_request, what_doing: 'normal_sort')
expect(message).to be_valid
end
it 'allows a value of internal_review' do
message =
- FactoryBot.build(:initial_request, :what_doing => 'internal_review')
+ FactoryBot.build(:initial_request, what_doing: 'internal_review')
expect(message).to be_valid
end
it 'allows a value of external_review' do
message =
- FactoryBot.build(:initial_request, :what_doing => 'external_review')
+ FactoryBot.build(:initial_request, what_doing: 'external_review')
expect(message).to be_valid
end
it 'allows a value of new_information' do
message =
- FactoryBot.build(:initial_request, :what_doing => 'new_information')
+ FactoryBot.build(:initial_request, what_doing: 'new_information')
expect(message).to be_valid
end
it 'adds an error to :what_doing_dummy if an invalid value is provided' do
- message = FactoryBot.build(:initial_request, :what_doing => 'invalid')
+ message = FactoryBot.build(:initial_request, what_doing: 'invalid')
message.valid?
expect(message.errors[:what_doing_dummy]).
to eq(['Please choose what sort of reply you are making.'])
@@ -181,29 +181,29 @@ class TestError < StandardError; end
describe '#destroy' do
it 'should destroy the outgoing message' do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => 'abc',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: 'abc',
+ what_doing: 'normal_sort' }
outgoing_message = FactoryBot.create(:outgoing_message, attrs)
outgoing_message.destroy
- expect(OutgoingMessage.where(:id => outgoing_message.id)).to be_empty
+ expect(OutgoingMessage.where(id: outgoing_message.id)).to be_empty
end
it 'should destroy the associated info_request_events' do
info_request = FactoryBot.create(:info_request)
outgoing_message = info_request.outgoing_messages.first
outgoing_message.destroy
- expect(InfoRequestEvent.where(:outgoing_message_id => outgoing_message.id)).to be_empty
+ expect(InfoRequestEvent.where(outgoing_message_id: outgoing_message.id)).to be_empty
end
end
describe '#from' do
it 'uses the user name and request magic email' do
- user = FactoryBot.create(:user, :name => 'Spec User 862')
- request = FactoryBot.create(:info_request, :user => user)
- message = FactoryBot.build(:initial_request, :info_request => request)
+ user = FactoryBot.create(:user, name: 'Spec User 862')
+ request = FactoryBot.create(:info_request, user: user)
+ message = FactoryBot.build(:initial_request, info_request: request)
expected = "Spec User 862 "
expect(message.from).to eq(expected)
end
@@ -215,10 +215,10 @@ class TestError < StandardError; end
context 'when sending an initial request' do
it 'uses the public body name and email' do
- body = FactoryBot.create(:public_body, :name => 'Example Public Body',
- :short_name => 'EPB')
- request = FactoryBot.create(:info_request, :public_body => body)
- message = FactoryBot.build(:initial_request, :info_request => request)
+ body = FactoryBot.create(:public_body, name: 'Example Public Body',
+ short_name: 'EPB')
+ request = FactoryBot.create(:info_request, public_body: body)
+ message = FactoryBot.build(:initial_request, info_request: request)
expected = 'FOI requests at EPB '
expect(message.to).to eq(expected)
end
@@ -231,9 +231,9 @@ class TestError < StandardError; end
message = FactoryBot.build(:internal_review_request)
followup =
- mock_model(IncomingMessage, :from_email => 'specific@example.com',
- :safe_from_name => 'Specific Person',
- :valid_to_reply_to? => true)
+ mock_model(IncomingMessage, from_email: 'specific@example.com',
+ safe_from_name: 'Specific Person',
+ valid_to_reply_to?: true)
allow(message).to receive(:incoming_message_followup).and_return(followup)
expected = 'Specific Person '
@@ -241,16 +241,16 @@ class TestError < StandardError; end
end
it 'uses the public body address if the incoming message has an invalid address' do
- body = FactoryBot.create(:public_body, :name => 'Example Public Body',
- :short_name => 'EPB')
- request = FactoryBot.create(:info_request, :public_body => body)
+ body = FactoryBot.create(:public_body, name: 'Example Public Body',
+ short_name: 'EPB')
+ request = FactoryBot.create(:info_request, public_body: body)
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
followup =
- mock_model(IncomingMessage, :from_email => 'invalid@example',
- :safe_from_name => 'Specific Person',
- :valid_to_reply_to? => false)
+ mock_model(IncomingMessage, from_email: 'invalid@example',
+ safe_from_name: 'Specific Person',
+ valid_to_reply_to?: false)
allow(message).to receive(:incoming_message_followup).and_return(followup)
expected = 'FOI requests at EPB '
@@ -266,8 +266,8 @@ class TestError < StandardError; end
context 'when sending an initial request' do
it 'uses the request title with the law prefixed' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
- message = FactoryBot.build(:initial_request, :info_request => request)
+ request = FactoryBot.create(:info_request, title: 'Example Request')
+ message = FactoryBot.build(:initial_request, info_request: request)
expected = 'Freedom of Information request - Example Request'
expect(message.subject).to eq(expected)
end
@@ -277,9 +277,9 @@ class TestError < StandardError; end
context 'when sending a followup that is not a reply to an incoming message' do
it 'prefixes the initial request subject with Re:' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
+ request = FactoryBot.create(:info_request, title: 'Example Request')
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
allow(message).to receive(:incoming_message_followup).and_return(nil)
expected = 'Re: Freedom of Information request - Example Request'
expect(message.subject).to eq(expected)
@@ -290,12 +290,12 @@ class TestError < StandardError; end
context 'when following up to an incoming message' do
it 'uses the request title prefixed with Re: if the incoming message does not have a valid reply address' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
+ request = FactoryBot.create(:info_request, title: 'Example Request')
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
followup =
- mock_model(IncomingMessage, :valid_to_reply_to? => false)
+ mock_model(IncomingMessage, valid_to_reply_to?: false)
allow(message).
to receive(:incoming_message_followup).and_return(followup)
@@ -304,12 +304,12 @@ class TestError < StandardError; end
end
it 'uses the request title prefixed with Re: if the incoming message does not have a subject' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
+ request = FactoryBot.create(:info_request, title: 'Example Request')
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
- followup = mock_model(IncomingMessage, :subject => nil,
- :valid_to_reply_to? => true)
+ followup = mock_model(IncomingMessage, subject: nil,
+ valid_to_reply_to?: true)
allow(message).
to receive(:incoming_message_followup).and_return(followup)
@@ -318,13 +318,13 @@ class TestError < StandardError; end
end
it 'uses the incoming message subject if it is already prefixed with Re:' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
+ request = FactoryBot.create(:info_request, title: 'Example Request')
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
followup =
- mock_model(IncomingMessage, :valid_to_reply_to? => true,
- :subject => 'Re: FOI REF#123456789')
+ mock_model(IncomingMessage, valid_to_reply_to?: true,
+ subject: 'Re: FOI REF#123456789')
allow(message).
to receive(:incoming_message_followup).and_return(followup)
@@ -332,13 +332,13 @@ class TestError < StandardError; end
end
it 'prefixes the incoming message subject if it is not prefixed with Re:' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
+ request = FactoryBot.create(:info_request, title: 'Example Request')
message = FactoryBot.build(:new_information_followup,
- :info_request => request)
+ info_request: request)
followup =
- mock_model(IncomingMessage, :valid_to_reply_to? => true,
- :subject => 'FOI REF#123456789')
+ mock_model(IncomingMessage, valid_to_reply_to?: true,
+ subject: 'FOI REF#123456789')
allow(message).
to receive(:incoming_message_followup).and_return(followup)
@@ -350,8 +350,8 @@ class TestError < StandardError; end
context 'when requesting an internal review' do
it 'prefixes the request title with the internal review message' do
- request = FactoryBot.create(:info_request, :title => 'Example Request')
- message = FactoryBot.build(:internal_review_request, :info_request => request)
+ request = FactoryBot.create(:info_request, title: 'Example Request')
+ message = FactoryBot.build(:internal_review_request, info_request: request)
expected = 'Internal review of Freedom of Information request - Example Request'
expect(message.subject).to eq(expected)
end
@@ -363,44 +363,44 @@ class TestError < StandardError; end
describe '#body' do
it 'returns the body attribute' do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => 'abc',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: 'abc',
+ what_doing: 'normal_sort' }
message = FactoryBot.build(:outgoing_message, attrs)
expect(message.body).to eq('abc')
end
it 'strips the body of leading and trailing whitespace' do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => ' abc ',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: ' abc ',
+ what_doing: 'normal_sort' }
message = FactoryBot.build(:outgoing_message, attrs)
expect(message.body).to eq('abc')
end
it 'removes excess linebreaks that unnecessarily space it out' do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => "ab\n\nc\n\n",
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: "ab\n\nc\n\n",
+ what_doing: 'normal_sort' }
message = FactoryBot.build(:outgoing_message, attrs)
expect(message.body).to eq("ab\n\nc")
end
it "applies the associated request's censor rules to the text" do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => 'This sensitive text contains secret info!',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: 'This sensitive text contains secret info!',
+ what_doing: 'normal_sort' }
message = FactoryBot.build(:outgoing_message, attrs)
- rules = [FactoryBot.build(:censor_rule, :text => 'secret'),
- FactoryBot.build(:censor_rule, :text => 'sensitive')]
+ rules = [FactoryBot.build(:censor_rule, text: 'secret'),
+ FactoryBot.build(:censor_rule, text: 'sensitive')]
allow_any_instance_of(InfoRequest).to receive(:censor_rules).and_return(rules)
expected = 'This [REDACTED] text contains [REDACTED] info!'
@@ -408,41 +408,41 @@ class TestError < StandardError; end
end
it "applies the given censor rules to the text" do
- attrs = { :status => 'ready',
- :message_type => 'initial_request',
- :body => 'This sensitive text contains secret info!',
- :what_doing => 'normal_sort' }
+ attrs = { status: 'ready',
+ message_type: 'initial_request',
+ body: 'This sensitive text contains secret info!',
+ what_doing: 'normal_sort' }
message = FactoryBot.build(:outgoing_message, attrs)
- request_rules = [FactoryBot.build(:censor_rule, :text => 'secret'),
- FactoryBot.build(:censor_rule, :text => 'sensitive')]
+ request_rules = [FactoryBot.build(:censor_rule, text: 'secret'),
+ FactoryBot.build(:censor_rule, text: 'sensitive')]
allow_any_instance_of(InfoRequest).to receive(:censor_rules).and_return(request_rules)
- censor_rules = [FactoryBot.build(:censor_rule, :text => 'text'),
- FactoryBot.build(:censor_rule, :text => 'contains')]
+ censor_rules = [FactoryBot.build(:censor_rule, text: 'text'),
+ FactoryBot.build(:censor_rule, text: 'contains')]
expected = 'This sensitive [REDACTED] [REDACTED] secret info!'
- expect(message.body(:censor_rules => censor_rules)).to eq(expected)
+ expect(message.body(censor_rules: censor_rules)).to eq(expected)
end
context "validation" do
let(:public_body) do
- FactoryBot.create(:public_body, :name => 'a test public body')
+ FactoryBot.create(:public_body, name: 'a test public body')
end
let(:info_request) do
FactoryBot.create(:info_request,
- :public_body => public_body,
- :url_title => 'a_test_title',
- :title => 'A test title')
+ public_body: public_body,
+ url_title: 'a_test_title',
+ title: 'A test title')
end
it "adds an error message if the text has not been changed" do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
outgoing_message.valid?
expect(outgoing_message.errors.messages[:body]).
@@ -451,10 +451,10 @@ class TestError < StandardError; end
it "adds an error message if the signature block is incomplete" do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
outgoing_message.valid?
expect(outgoing_message.errors.messages[:body]).
@@ -464,10 +464,10 @@ class TestError < StandardError; end
it "does not add the 'enter your letter' error if the text has been changed" do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
outgoing_message.body = "Dear a test public body,\n\nI would like some information please.\n\nYours faithfully,\n\n"
@@ -478,18 +478,18 @@ class TestError < StandardError; end
it "can cope with HTML entities in the message body" do
test_body = FactoryBot.create(:public_body,
- :name => "D's Test Authority")
+ name: "D's Test Authority")
info_request = FactoryBot.create(:info_request,
- :public_body => test_body,
- :url_title => 'a_test_title',
- :title => 'A test title')
+ public_body: test_body,
+ url_title: 'a_test_title',
+ title: 'A test title')
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
outgoing_message.valid?
expect(outgoing_message.errors.messages[:body]).
@@ -503,10 +503,10 @@ class TestError < StandardError; end
end
let(:outgoing_message) do
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
end
it "adds the default_letter text to the message body" do
@@ -539,10 +539,10 @@ class TestError < StandardError; end
context "when a censor rule changes the default text" do
before do
- opts = { :text => 'Regulation 1049/2001',
- :replacement => 'the law',
- :last_edit_editor => 'unknown',
- :last_edit_comment => 'none' }
+ opts = { text: 'Regulation 1049/2001',
+ replacement: 'the law',
+ last_edit_editor: 'unknown',
+ last_edit_comment: 'none' }
CensorRule.create!(opts)
outgoing_message.apply_masks(outgoing_message.body, 'text/plain')
@@ -555,10 +555,10 @@ class TestError < StandardError; end
end
it "copes with a global censor rule that affects the signature text" do
- opts = { :text => 'Yours faithfully,',
- :replacement => 'Cheers!',
- :last_edit_editor => 'unknown',
- :last_edit_comment => 'none' }
+ opts = { text: 'Yours faithfully,',
+ replacement: 'Cheers!',
+ last_edit_editor: 'unknown',
+ last_edit_comment: 'none' }
CensorRule.create!(opts)
outgoing_message.apply_masks(outgoing_message.body, 'text/plain')
@@ -576,10 +576,10 @@ class TestError < StandardError; end
it "adds an error message if the text has not been changed" do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'internal_review',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'internal_review',
+ info_request: info_request)
outgoing_message.valid?
expect(outgoing_message.errors.messages[:body]).
@@ -588,10 +588,10 @@ class TestError < StandardError; end
it 'includes a all correspondence being available online' do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'internal_review',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'internal_review',
+ info_request: info_request)
expect(outgoing_message.body).
to include("A full history of my FOI request and all " \
@@ -600,13 +600,13 @@ class TestError < StandardError; end
end
it 'removes the all correspondence line if the message is embargoed' do
- FactoryBot.create(:embargo, :info_request => info_request)
+ FactoryBot.create(:embargo, info_request: info_request)
info_request.reload
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'internal_review',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'internal_review',
+ info_request: info_request)
expect(outgoing_message.body).
not_to include("A full history of my FOI request and all " \
@@ -620,10 +620,10 @@ class TestError < StandardError; end
it "adds an error message if the text has not been changed" do
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'normal_sort',
+ info_request: info_request)
outgoing_message.valid?
expect(outgoing_message.errors.messages[:body]).
@@ -641,8 +641,8 @@ class TestError < StandardError; end
before(:each) do
@message = FactoryBot.create(:initial_request)
- @default_opts = { :last_edit_editor => 'unknown',
- :last_edit_comment => 'none' }
+ @default_opts = { last_edit_editor: 'unknown',
+ last_edit_comment: 'none' }
end
@@ -650,8 +650,8 @@ class TestError < StandardError; end
data = 'There was a mouse called Stilton, he wished that he was blue'
expected = 'There was a mouse called Stilton, he said that he was blue'
- opts = { :text => 'wished',
- :replacement => 'said' }.merge(@default_opts)
+ opts = { text: 'wished',
+ replacement: 'said' }.merge(@default_opts)
CensorRule.create!(opts)
result = @message.apply_masks(data, 'text/plain')
@@ -664,8 +664,8 @@ class TestError < StandardError; end
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -681,8 +681,8 @@ class TestError < StandardError; end
expected = 'There was a cat called Jarlsberg.'
rules = [
- { :text => 'Stilton', :replacement => 'Jarlsberg' },
- { :text => 'm[a-z][a-z][a-z]e', :regexp => true, :replacement => 'cat' }
+ { text: 'Stilton', replacement: 'Jarlsberg' },
+ { text: 'm[a-z][a-z][a-z]e', regexp: true, replacement: 'cat' }
]
rules.each do |rule|
@@ -727,10 +727,10 @@ class TestError < StandardError; end
title: 'A test title',
public_body: public_body)
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'initial_request',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'initial_request',
+ what_doing: 'normal_sort',
+ info_request: info_request)
expected_text = "Dear a test public body,\n\n\n\nYours faithfully,\n\n"
expect(outgoing_message.get_default_message).to eq(expected_text)
@@ -747,10 +747,10 @@ class TestError < StandardError; end
title: 'A test title',
public_body: public_body)
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'normal_sort',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'normal_sort',
+ info_request: info_request)
expected_text = "Dear a test public body,\n\n\n\nYours faithfully,\n\n"
expect(outgoing_message.get_default_message).to eq(expected_text)
@@ -763,14 +763,14 @@ class TestError < StandardError; end
title: 'A test title',
public_body: public_body)
incoming_message =
- mock_model(IncomingMessage, :safe_from_name => 'helpdesk',
- :valid_to_reply_to? => true)
+ mock_model(IncomingMessage, safe_from_name: 'helpdesk',
+ valid_to_reply_to?: true)
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'normal_sort',
- :info_request => info_request,
- :incoming_message_followup => incoming_message)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'normal_sort',
+ info_request: info_request,
+ incoming_message_followup: incoming_message)
expected_text = "Dear helpdesk,\n\n\n\nYours sincerely,\n\n"
expect(outgoing_message.get_default_message).to eq(expected_text)
@@ -787,10 +787,10 @@ class TestError < StandardError; end
title: 'a test title',
public_body: public_body)
outgoing_message =
- OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :what_doing => 'internal_review',
- :info_request => info_request)
+ OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ what_doing: 'internal_review',
+ info_request: info_request)
expected_text = <<-EOF.strip_heredoc
Dear a test public body,
@@ -823,11 +823,11 @@ class TestError < StandardError; end
before do
@outgoing_message = OutgoingMessage.new({
- :status => 'ready',
- :message_type => 'initial_request',
- :body => 'This request contains a foo@bar.com email address',
- :last_sent_at => Time.zone.now,
- :what_doing => 'normal_sort'
+ status: 'ready',
+ message_type: 'initial_request',
+ body: 'This request contains a foo@bar.com email address',
+ last_sent_at: Time.zone.now,
+ what_doing: 'normal_sort'
})
end
@@ -913,14 +913,14 @@ class TestError < StandardError; end
it 'returns true if the user is the owning user of the info request' do
request = FactoryBot.build(:info_request)
- message = FactoryBot.build(:initial_request, :info_request => request)
+ message = FactoryBot.build(:initial_request, info_request: request)
expect(message.is_owning_user?(request.user)).to eq(true)
end
it 'returns false if the user is not the owning user of the info request' do
user = FactoryBot.create(:user)
request = FactoryBot.create(:info_request)
- message = FactoryBot.build(:initial_request, :info_request => request)
+ message = FactoryBot.build(:initial_request, info_request: request)
expect(message.is_owning_user?(user)).to eq(false)
end
@@ -943,13 +943,13 @@ class TestError < StandardError; end
message.
info_request_events.
first.
- update(:params => { :smtp_message_id => old_format_smtp_id })
+ update(params: { smtp_message_id: old_format_smtp_id })
expect(message.smtp_message_ids).to eq([smtp_id])
end
it 'returns an empty array if the smtp_message_id was not logged' do
message = FactoryBot.create(:initial_request)
- message.info_request_events.first.update(:params => {})
+ message.info_request_events.first.update(params: {})
expect(message.smtp_message_ids).to be_empty
end
@@ -1051,7 +1051,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1067,7 +1067,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1103,7 +1103,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1165,7 +1165,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1227,7 +1227,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1267,7 +1267,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1335,7 +1335,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1406,7 +1406,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1445,7 +1445,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:internal_review_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
message.prepare_message_for_resend
@@ -1502,7 +1502,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1532,7 +1532,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1566,7 +1566,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:initial_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
load_mail_server_logs <<-EOF.strip_heredoc
@@ -1608,7 +1608,7 @@ class TestError < StandardError; end
message = FactoryBot.create(:internal_review_request)
body_email = message.info_request.public_body.request_email
request_email = message.info_request.incoming_email
- request_subject = message.info_request.email_subject_request(:html => false)
+ request_subject = message.info_request.email_subject_request(html: false)
smtp_message_id = 'ogm-14+537f69734b97c-1ebd@localhost'
message.prepare_message_for_resend
@@ -1690,7 +1690,7 @@ class TestError < StandardError; end
junk
garbage
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:unknown)
@@ -1710,7 +1710,7 @@ class TestError < StandardError; end
2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM => authority@example.com F= P= R=dnslookup T=remote_smtp S=2297 H=cluster2.gsi.messagelabs.com [127.0.0.1]:25 X=TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128 CV=no DN="C=US,ST=California,L=Mountain View,O=Symantec Corporation,OU=Symantec.cloud,CN=mail221.messagelabs.com" C="250 ok 1446233056 qp 26062 server-4.tower-221.messagelabs.com!1446233056!7679409!1" QT=1s DT=0s
2015-10-30 19:24:16 [17817] 1ZsFHb-0004dK-SM junk
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:delivered)
@@ -1726,7 +1726,7 @@ class TestError < StandardError; end
2016-04-22 13:13:03 [24970] 1atZxH-0006Uk-KF <= request-326806-hk82iwn7@localhost U=alaveteli P=local S=1923 id=ogm-531356+571a154f7b7c5-2a7e@localhost T="Freedom of Information request - Some Information" from for foi@example.net foi@example.net
2016-04-22 13:24:41 [29720] 1atZxH-0006Uk-KF => foi@example.net F= P= R=dnslookup T=remote_smtp S=1975 H=mail.example.net [213.161.89.103]:25 X=TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256 CV=no DN="ST=CA,L=CU,O=TREND,OU=IMSVA,CN=IMSVA.TREND" C="250 2.0.0 Ok: queued as 8D6E6AA66C" QT=11m38s DT=0s
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:delivered)
@@ -1740,7 +1740,7 @@ class TestError < StandardError; end
2016-04-06 12:01:08 [14933] 1anlCt-0003sm-LG ** foi@authority.net F=: all relevant MX records point to non-existent hosts
2016-04-06 12:01:08 [14935] 1anlCu-0003st-1p <= <> R=1anlCt-0003sm-LG U=Debian-exim P=local S=2934 T="Mail delivery failed: returning message to sender" from <> for request-326806-hk82iwn7@localhost
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:failed)
@@ -1768,7 +1768,7 @@ class TestError < StandardError; end
Oct 3 16:39:38 host postfix/smtp[1681]: 9634B16F7F7: to=, relay=none, delay=46, status=deferred (connect to 216.150.150.131[216.150.150.131]: No route to host)
Oct 3 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:sent)
@@ -1784,7 +1784,7 @@ class TestError < StandardError; end
Nov 19 22:56:04 host postfix/cleanup[26052]: 3742D3602065: message-id=
Nov 19 22:56:04 host postfix/pickup[27268]: 3742D3602065: uid=1003 from=
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:failed)
@@ -1799,7 +1799,7 @@ class TestError < StandardError; end
Oct 3 16:39:38 host postfix/smtp[7676]: CB55836EE58C: to=, relay=aspmx.l.google.com[74.125.25.27]:25, delay=2.5, delays=0.13/0.02/1.7/0.59, dsn=2.0.0, status=sent (250 2.0.0 OK 1349246383 j9si1676296paw.328)
Oct 3 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:delivered)
@@ -1820,7 +1820,7 @@ class TestError < StandardError; end
Nov 20 16:39:38 host postfix/smtp[7676]: CB55836EE58C: to=, relay=aspmx.l.google.com[74.125.25.27]:25, delay=2.5, delays=0.13/0.02/1.7/0.59, dsn=2.0.0, status=sent (250 2.0.0 OK 1349246383 j9si1676296paw.328)
Nov 20 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed
EOF
- logs = log_lines.map { |line| MailServerLog.new(:line => line) }
+ logs = log_lines.map { |line| MailServerLog.new(line: line) }
message = FactoryBot.create(:initial_request)
allow(message).to receive(:mail_server_logs).and_return(logs)
status = MailServerLog::DeliveryStatus.new(:delivered)
@@ -1891,11 +1891,11 @@ class TestError < StandardError; end
before do
@om = outgoing_messages(:useless_outgoing_message)
@outgoing_message = OutgoingMessage.new({
- :status => 'ready',
- :message_type => 'initial_request',
- :body => 'This request contains a foo@bar.com email address',
- :last_sent_at => Time.zone.now,
- :what_doing => 'normal_sort'
+ status: 'ready',
+ message_type: 'initial_request',
+ body: 'This request contains a foo@bar.com email address',
+ last_sent_at: Time.zone.now,
+ what_doing: 'normal_sort'
})
end
@@ -1915,10 +1915,10 @@ class TestError < StandardError; end
title: 'A test title',
public_body: public_body)
outgoing_message = OutgoingMessage.new({
- :status => 'ready',
- :message_type => 'followup',
- :what_doing => 'internal_review',
- :info_request => info_request
+ status: 'ready',
+ message_type: 'followup',
+ what_doing: 'internal_review',
+ info_request: info_request
})
expected_text = "Dear A test public body,\n\nPlease pass this on to the person who conducts Freedom of Information reviews.\n\nI am writing to request an internal review of A test public body's handling of my FOI request 'A test title'.\n\n[ GIVE DETAILS ABOUT YOUR COMPLAINT HERE ]\n\nA full history of my FOI request and all correspondence is available on the Internet at this address: http://test.host/request/a_test_title\n\nYours faithfully,"
expect(outgoing_message.body).to eq(expected_text)
diff --git a/spec/models/post_redirect_spec.rb b/spec/models/post_redirect_spec.rb
index 1ec4089ba5..e8f89c9ae8 100644
--- a/spec/models/post_redirect_spec.rb
+++ b/spec/models/post_redirect_spec.rb
@@ -46,7 +46,7 @@
describe '#valid?' do
it 'is false if an invalid circumstance is provided' do
- pr = PostRedirect.new(:circumstance => 'invalid')
+ pr = PostRedirect.new(circumstance: 'invalid')
expect(pr).to_not be_valid
end
@@ -159,7 +159,7 @@
it "should convert post parameters into YAML and back successfully" do
pr = PostRedirect.new
- example_post_params = { :foo => 'this is stuff', :bar => 83, :humbug => "yikes!!!" }
+ example_post_params = { foo: 'this is stuff', bar: 83, humbug: "yikes!!!" }
pr.post_params = example_post_params
expect(pr.post_params_yaml).to eq(example_post_params.to_yaml)
expect(pr.post_params).to eq(example_post_params)
@@ -167,7 +167,7 @@
it "should convert reason parameters into YAML and back successfully" do
pr = PostRedirect.new
- example_reason_params = { :foo => 'this is stuff', :bar => 83, :humbug => "yikes!!!" }
+ example_reason_params = { foo: 'this is stuff', bar: 83, humbug: "yikes!!!" }
pr.reason_params = example_reason_params
expect(pr.reason_params_yaml).to eq(example_reason_params.to_yaml)
expect(pr.reason_params).to eq(example_reason_params)
diff --git a/spec/models/profile_photo_spec.rb b/spec/models/profile_photo_spec.rb
index d681212ea1..3eb7888d93 100644
--- a/spec/models/profile_photo_spec.rb
+++ b/spec/models/profile_photo_spec.rb
@@ -20,18 +20,18 @@
end
it 'should take no image as invalid' do
- profile_photo = ProfilePhoto.new(:data => nil, :user => @mock_user)
+ profile_photo = ProfilePhoto.new(data: nil, user: @mock_user)
expect(profile_photo.valid?).to eq(false)
end
it 'should take bad binary data as invalid' do
- profile_photo = ProfilePhoto.new(:data => 'blahblahblah', :user => @mock_user)
+ profile_photo = ProfilePhoto.new(data: 'blahblahblah', user: @mock_user)
expect(profile_photo.valid?).to eq(false)
end
it 'should translate a no image error message' do
AlaveteliLocalization.with_locale(:es) do
- profile_photo = ProfilePhoto.new(:data => nil, :user => @mock_user)
+ profile_photo = ProfilePhoto.new(data: nil, user: @mock_user)
expect(profile_photo.valid?).to eq(false)
expect(profile_photo.errors[:data]).to eq(['Por favor elige el fichero que contiene tu foto'])
end
@@ -39,7 +39,7 @@
it 'should accept and convert a PNG to right size' do
data = load_file_fixture("parrot.png")
- profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user)
+ profile_photo = ProfilePhoto.new(data: data, user: @mock_user)
expect(profile_photo.valid?).to eq(true)
expect(profile_photo.image.type).to eq('PNG')
expect(profile_photo.image.width).to eq(96)
@@ -48,7 +48,7 @@
it 'should accept and convert a JPEG to right format and size' do
data = load_file_fixture("parrot.jpg")
- profile_photo = ProfilePhoto.new(:data => data, :user => @mock_user)
+ profile_photo = ProfilePhoto.new(data: data, user: @mock_user)
expect(profile_photo.valid?).to eq(true)
expect(profile_photo.image.type).to eq('PNG')
expect(profile_photo.image.width).to eq(96)
@@ -57,7 +57,7 @@
it 'should accept a draft PNG and not resize it' do
data = load_file_fixture("parrot.png")
- profile_photo = ProfilePhoto.new(:data => data, :draft => true)
+ profile_photo = ProfilePhoto.new(data: data, draft: true)
expect(profile_photo.valid?).to eq(true)
expect(profile_photo.image.type).to eq('PNG')
expect(profile_photo.image.width).to eq(198)
diff --git a/spec/models/public_body_category_link_spec.rb b/spec/models/public_body_category_link_spec.rb
index a671a059f8..4cdbb54dbb 100644
--- a/spec/models/public_body_category_link_spec.rb
+++ b/spec/models/public_body_category_link_spec.rb
@@ -18,8 +18,8 @@
it 'should set a default display order based on the next available display order' do
heading = FactoryBot.create(:public_body_heading)
category = FactoryBot.create(:public_body_category)
- category_link = PublicBodyCategoryLink.new(:public_body_heading => heading,
- :public_body_category => category)
+ category_link = PublicBodyCategoryLink.new(public_body_heading: heading,
+ public_body_category: category)
category_link.valid?
expect(category_link.category_display_order).to eq(PublicBodyCategoryLink.next_display_order(heading))
end
@@ -77,8 +77,8 @@
it 'should return one more than the highest display order if there are public body headings' do
heading = FactoryBot.create(:public_body_heading)
category = FactoryBot.create(:public_body_category)
- category_link = PublicBodyCategoryLink.create(:public_body_heading_id => heading.id,
- :public_body_category_id => category.id)
+ category_link = PublicBodyCategoryLink.create(public_body_heading_id: heading.id,
+ public_body_category_id: category.id)
expect(PublicBodyCategoryLink.next_display_order(heading)).to eq(1)
end
diff --git a/spec/models/public_body_category_spec.rb b/spec/models/public_body_category_spec.rb
index 0a114089c7..b3409747eb 100644
--- a/spec/models/public_body_category_spec.rb
+++ b/spec/models/public_body_category_spec.rb
@@ -31,7 +31,7 @@
it 'should require a unique tag' do
existing = FactoryBot.create(:public_body_category)
- expect(PublicBodyCategory.new(:category_tag => existing.category_tag)).
+ expect(PublicBodyCategory.new(category_tag: existing.category_tag)).
not_to be_valid
end
@@ -49,8 +49,8 @@
it 'uses the base model validation for the default locale' do
category = PublicBodyCategory.new
- translation = category.translations.build(:locale => 'en',
- :description => 'No title')
+ translation = category.translations.build(locale: 'en',
+ description: 'No title')
category.valid?
translation.valid?
expect(category.errors[:title].size).to eq(1)
@@ -63,9 +63,9 @@
it 'saves translations' do
category = FactoryBot.build(:public_body_category)
- category.translations_attributes = { :es => { :locale => 'es',
- :title => 'El Category',
- :description => 'Spanish description' } }
+ category.translations_attributes = { es: { locale: 'es',
+ title: 'El Category',
+ description: 'Spanish description' } }
category.save!
expect(PublicBodyCategory.find(category.id).translations.size).to eq(2)
@@ -79,18 +79,18 @@
it 'does not persist translations' do
category = FactoryBot.create(:public_body_category)
- category.translations_attributes = { :es => { :locale => 'es',
- :title => 'El Category',
- :description => 'Spanish description' } }
+ category.translations_attributes = { es: { locale: 'es',
+ title: 'El Category',
+ description: 'Spanish description' } }
expect(PublicBodyCategory.find(category.id).translations.size).to eq(1)
end
it 'creates a new translation' do
category = FactoryBot.create(:public_body_category)
- category.translations_attributes = { :es => { :locale => 'es',
- :title => 'El Category',
- :description => 'Spanish description' } }
+ category.translations_attributes = { es: { locale: 'es',
+ title: 'El Category',
+ description: 'Spanish description' } }
category.save!
category.reload
expect(category.title(:es)).to eq('El Category')
@@ -98,33 +98,33 @@
it 'updates an existing translation' do
category = FactoryBot.create(:public_body_category)
- category.translations_attributes = { 'es' => { :locale => 'es',
- :title => 'Name',
- :description => 'Desc' } }
+ category.translations_attributes = { 'es' => { locale: 'es',
+ title: 'Name',
+ description: 'Desc' } }
category.save!
- category.translations_attributes = { 'es' => { :id => category.translation_for(:es).id,
- :locale => 'es',
- :title => 'Renamed',
- :description => 'Desc' } }
+ category.translations_attributes = { 'es' => { id: category.translation_for(:es).id,
+ locale: 'es',
+ title: 'Renamed',
+ description: 'Desc' } }
category.save!
expect(category.title(:es)).to eq('Renamed')
end
it 'updates an existing translation and creates a new translation' do
category = FactoryBot.create(:public_body_category)
- category.translations.create(:locale => 'es',
- :title => 'Los Category',
- :description => 'ES Description')
+ category.translations.create(locale: 'es',
+ title: 'Los Category',
+ description: 'ES Description')
expect(category.translations.size).to eq(2)
category.translations_attributes = {
- 'es' => { :id => category.translation_for(:es).id,
- :locale => 'es',
- :title => 'Renamed' },
- 'fr' => { :locale => 'fr',
- :title => 'Le Category' }
+ 'es' => { id: category.translation_for(:es).id,
+ locale: 'es',
+ title: 'Renamed' },
+ 'fr' => { locale: 'fr',
+ title: 'Le Category' }
}
expect(category.translations.size).to eq(3)
@@ -138,17 +138,17 @@
it 'skips empty translations' do
category = FactoryBot.create(:public_body_category)
- category.translations.create(:locale => 'es',
- :title => 'Los Category',
- :description => 'ES Description')
+ category.translations.create(locale: 'es',
+ title: 'Los Category',
+ description: 'ES Description')
expect(category.translations.size).to eq(2)
category.translations_attributes = {
- 'es' => { :id => category.translation_for(:es).id,
- :locale => 'es',
- :title => 'Renamed' },
- 'fr' => { :locale => 'fr' }
+ 'es' => { id: category.translation_for(:es).id,
+ locale: 'es',
+ title: 'Renamed' },
+ 'fr' => { locale: 'fr' }
}
expect(category.translations.size).to eq(2)
@@ -169,18 +169,18 @@
it 'is valid if no required attributes are assigned' do
translation = PublicBodyCategory::Translation.
- new(:locale => AlaveteliLocalization.default_locale)
+ new(locale: AlaveteliLocalization.default_locale)
expect(translation).to be_valid
end
it 'requires a title if another required attribute is assigned' do
- translation = PublicBodyCategory::Translation.new(:description => 'spec')
+ translation = PublicBodyCategory::Translation.new(description: 'spec')
translation.valid?
expect(translation.errors[:title]).to eq(["Title can't be blank"])
end
it 'requires a description if another required attribute is assigned' do
- translation = PublicBodyCategory::Translation.new(:title => 'spec')
+ translation = PublicBodyCategory::Translation.new(title: 'spec')
translation.valid?
expect(translation.errors[:description]).to eq(["Description can't be blank"])
end
@@ -188,7 +188,7 @@
describe '#default_locale?' do
it 'returns true if the locale is the default locale' do
- translation = PublicBodyCategory::Translation.new(:locale => "en")
+ translation = PublicBodyCategory::Translation.new(locale: "en")
expect(translation.default_locale?).to be true
end
@@ -196,7 +196,7 @@
it 'returns true if the locale is the default locale' do
AlaveteliLocalization.set_locales('en_GB es', 'en_GB')
- translation = PublicBodyCategory::Translation.new(:locale => "en_GB")
+ translation = PublicBodyCategory::Translation.new(locale: "en_GB")
expect(translation.default_locale?).to be true
end
@@ -204,7 +204,7 @@
end
it 'returns false if the locale is not the default locale' do
- translation = PublicBodyCategory::Translation.new(:locale => "es")
+ translation = PublicBodyCategory::Translation.new(locale: "es")
expect(translation.default_locale?).to be false
end
diff --git a/spec/models/public_body_change_request_spec.rb b/spec/models/public_body_change_request_spec.rb
index a346b7eef0..5975c974d9 100644
--- a/spec/models/public_body_change_request_spec.rb
+++ b/spec/models/public_body_change_request_spec.rb
@@ -67,34 +67,34 @@
end
it 'should not be valid without a user name if there is no user' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'New Body')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'New Body')
expect(change_request.valid?).to be false
expect(change_request.errors[:user_name]).to eq(['Please enter your name'])
end
it 'should not be valid without a user email address if there is no user' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'New Body')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'New Body')
expect(change_request.valid?).to be false
expect(change_request.errors[:user_email]).to eq(['Please enter your email address'])
end
it 'should be valid with a user and no name or email address' do
user = FactoryBot.build(:user)
- change_request = PublicBodyChangeRequest.new(:user => user,
- :public_body_name => 'New Body')
+ change_request = PublicBodyChangeRequest.new(user: user,
+ public_body_name: 'New Body')
expect(change_request.valid?).to be true
end
it 'should validate the format of a user email address entered' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'New Body',
- :user_email => '@example.com')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'New Body',
+ user_email: '@example.com')
expect(change_request.valid?).to be false
expect(change_request.errors[:user_email]).to eq(["Your email doesn't look like a valid address"])
end
it 'should validate the format of a public body email address entered' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'New Body',
- :public_body_email => '@example.com')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'New Body',
+ public_body_email: '@example.com')
expect(change_request.valid?).to be false
expect(change_request.errors[:public_body_email]).to eq(["The authority email doesn't look like a valid address"])
end
@@ -104,13 +104,13 @@
RSpec.describe PublicBodyChangeRequest, 'get_user_name' do
it 'should return the user_name field if there is no user association' do
- change_request = PublicBodyChangeRequest.new(:user_name => 'Test User')
+ change_request = PublicBodyChangeRequest.new(user_name: 'Test User')
expect(change_request.get_user_name).to eq('Test User')
end
it 'should return the name of the associated user if there is one' do
user = FactoryBot.build(:user)
- change_request = PublicBodyChangeRequest.new(:user => user)
+ change_request = PublicBodyChangeRequest.new(user: user)
expect(change_request.get_user_name).to eq(user.name)
end
@@ -120,13 +120,13 @@
RSpec.describe PublicBodyChangeRequest, 'get_user_email' do
it 'should return the user_email field if there is no user association' do
- change_request = PublicBodyChangeRequest.new(:user_email => 'user@example.com')
+ change_request = PublicBodyChangeRequest.new(user_email: 'user@example.com')
expect(change_request.get_user_email).to eq('user@example.com')
end
it 'should return the email of the associated user if there is one' do
user = FactoryBot.build(:user)
- change_request = PublicBodyChangeRequest.new(:user => user)
+ change_request = PublicBodyChangeRequest.new(user: user)
expect(change_request.get_user_email).to eq(user.email)
end
@@ -153,11 +153,11 @@
RSpec.describe PublicBodyChangeRequest, '.open' do
let(:open_request) do
- FactoryBot.create(:update_body_request, :is_open => true)
+ FactoryBot.create(:update_body_request, is_open: true)
end
let(:closed_request) do
- FactoryBot.create(:update_body_request, :is_open => false)
+ FactoryBot.create(:update_body_request, is_open: false)
end
it "returns requests where the is_open is true" do
@@ -168,13 +168,13 @@
RSpec.describe PublicBodyChangeRequest, 'get_public_body_name' do
it 'should return the public_body_name field if there is no public body association' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'Test Authority')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'Test Authority')
expect(change_request.get_public_body_name).to eq('Test Authority')
end
it 'should return the name of the associated public body if there is one' do
public_body = FactoryBot.build(:public_body)
- change_request = PublicBodyChangeRequest.new(:public_body => public_body)
+ change_request = PublicBodyChangeRequest.new(public_body: public_body)
expect(change_request.get_public_body_name).to eq(public_body.name)
end
@@ -183,10 +183,10 @@
RSpec.describe PublicBodyChangeRequest, 'when creating a comment for the associated public body' do
it 'should include requesting user, source_url and notes' do
- change_request = PublicBodyChangeRequest.new(:user_name => 'Test User',
- :user_email => 'test@example.com',
- :source_url => 'http://www.example.com',
- :notes => 'Some notes')
+ change_request = PublicBodyChangeRequest.new(user_name: 'Test User',
+ user_email: 'test@example.com',
+ source_url: 'http://www.example.com',
+ notes: 'Some notes')
expected = "Requested by: Test User (test@example.com)\nSource URL: http://www.example.com\nNotes: Some notes"
expect(change_request.comment_for_public_body).to eq(expected)
end
@@ -198,21 +198,21 @@
context 'requesting a new authority' do
it 'returns an appropriate subject line' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'Test')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'Test')
expect(change_request.request_subject).
to eq('Add authority - Test')
end
it 'does not HTML escape the authority name' do
change_request =
- PublicBodyChangeRequest.new(:public_body_name => "Test's")
+ PublicBodyChangeRequest.new(public_body_name: "Test's")
expect(change_request.request_subject).
to eq('Add authority - Test\'s')
end
it 'does not mark subject line with unescaped text as html_safe' do
change_request =
- PublicBodyChangeRequest.new(:public_body_name => "Test's")
+ PublicBodyChangeRequest.new(public_body_name: "Test's")
expect(change_request.request_subject.html_safe?).to eq(false)
end
@@ -222,14 +222,14 @@
it 'returns an appropriate subject line' do
public_body = FactoryBot.build(:public_body)
- change_request = PublicBodyChangeRequest.new(:public_body => public_body)
+ change_request = PublicBodyChangeRequest.new(public_body: public_body)
expect(change_request.request_subject).
to eq("Update email address - #{public_body.name}")
end
it 'does not HTML escape the authority name' do
public_body = FactoryBot.build(:public_body, name: "Test's")
- change_request = PublicBodyChangeRequest.new(:public_body => public_body)
+ change_request = PublicBodyChangeRequest.new(public_body: public_body)
expect(change_request.request_subject).
to eq('Update email address - Test\'s')
end
@@ -242,12 +242,12 @@
it 'returns false if there is an associated public_body' do
public_body = FactoryBot.build(:public_body)
- change_request = PublicBodyChangeRequest.new(:public_body => public_body)
+ change_request = PublicBodyChangeRequest.new(public_body: public_body)
expect(change_request.add_body_request?).to eq(false)
end
it 'returns true if there is no associated public_body' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'Test')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'Test')
expect(change_request.add_body_request?).to eq(true)
end
@@ -256,14 +256,14 @@
RSpec.describe PublicBodyChangeRequest, 'when creating a default subject for a response email' do
it 'should create an appropriate subject for a request to add a body' do
- change_request = PublicBodyChangeRequest.new(:public_body_name => 'Test Body')
+ change_request = PublicBodyChangeRequest.new(public_body_name: 'Test Body')
expect(change_request.default_response_subject).
to eq('Re: Add authority - Test Body')
end
it 'should create an appropriate subject for a request to update an email address' do
public_body = FactoryBot.build(:public_body)
- change_request = PublicBodyChangeRequest.new(:public_body => public_body)
+ change_request = PublicBodyChangeRequest.new(public_body: public_body)
expect(change_request.default_response_subject).
to eq("Re: Update email address - #{public_body.name}")
end
diff --git a/spec/models/public_body_heading_spec.rb b/spec/models/public_body_heading_spec.rb
index ebd2d43ae7..5044d412fd 100644
--- a/spec/models/public_body_heading_spec.rb
+++ b/spec/models/public_body_heading_spec.rb
@@ -24,7 +24,7 @@
it 'should require a unique name' do
heading = FactoryBot.create(:public_body_heading)
- new_heading = PublicBodyHeading.new(:name => heading.name)
+ new_heading = PublicBodyHeading.new(name: heading.name)
expect(new_heading).not_to be_valid
expect(new_heading.errors[:name]).to eq(["Name is already taken"])
end
@@ -61,8 +61,8 @@
it 'saves translations' do
heading = FactoryBot.build(:public_body_heading)
- heading.translations_attributes = { :es => { :locale => 'es',
- :name => 'El Heading' } }
+ heading.translations_attributes = { es: { locale: 'es',
+ name: 'El Heading' } }
heading.save!
expect(PublicBodyHeading.find(heading.id).translations.size).to eq(2)
@@ -76,16 +76,16 @@
it 'does not persist translations' do
heading = FactoryBot.create(:public_body_heading)
- heading.translations_attributes = { :es => { :locale => 'es',
- :name => 'El Heading' } }
+ heading.translations_attributes = { es: { locale: 'es',
+ name: 'El Heading' } }
expect(PublicBodyHeading.find(heading.id).translations.size).to eq(1)
end
it 'creates a new translation' do
heading = FactoryBot.create(:public_body_heading)
- heading.translations_attributes = { :es => { :locale => 'es',
- :name => 'El Heading' } }
+ heading.translations_attributes = { es: { locale: 'es',
+ name: 'El Heading' } }
heading.save!
heading.reload
expect(heading.name(:es)).to eq('El Heading')
@@ -93,30 +93,30 @@
it 'updates an existing translation' do
heading = FactoryBot.create(:public_body_heading)
- heading.translations_attributes = { 'es' => { :locale => 'es',
- :name => 'Name' } }
+ heading.translations_attributes = { 'es' => { locale: 'es',
+ name: 'Name' } }
heading.save!
- heading.translations_attributes = { 'es' => { :id => heading.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' } }
+ heading.translations_attributes = { 'es' => { id: heading.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' } }
heading.save!
expect(heading.name(:es)).to eq('Renamed')
end
it 'updates an existing translation and creates a new translation' do
heading = FactoryBot.create(:public_body_heading)
- heading.translations.create(:locale => 'es',
- :name => 'Los Heading')
+ heading.translations.create(locale: 'es',
+ name: 'Los Heading')
expect(heading.translations.size).to eq(2)
heading.translations_attributes = {
- 'es' => { :id => heading.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' },
- 'fr' => { :locale => 'fr',
- :name => 'Le Heading' }
+ 'es' => { id: heading.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' },
+ 'fr' => { locale: 'fr',
+ name: 'Le Heading' }
}
expect(heading.translations.size).to eq(3)
@@ -130,16 +130,16 @@
it 'skips empty translations' do
heading = FactoryBot.create(:public_body_heading)
- heading.translations.create(:locale => 'es',
- :name => 'Los Heading')
+ heading.translations.create(locale: 'es',
+ name: 'Los Heading')
expect(heading.translations.size).to eq(2)
heading.translations_attributes = {
- 'es' => { :id => heading.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' },
- 'fr' => { :locale => 'fr' }
+ 'es' => { id: heading.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' },
+ 'fr' => { locale: 'fr' }
}
expect(heading.translations.size).to eq(2)
@@ -158,7 +158,7 @@
it 'is valid if all required attributes are assigned' do
translation = PublicBodyHeading::Translation.new(
- :locale => AlaveteliLocalization.default_locale
+ locale: AlaveteliLocalization.default_locale
)
expect(translation).to be_valid
end
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 72794056c8..aef83212ad 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -234,20 +234,20 @@
describe '#name' do
it 'is invalid when nil' do
- subject = described_class.new(:name => nil)
+ subject = described_class.new(name: nil)
subject.valid?
expect(subject.errors[:name]).to eq(["Name can't be blank"])
end
it 'is invalid when blank' do
- subject = described_class.new(:name => '')
+ subject = described_class.new(name: '')
subject.valid?
expect(subject.errors[:name]).to eq(["Name can't be blank"])
end
it 'is invalid when not unique' do
existing = FactoryBot.create(:public_body)
- subject = described_class.new(:name => existing.name)
+ subject = described_class.new(name: existing.name)
subject.valid?
expect(subject.errors[:name]).to eq(["Name is already taken"])
end
@@ -257,14 +257,14 @@
describe '#short_name' do
it 'is invalid when not unique' do
- existing = FactoryBot.create(:public_body, :short_name => 'xyz')
- subject = described_class.new(:short_name => existing.short_name)
+ existing = FactoryBot.create(:public_body, short_name: 'xyz')
+ subject = described_class.new(short_name: existing.short_name)
subject.valid?
expect(subject.errors[:short_name]).to eq(["Short name is already taken"])
end
it 'is valid when blank' do
- subject = described_class.new(:short_name => '')
+ subject = described_class.new(short_name: '')
subject.valid?
expect(subject.errors[:short_name]).to be_empty
end
@@ -274,7 +274,7 @@
describe '#request_email' do
it 'is invalid when nil' do
- subject = described_class.new(:request_email => nil)
+ subject = described_class.new(request_email: nil)
subject.valid?
expect(subject.errors[:request_email]).
to eq(["Request email can't be nil"])
@@ -284,7 +284,7 @@
subject(:public_body) do
FactoryBot.build(:public_body,
- :request_email => "request@example.com")
+ request_email: "request@example.com")
end
it "should return the set email address" do
@@ -303,7 +303,7 @@
context "when no email is set" do
subject(:public_body) do
- FactoryBot.build(:public_body, :request_email => "")
+ FactoryBot.build(:public_body, request_email: "")
end
it "should return a blank email address" do
@@ -320,14 +320,14 @@
end
it 'is invalid with an unrequestable email' do
- subject = PublicBody.new(:request_email => 'invalid@')
+ subject = PublicBody.new(request_email: 'invalid@')
subject.valid?
expect(subject.errors[:request_email]).
to eq(["Request email doesn't look like a valid email address"])
end
it 'is valid with a requestable email' do
- subject = PublicBody.new(:request_email => 'valid@example.com')
+ subject = PublicBody.new(request_email: 'valid@example.com')
subject.valid?
expect(subject.errors[:request_email]).to be_empty
end
@@ -337,7 +337,7 @@
describe '#version' do
it 'ignores manually set attributes' do
- subject = FactoryBot.build(:public_body, :version => 21)
+ subject = FactoryBot.build(:public_body, version: 21)
subject.save!
expect(subject.version).to eq(1)
end
@@ -347,31 +347,31 @@
describe '#url_name' do
it 'is invalid when nil' do
- subject = PublicBody.new(:url_name => nil)
+ subject = PublicBody.new(url_name: nil)
subject.valid?
expect(subject.errors[:url_name]).to eq(["URL name can't be blank"])
end
it 'is invalid when blank' do
- subject = PublicBody.new(:url_name => '')
+ subject = PublicBody.new(url_name: '')
subject.valid?
expect(subject.errors[:url_name]).to eq(["URL name can't be blank"])
end
it 'is invalid when not unique' do
- existing = FactoryBot.create(:public_body, :url_name => 'xyz')
- subject = described_class.new(:url_name => existing.url_name)
+ existing = FactoryBot.create(:public_body, url_name: 'xyz')
+ subject = described_class.new(url_name: existing.url_name)
subject.valid?
expect(subject.errors[:url_name]).to eq(["URL name is already taken"])
end
it 'replaces spaces and makes lower case' do
- subject = PublicBody.new(:name => 'Some Authority')
+ subject = PublicBody.new(name: 'Some Authority')
expect(subject.url_name).to eq('some_authority')
end
it 'does not allow a numeric name' do
- subject = PublicBody.new(:name => '1234')
+ subject = PublicBody.new(name: '1234')
expect(subject.url_name).to eq('body')
end
@@ -394,13 +394,13 @@
context 'short_name has been set' do
it 'does not update the url_name when name is changed' do
- subject = PublicBody.new(:short_name => 'Test Name')
+ subject = PublicBody.new(short_name: 'Test Name')
subject.name = 'Some Authority'
expect(subject.url_name).to eq('test_name')
end
it 'updates the url_name when short_name is changed' do
- subject = PublicBody.new(:short_name => 'Test Name')
+ subject = PublicBody.new(short_name: 'Test Name')
subject.short_name = 'Short Name'
expect(subject.url_name).to eq('short_name')
end
@@ -417,13 +417,13 @@
end
it 'gets set on save' do
- subject = FactoryBot.build(:public_body, :name => 'Body')
+ subject = FactoryBot.build(:public_body, name: 'Body')
subject.save!
expect(subject.first_letter).to eq('B')
end
it 'gets updated on save' do
- subject = FactoryBot.create(:public_body, :name => 'Body')
+ subject = FactoryBot.create(:public_body, name: 'Body')
subject.name = 'Authority'
expect(subject.first_letter).to eq('B')
subject.save!
@@ -431,13 +431,13 @@
end
it 'sets the first letter to a multibyte character' do
- subject = FactoryBot.build(:public_body, :name => 'åccents')
+ subject = FactoryBot.build(:public_body, name: 'åccents')
subject.save!
expect(subject.first_letter).to eq('Å')
end
it 'should save the first letter of a translation' do
- subject = FactoryBot.build(:public_body, :name => 'Body')
+ subject = FactoryBot.build(:public_body, name: 'Body')
AlaveteliLocalization.with_locale(:es) do
subject.name = 'Prueba body'
subject.save!
@@ -447,7 +447,7 @@
it 'saves the first letter of a translation, even when it is the same as the
first letter in the default locale' do
- subject = FactoryBot.build(:public_body, :name => 'Body')
+ subject = FactoryBot.build(:public_body, name: 'Body')
AlaveteliLocalization.with_locale(:es) do
subject.name = 'Body ES'
subject.save!
@@ -482,28 +482,28 @@
describe '#last_edit_editor' do
it 'is invalid when nil' do
- subject = PublicBody.new(:last_edit_editor => nil)
+ subject = PublicBody.new(last_edit_editor: nil)
subject.valid?
expect(subject.errors[:last_edit_editor]).
to eq(["Last edit editor can't be blank"])
end
it 'is invalid when blank' do
- subject = PublicBody.new(:last_edit_editor => '')
+ subject = PublicBody.new(last_edit_editor: '')
subject.valid?
expect(subject.errors[:last_edit_editor]).
to eq(["Last edit editor can't be blank"])
end
it 'is invalid when over 255 characters' do
- subject = PublicBody.new(:last_edit_editor => 'x' * 256)
+ subject = PublicBody.new(last_edit_editor: 'x' * 256)
subject.valid?
expect(subject.errors[:last_edit_editor]).
to eq(["Last edit editor can't be longer than 255 characters"])
end
it 'is valid up to 255 characters' do
- subject = PublicBody.new(:last_edit_editor => 'x' * 255)
+ subject = PublicBody.new(last_edit_editor: 'x' * 255)
subject.valid?
expect(subject.errors[:last_edit_editor]).to be_empty
end
@@ -513,13 +513,13 @@
describe '#last_edit_comment' do
it 'is valid when nil' do
- subject = PublicBody.new(:last_edit_comment => nil)
+ subject = PublicBody.new(last_edit_comment: nil)
subject.valid?
expect(subject.errors[:last_edit_comment]).to be_empty
end
it 'strips blank attributes' do
- subject = FactoryBot.create(:public_body, :last_edit_comment => '')
+ subject = FactoryBot.create(:public_body, last_edit_comment: '')
expect(subject.last_edit_comment).to be_nil
end
@@ -528,13 +528,13 @@
describe '#home_page' do
it 'is valid when nil' do
- subject = PublicBody.new(:home_page => nil)
+ subject = PublicBody.new(home_page: nil)
subject.valid?
expect(subject.errors[:home_page]).to be_empty
end
it 'strips blank attributes' do
- subject = FactoryBot.create(:public_body, :home_page => '')
+ subject = FactoryBot.create(:public_body, home_page: '')
expect(subject.home_page).to be_nil
end
@@ -612,13 +612,13 @@
describe '#publication_scheme' do
it 'is valid when nil' do
- subject = PublicBody.new(:publication_scheme => nil)
+ subject = PublicBody.new(publication_scheme: nil)
subject.valid?
expect(subject.errors[:publication_scheme]).to be_empty
end
it 'strips blank attributes' do
- subject = FactoryBot.create(:public_body, :publication_scheme => '')
+ subject = FactoryBot.create(:public_body, publication_scheme: '')
expect(subject.publication_scheme).to be_nil
end
@@ -627,13 +627,13 @@
describe '#disclosure_log' do
it 'is valid when nil' do
- subject = PublicBody.new(:disclosure_log => nil)
+ subject = PublicBody.new(disclosure_log: nil)
subject.valid?
expect(subject.errors[:disclosure_log]).to be_empty
end
it 'strips blank attributes' do
- subject = FactoryBot.create(:public_body, :disclosure_log => '')
+ subject = FactoryBot.create(:public_body, disclosure_log: '')
expect(subject.disclosure_log).to be_nil
end
@@ -645,16 +645,16 @@
it 'does not persist translations' do
body = FactoryBot.create(:public_body)
- body.translations_attributes = { :es => { :locale => 'es',
- :name => 'El Body' } }
+ body.translations_attributes = { es: { locale: 'es',
+ name: 'El Body' } }
expect(PublicBody.find(body.id).translations.size).to eq(1)
end
it 'creates a new translation' do
body = FactoryBot.create(:public_body)
- body.translations_attributes = { :es => { :locale => 'es',
- :name => 'El Body' } }
+ body.translations_attributes = { es: { locale: 'es',
+ name: 'El Body' } }
body.save!
body.reload
expect(body.name(:es)).to eq('El Body')
@@ -662,30 +662,30 @@
it 'updates an existing translation' do
body = FactoryBot.create(:public_body)
- body.translations_attributes = { 'es' => { :locale => 'es',
- :name => 'El Body' } }
+ body.translations_attributes = { 'es' => { locale: 'es',
+ name: 'El Body' } }
body.save!
- body.translations_attributes = { 'es' => { :id => body.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' } }
+ body.translations_attributes = { 'es' => { id: body.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' } }
body.save!
expect(body.name(:es)).to eq('Renamed')
end
it 'updates an existing translation and creates a new translation' do
body = FactoryBot.create(:public_body)
- body.translations.create(:locale => 'es',
- :name => 'El Body')
+ body.translations.create(locale: 'es',
+ name: 'El Body')
expect(body.translations.size).to eq(2)
body.translations_attributes = {
- 'es' => { :id => body.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' },
- 'fr' => { :locale => 'fr',
- :name => 'Le Body' }
+ 'es' => { id: body.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' },
+ 'fr' => { locale: 'fr',
+ name: 'Le Body' }
}
expect(body.translations.size).to eq(3)
@@ -699,16 +699,16 @@
it 'skips empty translations' do
body = FactoryBot.create(:public_body)
- body.translations.create(:locale => 'es',
- :name => 'El Body')
+ body.translations.create(locale: 'es',
+ name: 'El Body')
expect(body.translations.size).to eq(2)
body.translations_attributes = {
- 'es' => { :id => body.translation_for(:es).id,
- :locale => 'es',
- :name => 'Renamed' },
- 'fr' => { :locale => 'fr' }
+ 'es' => { id: body.translation_for(:es).id,
+ locale: 'es',
+ name: 'Renamed' },
+ 'fr' => { locale: 'fr' }
}
expect(body.translations.size).to eq(2)
@@ -727,7 +727,7 @@
it 'does not overwrite an existing API key' do
allow(SecureRandom).to receive(:base64).and_return('APIKEY')
- body = PublicBody.new(:api_key => 'EXISTING')
+ body = PublicBody.new(api_key: 'EXISTING')
body.set_api_key
expect(body.api_key).to eq('EXISTING')
end
@@ -745,7 +745,7 @@
it 'overwrites an existing API key' do
allow(SecureRandom).to receive(:base64).and_return('APIKEY')
- body = PublicBody.new(:api_key => 'EXISTING')
+ body = PublicBody.new(api_key: 'EXISTING')
body.set_api_key!
expect(body.api_key).to eq('APIKEY')
end
@@ -772,12 +772,12 @@
describe '#short_or_long_name' do
it 'returns the short_name if it has been set' do
- public_body = PublicBody.new(:name => 'Test Name', :short_name => "Test")
+ public_body = PublicBody.new(name: 'Test Name', short_name: "Test")
expect(public_body.short_or_long_name).to eq('Test')
end
it 'returns the name if short_name has not been set' do
- public_body = PublicBody.new(:name => 'Test Name')
+ public_body = PublicBody.new(name: 'Test Name')
expect(public_body.short_or_long_name).to eq('Test Name')
end
@@ -786,7 +786,7 @@
describe '#set_first_letter' do
it 'sets first_letter to the first letter of the name if the name is set' do
- public_body = PublicBody.new(:name => 'Test Name')
+ public_body = PublicBody.new(name: 'Test Name')
public_body.set_first_letter
expect(public_body.first_letter).to eq('T')
end
@@ -798,13 +798,13 @@
end
it 'handles mutlibyte characters correctly' do
- public_body = PublicBody.new(:name => 'Åccented')
+ public_body = PublicBody.new(name: 'Åccented')
public_body.set_first_letter
expect(public_body.first_letter).to eq('Å')
end
it 'upcases the first character' do
- public_body = PublicBody.new(:name => 'åccented')
+ public_body = PublicBody.new(name: 'åccented')
public_body.set_first_letter
expect(public_body.first_letter).to eq('Å')
end
@@ -954,38 +954,38 @@
let(:public_body) do
FactoryBot.create(:public_body,
- :name => 'Marmot Appreciation Society',
- :short_name => 'MAS',
- :request_email => 'marmots@flourish.org',
- :last_edit_editor => 'test',
- :last_edit_comment => '',
- :info_requests_count => 10,
- :info_requests_successful_count => 2,
- :info_requests_not_held_count => 2,
- :info_requests_overdue_count => 3,
- :info_requests_visible_classified_count => 3)
+ name: 'Marmot Appreciation Society',
+ short_name: 'MAS',
+ request_email: 'marmots@flourish.org',
+ last_edit_editor: 'test',
+ last_edit_comment: '',
+ info_requests_count: 10,
+ info_requests_successful_count: 2,
+ info_requests_not_held_count: 2,
+ info_requests_overdue_count: 3,
+ info_requests_visible_classified_count: 3)
end
it 'should return info about request counts' do
expect(public_body.json_for_api).
to eq(
{
- :name => 'Marmot Appreciation Society',
- :notes => "",
- :publication_scheme => "",
- :short_name => "MAS",
- :tags => [],
- :updated_at => public_body.updated_at,
- :url_name => "mas",
- :created_at => public_body.created_at,
- :home_page => "http://www.flourish.org",
- :id => public_body.id,
- :info => {
- :requests_count => 10,
- :requests_successful_count => 2,
- :requests_not_held_count => 2,
- :requests_overdue_count => 3,
- :requests_visible_classified_count => 3,
+ name: 'Marmot Appreciation Society',
+ notes: "",
+ publication_scheme: "",
+ short_name: "MAS",
+ tags: [],
+ updated_at: public_body.updated_at,
+ url_name: "mas",
+ created_at: public_body.created_at,
+ home_page: "http://www.flourish.org",
+ id: public_body.id,
+ info: {
+ requests_count: 10,
+ requests_successful_count: 2,
+ requests_not_held_count: 2,
+ requests_overdue_count: 3,
+ requests_visible_classified_count: 3,
}
})
end
@@ -996,11 +996,11 @@
RSpec.describe PublicBody, " using tags" do
before do
- @public_body = PublicBody.new(:name => 'Aardvark Monitoring Service',
- :short_name => 'AMS',
- :request_email => 'foo@flourish.org',
- :last_edit_editor => 'test',
- :last_edit_comment => '')
+ @public_body = PublicBody.new(name: 'Aardvark Monitoring Service',
+ short_name: 'AMS',
+ request_email: 'foo@flourish.org',
+ last_edit_editor: 'test',
+ last_edit_comment: '')
end
it 'should correctly convert a tag string into tags' do
@@ -1052,11 +1052,11 @@
RSpec.describe PublicBody, " using machine tags" do
before do
- @public_body = PublicBody.new(:name => 'Aardvark Monitoring Service',
- :short_name => 'AMS',
- :request_email => 'foo@flourish.org',
- :last_edit_editor => 'test',
- :last_edit_comment => '')
+ @public_body = PublicBody.new(name: 'Aardvark Monitoring Service',
+ short_name: 'AMS',
+ request_email: 'foo@flourish.org',
+ last_edit_editor: 'test',
+ last_edit_comment: '')
end
it 'should parse machine tags' do
@@ -1138,9 +1138,9 @@ def set_default_attributes(public_body)
end
it 'should create a url_name for a translation' do
- existing = FactoryBot.create(:public_body, :first_letter => 'T', :short_name => 'Test body')
+ existing = FactoryBot.create(:public_body, first_letter: 'T', short_name: 'Test body')
AlaveteliLocalization.with_locale(:es) do
- existing.update :short_name => 'Prueba', :name => 'Prueba body'
+ existing.update short_name: 'Prueba', name: 'Prueba body'
expect(existing.url_name).to eq('prueba')
end
end
@@ -1277,22 +1277,22 @@ def set_default_attributes(public_body)
it 'should destroy the public_body' do
public_body.destroy
- expect(PublicBody.where(:id => public_body.id)).to be_empty
+ expect(PublicBody.where(id: public_body.id)).to be_empty
end
it 'should destroy the associated track_things' do
FactoryBot.create(:public_body_track,
- :public_body => public_body,
- :track_medium => 'email_daily',
- :track_query => 'test')
+ public_body: public_body,
+ track_medium: 'email_daily',
+ track_query: 'test')
public_body.destroy
- expect(TrackThing.where(:public_body_id => public_body.id)).to be_empty
+ expect(TrackThing.where(public_body_id: public_body.id)).to be_empty
end
it 'should destroy the associated censor_rules' do
- FactoryBot.create(:censor_rule, :public_body => public_body)
+ FactoryBot.create(:censor_rule, public_body: public_body)
public_body.destroy
- expect(CensorRule.where(:public_body_id => public_body.id)).to be_empty
+ expect(CensorRule.where(public_body_id: public_body.id)).to be_empty
end
it 'destroys associated translations' do
@@ -1300,15 +1300,15 @@ def set_default_attributes(public_body)
public_body.name = 'El Translation'
public_body.save!
end
- expect(PublicBody::Translation.where(:public_body_id => public_body.id)).
+ expect(PublicBody::Translation.where(public_body_id: public_body.id)).
to_not be_empty
public_body.destroy
- expect(PublicBody::Translation.where(:public_body_id => public_body.id)).
+ expect(PublicBody::Translation.where(public_body_id: public_body.id)).
to be_empty
end
it 'should raise an error if there are associated info_requests' do
- FactoryBot.create(:info_request, :public_body => public_body)
+ FactoryBot.create(:info_request, public_body: public_body)
public_body.reload
expect { public_body.destroy }.to raise_error(ActiveRecord::InvalidForeignKey)
end
@@ -1502,7 +1502,7 @@ def set_default_attributes(public_body)
context 'an existing body without tags' do
before do
- @body = FactoryBot.create(:public_body, :name => 'Existing Body')
+ @body = FactoryBot.create(:public_body, name: 'Existing Body')
end
it 'will not import if there is an existing body without the tag' do
@@ -1523,7 +1523,7 @@ def set_default_attributes(public_body)
context 'an existing body with tags' do
before do
- @body = FactoryBot.create(:public_body, :tag_string => 'imported first_tag second_tag')
+ @body = FactoryBot.create(:public_body, tag_string: 'imported first_tag second_tag')
end
it 'created with tags, different tags in csv, add import tag' do
@@ -1676,7 +1676,7 @@ def set_default_attributes(public_body)
describe 'with an existing body with tags' do
before do
- @body = FactoryBot.create(:public_body, :tag_string => 'first_tag second_tag')
+ @body = FactoryBot.create(:public_body, tag_string: 'first_tag second_tag')
end
it 'created with tags, different tags in csv, add tags' do
@@ -1940,7 +1940,7 @@ def set_default_attributes(public_body)
describe '#site_administration?' do
it 'is true when the body has the site_administration tag' do
- p = FactoryBot.build(:public_body, :tag_string => 'site_administration')
+ p = FactoryBot.build(:public_body, tag_string: 'site_administration')
expect(p.site_administration?).to be true
end
@@ -1954,7 +1954,7 @@ def set_default_attributes(public_body)
describe '#has_request_email?' do
before do
- @body = PublicBody.new(:request_email => 'test@example.com')
+ @body = PublicBody.new(request_email: 'test@example.com')
end
it 'should return false if request_email is nil' do
@@ -2135,7 +2135,7 @@ def set_default_attributes(public_body)
describe '#is_requestable?' do
before do
- @body = PublicBody.new(:request_email => 'test@example.com')
+ @body = PublicBody.new(request_email: 'test@example.com')
end
it 'should return false if the body is defunct' do
@@ -2193,7 +2193,7 @@ def set_default_attributes(public_body)
describe '#is_followupable?' do
before do
- @body = PublicBody.new(:request_email => 'test@example.com')
+ @body = PublicBody.new(request_email: 'test@example.com')
end
it 'should return false there is no request_email' do
@@ -2210,7 +2210,7 @@ def set_default_attributes(public_body)
describe '#not_requestable_reason' do
before do
- @body = PublicBody.new(:request_email => 'test@example.com')
+ @body = PublicBody.new(request_email: 'test@example.com')
end
it 'should return "defunct" if the body is defunct' do
@@ -2338,7 +2338,7 @@ def set_default_attributes(public_body)
it 'is valid if all required attributes are assigned' do
translation = PublicBody::Translation.new(
- :locale => AlaveteliLocalization.default_locale
+ locale: AlaveteliLocalization.default_locale
)
expect(translation).to be_valid
end
@@ -2379,9 +2379,9 @@ def set_default_attributes(public_body)
public_body.request_email = 'new@example.com'
public_body.save!
current = public_body.versions.latest
- expected = { :name => "Request email",
- :from => "request@example.com",
- :to => "new@example.com" }
+ expected = { name: "Request email",
+ from: "request@example.com",
+ to: "new@example.com" }
expect(current.compare(current.previous)).to eq([ expected ])
end
@@ -2420,9 +2420,9 @@ def set_default_attributes(public_body)
public_body.request_email = 'new@example.com'
public_body.save!
current = public_body.versions.latest
- expected = { :name => "Request email",
- :from => "request@example.com",
- :to => "new@example.com" }
+ expected = { name: "Request email",
+ from: "request@example.com",
+ to: "new@example.com" }
expect { |b| current.compare(current.previous, &b) }.
to yield_with_args(expected)
end
diff --git a/spec/models/raw_email_spec.rb b/spec/models/raw_email_spec.rb
index 33a7fb8da0..bcd0829eb8 100644
--- a/spec/models/raw_email_spec.rb
+++ b/spec/models/raw_email_spec.rb
@@ -21,9 +21,9 @@ def roundtrip_data(raw_email, data)
describe '#valid_to_reply_to?' do
def test_email(result, email, empty_return_path, autosubmitted = nil)
- stubs = { :from_email => email,
- :empty_return_path? => empty_return_path,
- :auto_submitted? => autosubmitted }
+ stubs = { from_email: email,
+ empty_return_path?: empty_return_path,
+ auto_submitted?: autosubmitted }
raw_email = RawEmail.new
stubs.each do |method, value|
allow(raw_email).to receive(method).and_return(value)
diff --git a/spec/models/request_classification_spec.rb b/spec/models/request_classification_spec.rb
index eae832a122..e754bba676 100644
--- a/spec/models/request_classification_spec.rb
+++ b/spec/models/request_classification_spec.rb
@@ -19,9 +19,9 @@
before do
@user_one = FactoryBot.create(:user)
@user_two = FactoryBot.create(:user)
- FactoryBot.create(:request_classification, :user => @user_one)
- FactoryBot.create(:request_classification, :user => @user_one)
- FactoryBot.create(:request_classification, :user => @user_two)
+ FactoryBot.create(:request_classification, user: @user_one)
+ FactoryBot.create(:request_classification, user: @user_one)
+ FactoryBot.create(:request_classification, user: @user_two)
end
it "returns a list of users' classifications with counts in descending order" do
diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb
index 54e0a07c98..6ca880e350 100644
--- a/spec/models/role_spec.rb
+++ b/spec/models/role_spec.rb
@@ -16,14 +16,14 @@
RSpec.describe Role do
it 'validates the role name is in the allowed roles' do
- role = Role.new(:name => 'test')
+ role = Role.new(name: 'test')
role.valid?
expect(role.errors[:name]).to eq(["is not included in the list"])
end
it 'validates the role is unique within the context of a resource_type' do
with_feature_enabled(:alaveteli_pro) do
- role = Role.new(:name => 'pro')
+ role = Role.new(name: 'pro')
role.valid?
expect(role.errors[:name]).to eq(["has already been taken"])
end
diff --git a/spec/models/spam_address_spec.rb b/spec/models/spam_address_spec.rb
index 31fce00479..fdc744b668 100644
--- a/spec/models/spam_address_spec.rb
+++ b/spec/models/spam_address_spec.rb
@@ -18,12 +18,12 @@
it 'requres an email address' do
expect(SpamAddress.new).not_to be_valid
- expect(SpamAddress.new(:email => 'spam@example.org')).to be_valid
+ expect(SpamAddress.new(email: 'spam@example.org')).to be_valid
end
it 'must have a unique email address' do
existing = FactoryBot.create(:spam_address)
- expect(SpamAddress.new(:email => existing.email)).not_to be_valid
+ expect(SpamAddress.new(email: existing.email)).not_to be_valid
end
end
diff --git a/spec/models/statistics_spec.rb b/spec/models/statistics_spec.rb
index 92ae3e6dff..56bf3a3292 100644
--- a/spec/models/statistics_spec.rb
+++ b/spec/models/statistics_spec.rb
@@ -32,12 +32,12 @@
to_draw = Statistics.simplify_stats_for_graphs(raw_count_data,
column='blah_blah',
percentages=false,
- {:highest => true} )
+ {highest: true} )
expect(to_draw['id']).to eq("blah_blah-highest")
to_draw = Statistics.simplify_stats_for_graphs(raw_count_data,
column='blah_blah',
percentages=false,
- {:highest => false} )
+ {highest: false} )
expect(to_draw['id']).to eq("blah_blah-lowest")
end
diff --git a/spec/models/track_thing_spec.rb b/spec/models/track_thing_spec.rb
index 5b061c8eed..8a70ca0426 100644
--- a/spec/models/track_thing_spec.rb
+++ b/spec/models/track_thing_spec.rb
@@ -84,12 +84,12 @@
it "should destroy the track_thing" do
track_thing.destroy
- expect(TrackThing.where(:id => track_thing.id)).to be_empty
+ expect(TrackThing.where(id: track_thing.id)).to be_empty
end
it "should destroy related track_things_sent_emails" do
- TrackThingsSentEmail.create(:track_thing => track_thing)
+ TrackThingsSentEmail.create(track_thing: track_thing)
track_thing.destroy
- expect(TrackThingsSentEmail.where(:track_thing_id => track_thing.id)).to be_empty
+ expect(TrackThingsSentEmail.where(track_thing_id: track_thing.id)).to be_empty
end
end
diff --git a/spec/models/user/transaction_calculator_spec.rb b/spec/models/user/transaction_calculator_spec.rb
index 31ab53aa70..390a43cf11 100644
--- a/spec/models/user/transaction_calculator_spec.rb
+++ b/spec/models/user/transaction_calculator_spec.rb
@@ -19,14 +19,14 @@
it 'allows a list of custom transaction associations' do
list = [:comments, :info_requests]
- calc = described_class.new(user, :transaction_associations => list)
+ calc = described_class.new(user, transaction_associations: list)
expect(calc.transaction_associations).to eq(list)
end
it 'raises an error if a transaction association is invalid' do
list = [:invalid_method, :info_requests]
expect {
- described_class.new(user, :transaction_associations => list)
+ described_class.new(user, transaction_associations: list)
}.to raise_error(NoMethodError)
end
@@ -46,8 +46,8 @@
it 'sums the total transactions made by the user' do
3.times do
- FactoryBot.create(:comment, :user => user)
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:comment, user: user)
+ FactoryBot.create(:info_request, user: user)
end
expect(subject.total).to eq(6)
end
@@ -58,16 +58,16 @@
it 'sums the total transactions made by the user during the range' do
travel_to(1.year.ago) do
- FactoryBot.create(:comment, :user => user)
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:comment, user: user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(3.days.ago) do
- FactoryBot.create(:comment, :user => user)
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:comment, user: user)
+ FactoryBot.create(:info_request, user: user)
end
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
expect(subject.total(10.days.ago..1.day.ago)).to eq(2)
end
@@ -78,15 +78,15 @@
it ':last_7_days sums the total transactions made by the user in the last 7 days' do
travel_to(8.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(7.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(6.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
expect(subject.total(:last_7_days)).to eq(2)
@@ -94,15 +94,15 @@
it ':last_30_days sums the total transactions made by the user in the last 30 days' do
travel_to(31.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(30.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(29.days.ago) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
expect(subject.total(:last_30_days)).to eq(2)
@@ -110,19 +110,19 @@
it ':last_quarter sums the total transactions made by the user in the last quarter' do
travel_to(Time.zone.parse('2014-12-31')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(Time.zone.parse('2015-01-01')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(Time.zone.parse('2015-03-31')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(Time.zone.parse('2015-04-01')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(Time.zone.parse('2015-04-01')) do
@@ -147,19 +147,19 @@
it 'returns a hash containing the total transactions grouped by month' do
travel_to(Time.zone.parse('2016-01-05')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
travel_to(Time.zone.parse('2016-01-05')) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2016-01-05') + 1.hour) do
- FactoryBot.create(:info_request, :user => user)
+ FactoryBot.create(:info_request, user: user)
end
travel_to(Time.zone.parse('2016-03-06')) do
- FactoryBot.create(:comment, :user => user)
+ FactoryBot.create(:comment, user: user)
end
expect(subject.total_per_month).
@@ -176,11 +176,11 @@
travel_back
travel_to(Time.zone.parse('2016-02-01')) do
- 3.times { FactoryBot.create(:comment, :user => user) }
+ 3.times { FactoryBot.create(:comment, user: user) }
end
travel_to(Time.zone.parse('2016-04-01')) do
- 3.times { FactoryBot.create(:comment, :user => user) }
+ 3.times { FactoryBot.create(:comment, user: user) }
end
subject = described_class.new(user)
@@ -201,8 +201,8 @@
it 'returns true if the transactions are in a different order' do
list1 = [:comments, :info_requests]
list2 = [:info_requests, :comments]
- calc1 = described_class.new(user, :transaction_associations => list1)
- calc2 = described_class.new(user, :transaction_associations => list2)
+ calc1 = described_class.new(user, transaction_associations: list1)
+ calc2 = described_class.new(user, transaction_associations: list2)
expect(calc1).to eq(calc2)
end
@@ -213,8 +213,8 @@
it 'returns false if the transactions are different' do
list1 = [:comments, :info_requests]
list2 = [:comments]
- calc1 = described_class.new(user, :transaction_associations => list1)
- calc2 = described_class.new(user, :transaction_associations => list2)
+ calc1 = described_class.new(user, transaction_associations: list1)
+ calc2 = described_class.new(user, transaction_associations: list2)
expect(calc1).not_to eq(calc2)
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index bd31f5fdbc..9b0b7cb7f0 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -62,19 +62,19 @@
RSpec.describe User, "banning the user" do
it 'does not change the URL name' do
- user = FactoryBot.create(:user, :name => 'nasty user 123')
- user.update(:ban_text => 'You are banned')
+ user = FactoryBot.create(:user, name: 'nasty user 123')
+ user.update(ban_text: 'You are banned')
expect(user.url_name).to eq('nasty_user_123')
end
it 'does not change the stored name' do
- user = FactoryBot.create(:user, :name => 'nasty user 123')
- user.update(:ban_text => 'You are banned')
+ user = FactoryBot.create(:user, name: 'nasty user 123')
+ user.update(ban_text: 'You are banned')
expect(user.read_attribute(:name)).to eq('nasty user 123')
end
it 'appends a message to the name' do
- user = FactoryBot.build(:user, :name => 'nasty user', :ban_text => 'banned')
+ user = FactoryBot.build(:user, name: 'nasty user', ban_text: 'banned')
expect(user.name).to eq('nasty user (Account suspended)')
end
@@ -458,7 +458,7 @@ def create_user(options = {})
it "should attach it to the user" do
data = load_file_fixture("parrot.png")
- profile_photo = ProfilePhoto.new(:data => data)
+ profile_photo = ProfilePhoto.new(data: data)
@user.set_profile_photo(profile_photo)
expect(profile_photo.user).to eq(@user)
end
@@ -649,12 +649,12 @@ def create_user(options = {})
end
it 'is true if the user is an admin' do
- admin = double(:is_admin? => true)
+ admin = double(is_admin?: true)
expect(User.stay_logged_in_on_redirect?(admin)).to eq(true)
end
it 'is false if the user is not an admin' do
- user = double(:is_admin? => false)
+ user = double(is_admin?: false)
expect(User.stay_logged_in_on_redirect?(user)).to eq(false)
end
@@ -701,7 +701,7 @@ def create_user(options = {})
user = User.new
calculator =
User::TransactionCalculator.
- new(user, :transaction_associations => [:comments, :info_requests])
+ new(user, transaction_associations: [:comments, :info_requests])
expect(user.transactions(:comments, :info_requests)).to eq(calculator)
end
@@ -724,65 +724,65 @@ def create_user(options = {})
it 'destroys any associated info_requests' do
info_request = FactoryBot.create(:info_request)
info_request.user.reload.destroy
- expect(InfoRequest.where(:id => info_request.id)).to be_empty
+ expect(InfoRequest.where(id: info_request.id)).to be_empty
end
it 'destroys any associated user_info_request_sent_alerts' do
info_request = FactoryBot.create(:info_request)
- alert = user.user_info_request_sent_alerts.build(:info_request => info_request,
- :alert_type => 'overdue_1')
+ alert = user.user_info_request_sent_alerts.build(info_request: info_request,
+ alert_type: 'overdue_1')
user.destroy
- expect(UserInfoRequestSentAlert.where(:id => alert.id)).to be_empty
+ expect(UserInfoRequestSentAlert.where(id: alert.id)).to be_empty
end
it 'destroys any associated post_redirects' do
- post_redirect = PostRedirect.create(:uri => '/',
- :user_id => user.id)
+ post_redirect = PostRedirect.create(uri: '/',
+ user_id: user.id)
user.destroy
- expect(PostRedirect.where(:id => post_redirect.id)).to be_empty
+ expect(PostRedirect.where(id: post_redirect.id)).to be_empty
end
it 'destroys any associated track_things' do
track_thing = FactoryBot.create(:search_track)
track_thing.tracking_user.destroy
- expect(TrackThing.where(:id => track_thing.id)).to be_empty
+ expect(TrackThing.where(id: track_thing.id)).to be_empty
end
it 'destroys any associated comments' do
comment = FactoryBot.create(:comment)
comment.user.destroy
- expect(Comment.where(:id => comment.id)).to be_empty
+ expect(Comment.where(id: comment.id)).to be_empty
end
it 'destroys any associated public_body_change_requests' do
change_request = FactoryBot.create(:add_body_request)
change_request.user.destroy
- expect(PublicBodyChangeRequest.where(:id => change_request.id))
+ expect(PublicBodyChangeRequest.where(id: change_request.id))
.to be_empty
end
it 'destroys any associated profile_photos' do
- profile_photo = user.create_profile_photo(:data => 'xxx')
+ profile_photo = user.create_profile_photo(data: 'xxx')
user.destroy
- expect(ProfilePhoto.where(:id => profile_photo.id)).to be_empty
+ expect(ProfilePhoto.where(id: profile_photo.id)).to be_empty
end
it 'destroys any associated censor_rules' do
censor_rule = FactoryBot.create(:user_censor_rule)
censor_rule.user.destroy
- expect(CensorRule.where(:id => censor_rule.id)).to be_empty
+ expect(CensorRule.where(id: censor_rule.id)).to be_empty
end
it 'destroys any associated info_request_batches' do
info_request_batch = FactoryBot.create(:info_request_batch)
info_request_batch.user.destroy
- expect(InfoRequestBatch.where(:id => info_request_batch.id)).to be_empty
+ expect(InfoRequestBatch.where(id: info_request_batch.id)).to be_empty
end
it 'destroys any associated request_classifications' do
request_classification = FactoryBot.create(:request_classification)
request_classification.user.destroy
- expect(RequestClassification.where(:id => request_classification.id))
+ expect(RequestClassification.where(id: request_classification.id))
.to be_empty
end
@@ -902,7 +902,7 @@ def create_user(options = {})
end
it 'can be enabled on initialization' do
- user = User.new(:otp_enabled => true)
+ user = User.new(otp_enabled: true)
expect(user.otp_enabled).to eq(true)
end
@@ -917,33 +917,33 @@ def create_user(options = {})
describe '#otp_enabled?' do
it 'requires an otp_secret_key to be enabled' do
- attrs = { :otp_enabled => true,
- :otp_secret_key => nil,
- :otp_counter => 1 }
+ attrs = { otp_enabled: true,
+ otp_secret_key: nil,
+ otp_counter: 1 }
user = User.new(attrs)
expect(user.otp_enabled?).to eq(false)
end
it 'requires an otp_counter to be enabled' do
- attrs = { :otp_enabled => true,
- :otp_secret_key => '123',
- :otp_counter => nil }
+ attrs = { otp_enabled: true,
+ otp_secret_key: '123',
+ otp_counter: nil }
user = User.new(attrs)
expect(user.otp_enabled?).to eq(false)
end
it 'requires an otp_enabled to be true to be enabled' do
- attrs = { :otp_enabled => false,
- :otp_secret_key => '123',
- :otp_counter => 1 }
+ attrs = { otp_enabled: false,
+ otp_secret_key: '123',
+ otp_counter: 1 }
user = User.new(attrs)
expect(user.otp_enabled?).to eq(false)
end
it 'requires otp_enabled, otp_secret_key and otp_counter to be enabled' do
- attrs = { :otp_enabled => true,
- :otp_secret_key => '123',
- :otp_counter => 1 }
+ attrs = { otp_enabled: true,
+ otp_secret_key: '123',
+ otp_counter: 1 }
user = User.new(attrs)
expect(user.otp_enabled?).to eq(true)
end
@@ -953,13 +953,13 @@ def create_user(options = {})
describe '#enable_otp' do
it 'resets the otp_counter' do
- user = User.new(:otp_counter => 200)
+ user = User.new(otp_counter: 200)
user.enable_otp
expect(user.otp_counter).to eq(1)
end
it 'regenerates the otp_secret_key' do
- user = User.new(:otp_secret_key => '123')
+ user = User.new(otp_secret_key: '123')
user.enable_otp
expect(user.otp_secret_key.length).to eq(32)
end
@@ -980,13 +980,13 @@ def create_user(options = {})
describe '#disable_otp' do
it 'sets otp_enabled to false' do
- user = User.new(:otp_enabled => true)
+ user = User.new(otp_enabled: true)
user.disable_otp
expect(user.otp_enabled?).to eq(false)
end
it 'sets require_otp to false' do
- user = User.new(:otp_enabled => true)
+ user = User.new(otp_enabled: true)
user.require_otp = true
user.disable_otp
expect(user.require_otp?).to eq(false)
@@ -1007,7 +1007,7 @@ def create_user(options = {})
end
it 'returns the assigned boolean' do
- user = User.new(:require_otp => true)
+ user = User.new(require_otp: true)
expect(user.require_otp?).to eq(true)
end
@@ -1037,7 +1037,7 @@ def create_user(options = {})
end
it 'can be set on initialization' do
- user = User.new(:otp_counter => 200)
+ user = User.new(otp_counter: 200)
expect(user.otp_counter).to eq(200)
end
@@ -1053,7 +1053,7 @@ def create_user(options = {})
it 'can be set on initialization' do
key = User.otp_random_secret
- user = User.new(:otp_secret_key => key)
+ user = User.new(otp_secret_key: key)
expect(user.otp_secret_key).to eq(key)
end
@@ -1069,7 +1069,7 @@ def create_user(options = {})
describe '#entered_otp_code' do
it 'gets the virtual attribue for use in validation' do
- user = User.new(:entered_otp_code => '123456')
+ user = User.new(entered_otp_code: '123456')
expect(user.entered_otp_code).to eq('123456')
end
@@ -1088,12 +1088,12 @@ def create_user(options = {})
describe '#banned?' do
it 'is banned if the user has ban_text' do
- user = FactoryBot.build(:user, :ban_text => 'banned')
+ user = FactoryBot.build(:user, ban_text: 'banned')
expect(user).to be_banned
end
it 'is not banned if the user has no ban_text' do
- user = FactoryBot.build(:user, :ban_text => '')
+ user = FactoryBot.build(:user, ban_text: '')
expect(user).to_not be_banned
end
@@ -1326,25 +1326,25 @@ def create_user(options = {})
describe '#confirm' do
it 'confirms an unconfirmed user' do
- user = FactoryBot.build(:user, :email_confirmed => false)
+ user = FactoryBot.build(:user, email_confirmed: false)
user.confirm
expect(user.email_confirmed).to be(true)
end
it 'no-ops a confirmed user' do
- user = FactoryBot.build(:user, :email_confirmed => true)
+ user = FactoryBot.build(:user, email_confirmed: true)
user.confirm
expect(user.email_confirmed).to be(true)
end
it 'does not save by default' do
- user = FactoryBot.build(:user, :email_confirmed => false)
+ user = FactoryBot.build(:user, email_confirmed: false)
user.confirm
expect(user).to be_new_record
end
it 'saves the record if passed an argument' do
- user = FactoryBot.build(:user, :email_confirmed => false)
+ user = FactoryBot.build(:user, email_confirmed: false)
user.confirm(true)
expect(user).to be_persisted
end
@@ -1354,25 +1354,25 @@ def create_user(options = {})
describe '#confirm!' do
it 'confirms an unconfirmed user' do
- user = FactoryBot.build(:user, :email_confirmed => false)
+ user = FactoryBot.build(:user, email_confirmed: false)
user.confirm!
expect(user.reload.email_confirmed).to be(true)
end
it 'no-ops a confirmed user' do
- user = FactoryBot.build(:user, :email_confirmed => true)
+ user = FactoryBot.build(:user, email_confirmed: true)
user.confirm!
expect(user.reload.email_confirmed).to be(true)
end
it 'saves the record' do
- user = FactoryBot.build(:user, :email_confirmed => false)
+ user = FactoryBot.build(:user, email_confirmed: false)
user.confirm!
expect(user).to be_persisted
end
it 'it raises an error on save if the record is invalid' do
- user = FactoryBot.build(:user, :email => nil, :email_confirmed => false)
+ user = FactoryBot.build(:user, email: nil, email_confirmed: false)
expect { user.confirm! }.to raise_error(ActiveRecord::RecordInvalid)
end
@@ -1407,14 +1407,14 @@ def create_user(options = {})
describe '#about_me_already_exists?' do
it 'is true if the about_me text already exists for another user' do
- FactoryBot.create(:user, :about_me => '123')
- user = FactoryBot.build(:user, :about_me => '123')
+ FactoryBot.create(:user, about_me: '123')
+ user = FactoryBot.build(:user, about_me: '123')
expect(user.about_me_already_exists?).to eq(true)
end
it 'is false if the about_me text is unique to the user' do
- User.update_all(:about_me => '')
- user = FactoryBot.build(:user, :about_me => '123')
+ User.update_all(about_me: '')
+ user = FactoryBot.build(:user, about_me: '123')
expect(user.about_me_already_exists?).to eq(false)
end
@@ -1435,17 +1435,17 @@ def create_user(options = {})
describe '#indexed_by_search?' do
it 'is false if the user is unconfirmed' do
- user = User.new(:email_confirmed => false, :ban_text => '')
+ user = User.new(email_confirmed: false, ban_text: '')
expect(user.indexed_by_search?).to eq(false)
end
it 'is false if the user is banned' do
- user = User.new(:email_confirmed => true, :ban_text => 'banned')
+ user = User.new(email_confirmed: true, ban_text: 'banned')
expect(user.indexed_by_search?).to eq(false)
end
it 'is true if the user is confirmed and not banned' do
- user = User.new(:email_confirmed => true, :ban_text => '')
+ user = User.new(email_confirmed: true, ban_text: '')
expect(user.indexed_by_search?).to eq(true)
end
@@ -1506,15 +1506,15 @@ def create_user(options = {})
describe '.info_request_events' do
let(:user) { FactoryBot.create(:user) }
- let(:info_request) { FactoryBot.create(:info_request, :user => user) }
+ let(:info_request) { FactoryBot.create(:info_request, user: user) }
let!(:response_event) do
- FactoryBot.create(:response_event, :info_request => info_request)
+ FactoryBot.create(:response_event, info_request: info_request)
end
let!(:comment_event) do
- FactoryBot.create(:comment_event, :info_request => info_request)
+ FactoryBot.create(:comment_event, info_request: info_request)
end
let!(:resent_event) do
- FactoryBot.create(:resent_event, :info_request => info_request)
+ FactoryBot.create(:resent_event, info_request: info_request)
end
it "returns events in descending created_at order" do
diff --git a/spec/models/widget_vote_spec.rb b/spec/models/widget_vote_spec.rb
index 7575c1820e..faa2f6da65 100644
--- a/spec/models/widget_vote_spec.rb
+++ b/spec/models/widget_vote_spec.rb
@@ -35,8 +35,8 @@
it 'enforces uniqueness of cookie per info request' do
info_request = FactoryBot.create(:info_request)
- widget_vote = info_request.widget_votes.create(:cookie => 'x' * 20)
- duplicate_vote = info_request.widget_votes.build(:cookie => 'x' * 20)
+ widget_vote = info_request.widget_votes.create(cookie: 'x' * 20)
+ duplicate_vote = info_request.widget_votes.build(cookie: 'x' * 20)
expect(duplicate_vote).not_to be_valid
expect(duplicate_vote.errors[:cookie]).to eq(["has already been taken"])
end
@@ -44,8 +44,8 @@
it 'allows the same cookie to be used across info requests' do
info_request = FactoryBot.create(:info_request)
second_info_request = FactoryBot.create(:info_request)
- widget_vote = info_request.widget_votes.create(:cookie => 'x' * 20)
- second_request_vote = second_info_request.widget_votes.build(:cookie => 'x' * 20)
+ widget_vote = info_request.widget_votes.create(cookie: 'x' * 20)
+ second_request_vote = second_info_request.widget_votes.build(cookie: 'x' * 20)
expect(second_request_vote).to be_valid
end
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 8b6c3fb1c7..2e39e45aea 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -8,7 +8,7 @@
end
it "should search by name" do
- xapian_object = ActsAsXapian::Search.new([User], "Silly", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([User], "Silly", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(users(:silly_name_user))
end
@@ -16,7 +16,7 @@
it "should search by 'about me' text" do
user = users(:bob_smith_user)
- xapian_object = ActsAsXapian::Search.new([User], "stuff", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([User], "stuff", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(user)
@@ -24,10 +24,10 @@
user.save!
update_xapian_index
- xapian_object = ActsAsXapian::Search.new([User], "stuff", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([User], "stuff", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([User], "aardvark", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([User], "aardvark", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(user)
end
@@ -40,26 +40,26 @@
end
it "should search index the main name field" do
- xapian_object = ActsAsXapian::Search.new([PublicBody], "humpadinking", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "humpadinking", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(public_bodies(:humpadink_public_body))
end
it "should search index the notes field" do
- xapian_object = ActsAsXapian::Search.new([PublicBody], "albatross", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "albatross", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(public_bodies(:humpadink_public_body))
end
it "should delete public bodies from the index when they are destroyed" do
- xapian_object = ActsAsXapian::Search.new([PublicBody], "albatross", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "albatross", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(public_bodies(:humpadink_public_body))
public_bodies(:forlorn_public_body).destroy
update_xapian_index
- xapian_object = ActsAsXapian::Search.new([PublicBody], "lonely", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "lonely", limit: 100)
expect(xapian_object.results).to eq([])
end
@@ -73,13 +73,13 @@
end
it "should find requests to the body" do
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", limit: 100)
expect(xapian_object.results.size).to eq(PublicBody.find_by_url_name("tgq").info_requests.map(&:info_request_events).flatten.size)
end
it "should update index correctly when URL name of body changes" do
# initial search
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", limit: 100)
expect(xapian_object.results.size).to eq(PublicBody.find_by_url_name("tgq").info_requests.map(&:info_request_events).flatten.size)
models_found_before = xapian_object.results.map { |x| x[:model] }
@@ -91,9 +91,9 @@
update_xapian_index
# check we get results expected
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:gq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:gq", limit: 100)
expect(xapian_object.results.size).to eq(PublicBody.find_by_url_name("gq").info_requests.map(&:info_request_events).flatten.size)
models_found_after = xapian_object.results.map { |x| x[:model] }
@@ -111,11 +111,11 @@
update_xapian_index
# check we get results expected
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:tgq", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:gq", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:gq", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:#{body.url_name}", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_from:#{body.url_name}", limit: 100)
expect(xapian_object.results.size).to eq(public_bodies(:geraldine_public_body).info_requests.map(&:info_request_events).flatten.size)
models_found_after = xapian_object.results.map { |x| x[:model] }
end
@@ -128,9 +128,9 @@
end
it "should find requests from the user" do
- options = { :sort_by_prefix => 'created_at',
- :sort_by_ascending => true,
- :limit => 100}
+ options = { sort_by_prefix: 'created_at',
+ sort_by_ascending: true,
+ limit: 100}
xapian_object =
ActsAsXapian::Search.
@@ -148,9 +148,9 @@
end
it "should find just the sent message events from a particular user" do
- options = { :sort_by_prefix => 'created_at',
- :sort_by_ascending => true,
- :limit => 100 }
+ options = { sort_by_prefix: 'created_at',
+ sort_by_ascending: true,
+ limit: 100 }
xapian_object =
ActsAsXapian::Search.
@@ -180,10 +180,10 @@
update_xapian_index
- options = { :sort_by_prefix => 'created_at',
- :sort_by_ascending => true,
- :collapse_by_prefix => 'request_collapse',
- :limit => 100 }
+ options = { sort_by_prefix: 'created_at',
+ sort_by_ascending: true,
+ collapse_by_prefix: 'request_collapse',
+ limit: 100 }
xapian_object =
ActsAsXapian::Search.
@@ -192,7 +192,7 @@
results = xapian_object.results.map { |x| x[:model].info_request }
expect(results).
- to match_array(InfoRequest.where(:user_id => users(:bob_smith_user).id))
+ to match_array(InfoRequest.where(user_id: users(:bob_smith_user).id))
end
it "should not get confused searching for requests when one user has a name which has same stem as another" do
@@ -212,16 +212,16 @@
update_xapian_index
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_by:john_k", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_by:john_k", limit: 100)
expect(xapian_object.results.size).to eq(1)
expect(xapian_object.results[0][:model]).to eq(info_request_events(:silly_outgoing_message_event))
end
it "should update index correctly when URL name of user changes" do
# initial search
- options = { :sort_by_prefix => 'created_at',
- :sort_by_ascending => true,
- :limit => 100 }
+ options = { sort_by_prefix: 'created_at',
+ sort_by_ascending: true,
+ limit: 100 }
xapian_object =
ActsAsXapian::Search.
new([InfoRequestEvent], "requested_by:bob_smith", options)
@@ -246,10 +246,10 @@
update_xapian_index
# check we get results expected
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_by:bob_smith", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_by:bob_smith", limit: 100)
expect(xapian_object.results.size).to eq(0)
xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "requested_by:robert_smith",
- :sort_by_prefix => 'created_at', :sort_by_ascending => true, :limit => 100)
+ sort_by_prefix: 'created_at', sort_by_ascending: true, limit: 100)
models_found_after = xapian_object.results.map { |x| x[:model] }
expect(models_found_before).to eq(models_found_after)
end
@@ -262,13 +262,13 @@
end
it "should find requests from the user" do
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", limit: 100)
expect(xapian_object.results.size).to eq(1)
end
it "should update index correctly when URL name of user changes" do
# initial search
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", limit: 100)
expect(xapian_object.results.size).to eq(1)
models_found_before = xapian_object.results.map { |x| x[:model] }
@@ -280,9 +280,9 @@
update_xapian_index
# check we get results expected
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_emnameem", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_name", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "commented_by:silly_name", limit: 100)
expect(xapian_object.results.size).to eq(1)
models_found_after = xapian_object.results.map { |x| x[:model] }
@@ -297,7 +297,7 @@
end
it "should find events for the request" do
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:how_much_public_money_is_wasted_o", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:how_much_public_money_is_wasted_o", limit: 100)
expect(xapian_object.results.size).to eq(1)
xapian_object.results[0][:model] == info_request_events(:silly_outgoing_message_event)
end
@@ -311,9 +311,9 @@
update_xapian_index
# check we get results expected
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:how_much_public_money_is_wasted_o", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:how_much_public_money_is_wasted_o", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:really_naughty", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "request:really_naughty", limit: 100)
expect(xapian_object.results.size).to eq(1)
xapian_object.results[0][:model] == info_request_events(:silly_outgoing_message_event)
end
@@ -331,11 +331,11 @@
ir.save!
update_xapian_index
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "tag:bunnyrabbit", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "tag:bunnyrabbit", limit: 100)
expect(xapian_object.results.size).to eq(1)
xapian_object.results[0][:model] == info_request_events(:silly_outgoing_message_event)
- xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "tag:orangeaardvark", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], "tag:orangeaardvark", limit: 100)
expect(xapian_object.results.size).to eq(0)
end
end
@@ -352,14 +352,14 @@
body.save!
update_xapian_index
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", limit: 100)
expect(xapian_object.results.size).to eq(1)
xapian_object.results[0][:model] == public_bodies(:geraldine_public_body)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice:3", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice:3", limit: 100)
expect(xapian_object.results.size).to eq(1)
xapian_object.results[0][:model] == public_bodies(:geraldine_public_body)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:orangeaardvark", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:orangeaardvark", limit: 100)
expect(xapian_object.results.size).to eq(0)
end
end
@@ -381,11 +381,11 @@
values = false
texts = false
destroy_and_rebuild_xapian_index(terms, values, texts, dropfirst)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", limit: 100)
expect(xapian_object.results.map { |x|x[:model] }).to match_array(PublicBody.all)
# only reindex 'tag' and text
dropfirst = true
@@ -393,31 +393,31 @@
values = false
texts = true
destroy_and_rebuild_xapian_index(terms, values, texts, dropfirst)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", limit: 100)
expect(xapian_object.results.size).to eq(1)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", limit: 100)
expect(xapian_object.results.size).to eq(1)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", limit: 100)
expect(xapian_object.results.size).to eq(0)
# only reindex 'variety' term, but keeping the existing data in-place
dropfirst = false
terms = "V"
texts = false
destroy_and_rebuild_xapian_index(terms, values, texts, dropfirst)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", limit: 100)
expect(xapian_object.results.size).to eq(1)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", limit: 100)
expect(xapian_object.results.size).to eq(1)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", limit: 100)
expect(xapian_object.results.map { |x|x[:model] }).to match_array(PublicBody.all)
# only reindex 'variety' term, blowing away existing data
dropfirst = true
destroy_and_rebuild_xapian_index(terms, values, texts, dropfirst)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "tag:mice", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "frobzn", limit: 100)
expect(xapian_object.results.size).to eq(0)
- xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", :limit => 100)
+ xapian_object = ActsAsXapian::Search.new([PublicBody], "variety:authority", limit: 100)
expect(xapian_object.results.map { |x|x[:model] }).to match_array(PublicBody.all)
end
end
From 5bbc6e4e27c69823961c02ca992f64af5d2cddb9 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:02:28 +0000
Subject: [PATCH 099/289] Style: HashSyntax Rubocop (migrations)
---
db/migrate/006_version_public_body.rb | 2 +-
.../017_add_email_confirmed_to_users.rb | 2 +-
...8_add_response_type_to_incoming_message.rb | 4 +-
...021_remove_contains_information_default.rb | 4 +-
db/migrate/022_create_info_request_events.rb | 2 +-
.../024_add_is_bounce_to_incoming_messages.rb | 2 +-
db/migrate/026_add_many_null_constraints.rb | 164 +++++++++---------
.../027_change_classification_system.rb | 4 +-
.../028_give_incoming_messages_events.rb | 2 +-
db/migrate/033_add_prominence.rb | 2 +-
db/migrate/035_track_overdue_alerts.rb | 6 +-
db/migrate/036_add_public_body_tags.rb | 8 +-
db/migrate/037_add_url_name.rb | 4 +-
db/migrate/038_add_more_url_names.rb | 2 +-
db/migrate/039_request_url_names.rb | 4 +-
db/migrate/041_index_requests_with_solr.rb | 2 +-
db/migrate/042_unique_user_urls.rb | 4 +-
db/migrate/044_remove_is_bounce.rb | 2 +-
.../045_add_circumstance_to_post_redirect.rb | 4 +-
.../046_add_last_event_id_to_alert_table.rb | 2 +-
db/migrate/047_add_calculated_state.rb | 2 +-
db/migrate/049_track_things.rb | 20 +--
db/migrate/050_improve_track_things.rb | 4 +-
.../051_add_track_things_unique_indices.rb | 2 +-
db/migrate/053_acts_as_xapian_migration.rb | 10 +-
db/migrate/055_stop_new_responses.rb | 2 +-
db/migrate/057_add_law_used.rb | 2 +-
db/migrate/059_add_url_notes.rb | 4 +-
db/migrate/062_add_comments.rb | 12 +-
db/migrate/063_add_admin_users.rb | 2 +-
db/migrate/065_add_comments_to_user_track.rb | 2 +-
db/migrate/066_add_first_letter.rb | 2 +-
db/migrate/067_factor_out_raw_email.rb | 10 +-
db/migrate/068_add_censor_table.rb | 12 +-
db/migrate/069_add_what_doing.rb | 2 +-
db/migrate/071_add_exim_log.rb | 16 +-
db/migrate/072_add_publication_scheme.rb | 4 +-
db/migrate/073_add_ban_user.rb | 2 +-
db/migrate/074_create_holidays.rb | 2 +-
db/migrate/075_add_charity_number.rb | 4 +-
db/migrate/078_expand_stop_new_responses.rb | 4 +-
db/migrate/079_add_profile_photo.rb | 6 +-
db/migrate/081_add_event_prominence.rb | 2 +-
db/migrate/082_change_raw_email_to_binary.rb | 2 +-
db/migrate/085_draft_profile_photo.rb | 2 +-
.../086_allow_null_profile_photo_user.rb | 2 +-
db/migrate/087_add_about_me.rb | 2 +-
db/migrate/090_remove_tag_uniqueness.rb | 2 +-
db/migrate/093_move_to_has_tag_string.rb | 2 +-
db/migrate/094_remove_old_tags_foreign_key.rb | 2 +-
db/migrate/096_create_translation_tables.rb | 14 +-
db/migrate/097_add_comment_locale.rb | 2 +-
.../099_move_raw_email_to_filesystem.rb | 2 +-
db/migrate/101_add_hash_to_info_request.rb | 2 +-
db/migrate/103_add_user_bounce_columns.rb | 2 +-
.../106_add_hex_digest_to_foi_attachment.rb | 2 +-
db/migrate/110_add_user_no_limit.rb | 2 +-
db/migrate/111_create_purge_requests.rb | 6 +-
...13_add_external_fields_to_info_requests.rb | 4 +-
...tention_requested_flag_to_info_requests.rb | 2 +-
.../115_add_receive_email_alerts_to_user.rb | 2 +-
db/migrate/117_create_sessions.rb | 4 +-
db/migrate/118_remove_sessions_again.rb | 4 +-
...10153022_create_request_classifications.rb | 2 +-
...dd_info_requests_count_to_public_bodies.rb | 2 +-
...04_add_comments_allowed_to_info_request.rb | 2 +-
.../20121022031914_add_disclosure_log.rb | 4 +-
...move_prominence_from_info_request_event.rb | 2 +-
...5325_add_prominence_to_incoming_message.rb | 2 +-
...d_prominence_fields_to_outgoing_message.rb | 2 +-
...140_add_can_make_batch_requests_to_user.rb | 2 +-
...31024114346_create_info_request_batches.rb | 8 +-
..._request_batch_public_bodies_join_table.rb | 2 +-
...2641_create_public_body_change_requests.rb | 4 +-
.../20140325120619_create_spam_addresses.rb | 4 +-
...ate_public_body_headings_and_categories.rb | 18 +-
...1107_create_category_translation_tables.rb | 12 +-
...isplay_order_to_categories_and_headings.rb | 4 +-
.../20140824191444_create_widget_votes.rb | 4 +-
...20151006101417_add_otp_enabled_to_users.rb | 2 +-
...1006104739_add_counter_for_otp_to_users.rb | 2 +-
...requests_visible_count_to_public_bodies.rb | 2 +-
...ger_length_for_track_things_track_query.rb | 4 +-
...last_public_response_at_to_info_request.rb | 2 +-
...6154304_add_confirmed_not_spam_to_users.rb | 2 +-
..._reject_incoming_at_mta_to_info_request.rb | 2 +-
...rejected_incoming_count_to_info_request.rb | 2 +-
...60613145644_add_comments_count_to_users.rb | 2 +-
...151127_add_info_requests_count_to_users.rb | 2 +-
...3151912_add_track_things_count_to_users.rb | 2 +-
..._request_classifications_count_to_users.rb | 2 +-
...lic_body_change_requests_count_to_users.rb | 2 +-
...add_info_request_batches_count_to_users.rb | 2 +-
...155339_remove_comment_type_from_comment.rb | 2 +-
...1547_add_attention_requested_to_comment.rb | 2 +-
.../20170227140831_rolify_create_roles.rb | 6 +-
...63735_create_draft_info_request_batches.rb | 2 +-
...nfo_request_batches_public_bodies_table.rb | 2 +-
...316170248_edit_info_request_batch_index.rb | 2 +-
..._create_alaveteli_pro_request_summaries.rb | 4 +-
...141214_add_unique_index_to_summarisable.rb | 4 +-
...laveteli_pro_request_summary_categories.rb | 12 +-
...302_drop_public_body_translated_columns.rb | 14 +-
.../20170914164031_remove_purge_request.rb | 6 +-
.../20170922160120_remove_admin_level.rb | 2 +-
105 files changed, 289 insertions(+), 289 deletions(-)
diff --git a/db/migrate/006_version_public_body.rb b/db/migrate/006_version_public_body.rb
index 60f1579d6f..0a999cdbc4 100644
--- a/db/migrate/006_version_public_body.rb
+++ b/db/migrate/006_version_public_body.rb
@@ -2,7 +2,7 @@ class VersionPublicBody < ActiveRecord::Migration[4.2] # 1.2
def self.up
PublicBody.create_versioned_table
- add_timestamps(:public_body_versions, :null => false)
+ add_timestamps(:public_body_versions, null: false)
end
def self.down
diff --git a/db/migrate/017_add_email_confirmed_to_users.rb b/db/migrate/017_add_email_confirmed_to_users.rb
index c6327b9251..b9e8e7177b 100644
--- a/db/migrate/017_add_email_confirmed_to_users.rb
+++ b/db/migrate/017_add_email_confirmed_to_users.rb
@@ -1,6 +1,6 @@
class AddEmailConfirmedToUsers < ActiveRecord::Migration[4.2] # 1.2
def self.up
- add_column :users, :email_confirmed, :boolean, :default => false
+ add_column :users, :email_confirmed, :boolean, default: false
end
def self.down
diff --git a/db/migrate/018_add_response_type_to_incoming_message.rb b/db/migrate/018_add_response_type_to_incoming_message.rb
index 38c3744cd8..90fb31e37f 100644
--- a/db/migrate/018_add_response_type_to_incoming_message.rb
+++ b/db/migrate/018_add_response_type_to_incoming_message.rb
@@ -1,7 +1,7 @@
class AddResponseTypeToIncomingMessage < ActiveRecord::Migration[4.2] # 1.2
def self.up
- add_column :incoming_messages, :user_classified, :boolean, :default => false
- add_column :incoming_messages, :contains_information, :boolean, :default => false
+ add_column :incoming_messages, :user_classified, :boolean, default: false
+ add_column :incoming_messages, :contains_information, :boolean, default: false
create_table :rejection_reasons do |t|
t.column :incoming_message_id, :integer
diff --git a/db/migrate/021_remove_contains_information_default.rb b/db/migrate/021_remove_contains_information_default.rb
index a82d1034e2..e9abe404e9 100644
--- a/db/migrate/021_remove_contains_information_default.rb
+++ b/db/migrate/021_remove_contains_information_default.rb
@@ -1,11 +1,11 @@
class RemoveContainsInformationDefault < ActiveRecord::Migration[4.2] # 1.2
def self.up
- change_column :incoming_messages, :contains_information, :boolean, :default => nil
+ change_column :incoming_messages, :contains_information, :boolean, default: nil
drop_table :rejection_reasons
end
def self.down
- change_column :incoming_messages, :contains_information, :boolean, :default => false
+ change_column :incoming_messages, :contains_information, :boolean, default: false
create_table :rejection_reasons do |t|
t.column :incoming_message_id, :integer
t.column :reason, :string
diff --git a/db/migrate/022_create_info_request_events.rb b/db/migrate/022_create_info_request_events.rb
index 53b6bd9af3..0b116d000e 100644
--- a/db/migrate/022_create_info_request_events.rb
+++ b/db/migrate/022_create_info_request_events.rb
@@ -11,7 +11,7 @@ def self.up
InfoRequest.find_each do |info_request|
info_request_event = InfoRequestEvent.new
info_request_event.event_type = 'sent'
- info_request_event.params = { :email => info_request.recipient_email, :outgoing_message_id => info_request.outgoing_messages[0].id }
+ info_request_event.params = { email: info_request.recipient_email, outgoing_message_id: info_request.outgoing_messages[0].id }
info_request_event.info_request = info_request
info_request_event.created_at = info_request.outgoing_messages[0].sent_at
info_request_event.save!
diff --git a/db/migrate/024_add_is_bounce_to_incoming_messages.rb b/db/migrate/024_add_is_bounce_to_incoming_messages.rb
index 6e60ca726e..383e0f4674 100644
--- a/db/migrate/024_add_is_bounce_to_incoming_messages.rb
+++ b/db/migrate/024_add_is_bounce_to_incoming_messages.rb
@@ -1,6 +1,6 @@
class AddIsBounceToIncomingMessages < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :incoming_messages, :is_bounce, :boolean, :default => false
+ add_column :incoming_messages, :is_bounce, :boolean, default: false
IncomingMessage.update_all "is_bounce = 'f'"
end
diff --git a/db/migrate/026_add_many_null_constraints.rb b/db/migrate/026_add_many_null_constraints.rb
index 693769b1f1..0e98514b67 100644
--- a/db/migrate/026_add_many_null_constraints.rb
+++ b/db/migrate/026_add_many_null_constraints.rb
@@ -1,103 +1,103 @@
class AddManyNullConstraints < ActiveRecord::Migration[4.2] # 2.0
def self.up
- change_column :users, :email, :string, :null => false
- change_column :users, :name, :string, :null => false
- change_column :users, :hashed_password, :string, :null => false
- change_column :users, :salt, :string, :null => false
- change_column :users, :created_at, :datetime, :null => false
- change_column :users, :updated_at, :datetime, :null => false
- change_column :users, :email_confirmed, :boolean, :null => false, :default =>false
+ change_column :users, :email, :string, null: false
+ change_column :users, :name, :string, null: false
+ change_column :users, :hashed_password, :string, null: false
+ change_column :users, :salt, :string, null: false
+ change_column :users, :created_at, :datetime, null: false
+ change_column :users, :updated_at, :datetime, null: false
+ change_column :users, :email_confirmed, :boolean, null: false, default: false
- change_column :public_bodies, :name, :text, :null => false
- change_column :public_bodies, :short_name, :text, :null => false
- change_column :public_bodies, :request_email, :text, :null => false
- change_column :public_bodies, :version, :integer, :null => false
- change_column :public_bodies, :last_edit_editor, :string, :null => false
- change_column :public_bodies, :last_edit_comment, :text, :null => false
- change_column :public_bodies, :created_at, :datetime, :null => false
- change_column :public_bodies, :updated_at, :datetime, :null => false
+ change_column :public_bodies, :name, :text, null: false
+ change_column :public_bodies, :short_name, :text, null: false
+ change_column :public_bodies, :request_email, :text, null: false
+ change_column :public_bodies, :version, :integer, null: false
+ change_column :public_bodies, :last_edit_editor, :string, null: false
+ change_column :public_bodies, :last_edit_comment, :text, null: false
+ change_column :public_bodies, :created_at, :datetime, null: false
+ change_column :public_bodies, :updated_at, :datetime, null: false
- change_column :post_redirects, :token, :text, :null => false
- change_column :post_redirects, :uri, :text, :null => false
- change_column :post_redirects, :created_at, :datetime, :null => false
- change_column :post_redirects, :updated_at, :datetime, :null => false
- change_column :post_redirects, :email_token, :text, :null => false
+ change_column :post_redirects, :token, :text, null: false
+ change_column :post_redirects, :uri, :text, null: false
+ change_column :post_redirects, :created_at, :datetime, null: false
+ change_column :post_redirects, :updated_at, :datetime, null: false
+ change_column :post_redirects, :email_token, :text, null: false
- change_column :outgoing_messages, :info_request_id, :integer, :null => false
- change_column :outgoing_messages, :body, :text, :null => false
- change_column :outgoing_messages, :status, :string, :null => false
- change_column :outgoing_messages, :message_type, :string, :null => false
- change_column :outgoing_messages, :created_at, :datetime, :null => false
- change_column :outgoing_messages, :updated_at, :datetime, :null => false
+ change_column :outgoing_messages, :info_request_id, :integer, null: false
+ change_column :outgoing_messages, :body, :text, null: false
+ change_column :outgoing_messages, :status, :string, null: false
+ change_column :outgoing_messages, :message_type, :string, null: false
+ change_column :outgoing_messages, :created_at, :datetime, null: false
+ change_column :outgoing_messages, :updated_at, :datetime, null: false
- change_column :info_requests, :title, :text, :null => false
- change_column :info_requests, :user_id, :integer, :null => false
- change_column :info_requests, :public_body_id, :integer, :null => false
- change_column :info_requests, :created_at, :datetime, :null => false
- change_column :info_requests, :updated_at, :datetime, :null => false
+ change_column :info_requests, :title, :text, null: false
+ change_column :info_requests, :user_id, :integer, null: false
+ change_column :info_requests, :public_body_id, :integer, null: false
+ change_column :info_requests, :created_at, :datetime, null: false
+ change_column :info_requests, :updated_at, :datetime, null: false
- change_column :info_request_events, :info_request_id, :integer, :null => false
- change_column :info_request_events, :event_type, :text, :null => false
- change_column :info_request_events, :params_yaml, :text, :null => false
- change_column :info_request_events, :created_at, :datetime, :null => false
+ change_column :info_request_events, :info_request_id, :integer, null: false
+ change_column :info_request_events, :event_type, :text, null: false
+ change_column :info_request_events, :params_yaml, :text, null: false
+ change_column :info_request_events, :created_at, :datetime, null: false
- change_column :incoming_messages, :info_request_id, :integer, :null => false
- change_column :incoming_messages, :raw_data, :text, :null => false
- change_column :incoming_messages, :created_at, :datetime, :null => false
- change_column :incoming_messages, :updated_at, :datetime, :null => false
- change_column :incoming_messages, :user_classified, :boolean, :null => false, :default => false
- change_column :incoming_messages, :is_bounce, :boolean, :null => false, :default => false
+ change_column :incoming_messages, :info_request_id, :integer, null: false
+ change_column :incoming_messages, :raw_data, :text, null: false
+ change_column :incoming_messages, :created_at, :datetime, null: false
+ change_column :incoming_messages, :updated_at, :datetime, null: false
+ change_column :incoming_messages, :user_classified, :boolean, null: false, default: false
+ change_column :incoming_messages, :is_bounce, :boolean, null: false, default: false
end
def self.down
- change_column :users, :email, :string, :null => true
- change_column :users, :name, :string, :null => true
- change_column :users, :hashed_password, :string, :null => true
- change_column :users, :salt, :string, :null => true
- change_column :users, :created_at, :datetime, :null => true
- change_column :users, :updated_at, :datetime, :null => true
- change_column :users, :email_confirmed, :boolean, :null => true, :default =>false
+ change_column :users, :email, :string, null: true
+ change_column :users, :name, :string, null: true
+ change_column :users, :hashed_password, :string, null: true
+ change_column :users, :salt, :string, null: true
+ change_column :users, :created_at, :datetime, null: true
+ change_column :users, :updated_at, :datetime, null: true
+ change_column :users, :email_confirmed, :boolean, null: true, default: false
- change_column :public_bodies, :name, :text, :null => true
- change_column :public_bodies, :short_name, :text, :null => true
- change_column :public_bodies, :request_email, :text, :null => true
- change_column :public_bodies, :version, :integer, :null => true
- change_column :public_bodies, :last_edit_editor, :string, :null => true
- change_column :public_bodies, :last_edit_comment, :string, :null => true
- change_column :public_bodies, :created_at, :datetime, :null => true
- change_column :public_bodies, :updated_at, :datetime, :null => true
+ change_column :public_bodies, :name, :text, null: true
+ change_column :public_bodies, :short_name, :text, null: true
+ change_column :public_bodies, :request_email, :text, null: true
+ change_column :public_bodies, :version, :integer, null: true
+ change_column :public_bodies, :last_edit_editor, :string, null: true
+ change_column :public_bodies, :last_edit_comment, :string, null: true
+ change_column :public_bodies, :created_at, :datetime, null: true
+ change_column :public_bodies, :updated_at, :datetime, null: true
- change_column :post_redirects, :token, :text, :null => true
- change_column :post_redirects, :uri, :text, :null => true
- change_column :post_redirects, :created_at, :datetime, :null => true
- change_column :post_redirects, :updated_at, :datetime, :null => true
- change_column :post_redirects, :email_token, :text, :null => true
+ change_column :post_redirects, :token, :text, null: true
+ change_column :post_redirects, :uri, :text, null: true
+ change_column :post_redirects, :created_at, :datetime, null: true
+ change_column :post_redirects, :updated_at, :datetime, null: true
+ change_column :post_redirects, :email_token, :text, null: true
- change_column :outgoing_messages, :info_request_id, :integer, :null => true
- change_column :outgoing_messages, :body, :text, :null => true
- change_column :outgoing_messages, :status, :string, :null => true
- change_column :outgoing_messages, :message_type, :string, :null => true
- change_column :outgoing_messages, :created_at, :datetime, :null => true
- change_column :outgoing_messages, :updated_at, :datetime, :null => true
+ change_column :outgoing_messages, :info_request_id, :integer, null: true
+ change_column :outgoing_messages, :body, :text, null: true
+ change_column :outgoing_messages, :status, :string, null: true
+ change_column :outgoing_messages, :message_type, :string, null: true
+ change_column :outgoing_messages, :created_at, :datetime, null: true
+ change_column :outgoing_messages, :updated_at, :datetime, null: true
- change_column :info_requests, :title, :text, :null => true
- change_column :info_requests, :user_id, :integer, :null => true
- change_column :info_requests, :public_body_id, :integer, :null => true
- change_column :info_requests, :created_at, :datetime, :null => true
- change_column :info_requests, :updated_at, :datetime, :null => true
+ change_column :info_requests, :title, :text, null: true
+ change_column :info_requests, :user_id, :integer, null: true
+ change_column :info_requests, :public_body_id, :integer, null: true
+ change_column :info_requests, :created_at, :datetime, null: true
+ change_column :info_requests, :updated_at, :datetime, null: true
- change_column :info_request_events, :info_request_id, :integer, :null => true
- change_column :info_request_events, :event_type, :text, :null => true
- change_column :info_request_events, :params_yaml, :text, :null => true
- change_column :info_request_events, :created_at, :datetime, :null => true
+ change_column :info_request_events, :info_request_id, :integer, null: true
+ change_column :info_request_events, :event_type, :text, null: true
+ change_column :info_request_events, :params_yaml, :text, null: true
+ change_column :info_request_events, :created_at, :datetime, null: true
- change_column :incoming_messages, :info_request_id, :integer, :null => true
- change_column :incoming_messages, :raw_data, :text, :null => true
- change_column :incoming_messages, :created_at, :datetime, :null => true
- change_column :incoming_messages, :updated_at, :datetime, :null => true
- change_column :incoming_messages, :user_classified, :boolean, :null => true, :default => false
- change_column :incoming_messages, :is_bounce, :boolean, :null => true, :default => false
+ change_column :incoming_messages, :info_request_id, :integer, null: true
+ change_column :incoming_messages, :raw_data, :text, null: true
+ change_column :incoming_messages, :created_at, :datetime, null: true
+ change_column :incoming_messages, :updated_at, :datetime, null: true
+ change_column :incoming_messages, :user_classified, :boolean, null: true, default: false
+ change_column :incoming_messages, :is_bounce, :boolean, null: true, default: false
end
end
diff --git a/db/migrate/027_change_classification_system.rb b/db/migrate/027_change_classification_system.rb
index 9f4b82691d..7be5014719 100644
--- a/db/migrate/027_change_classification_system.rb
+++ b/db/migrate/027_change_classification_system.rb
@@ -5,9 +5,9 @@ def self.up
add_column :info_requests, :described_state, :string
InfoRequest.update_all "described_state = 'waiting_response'"
- change_column :info_requests, :described_state, :string, :null => false
+ change_column :info_requests, :described_state, :string, null: false
- add_column :info_requests, :awaiting_description, :boolean, :default => false, :null => false
+ add_column :info_requests, :awaiting_description, :boolean, default: false, null: false
InfoRequest.update_all "awaiting_description = 't' where (select count(*) from incoming_messages where info_request_id = info_requests.id) > 0"
add_column :info_requests, :described_last_incoming_message_id, :integer
diff --git a/db/migrate/028_give_incoming_messages_events.rb b/db/migrate/028_give_incoming_messages_events.rb
index d1ee0f6086..341bfecb8e 100644
--- a/db/migrate/028_give_incoming_messages_events.rb
+++ b/db/migrate/028_give_incoming_messages_events.rb
@@ -9,7 +9,7 @@ def self.up
IncomingMessage.find_each do |incoming_message|
info_request_event = InfoRequestEvent.new
info_request_event.event_type = 'response'
- info_request_event.params = { :incoming_message_id => incoming_message.id }
+ info_request_event.params = { incoming_message_id: incoming_message.id }
info_request_event.info_request = incoming_message.info_request
info_request_event.created_at = incoming_message.created_at
info_request_event.save!
diff --git a/db/migrate/033_add_prominence.rb b/db/migrate/033_add_prominence.rb
index 0052ce5de4..caff00b289 100644
--- a/db/migrate/033_add_prominence.rb
+++ b/db/migrate/033_add_prominence.rb
@@ -1,6 +1,6 @@
class AddProminence < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :info_requests, :prominence, :string, :null => false, :default => 'normal'
+ add_column :info_requests, :prominence, :string, null: false, default: 'normal'
end
def self.down
diff --git a/db/migrate/035_track_overdue_alerts.rb b/db/migrate/035_track_overdue_alerts.rb
index c1a379fe74..c8ecce98b7 100644
--- a/db/migrate/035_track_overdue_alerts.rb
+++ b/db/migrate/035_track_overdue_alerts.rb
@@ -1,10 +1,10 @@
class TrackOverdueAlerts < ActiveRecord::Migration[4.2] # 2.0
def self.up
create_table :user_info_request_sent_alerts do |t|
- t.column :user_id, :integer, :null => false
- t.column :info_request_id, :integer, :null => false
+ t.column :user_id, :integer, null: false
+ t.column :info_request_id, :integer, null: false
- t.column :alert_type, :string, :null => false
+ t.column :alert_type, :string, null: false
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
diff --git a/db/migrate/036_add_public_body_tags.rb b/db/migrate/036_add_public_body_tags.rb
index 4b3f4efa89..7ed033f323 100644
--- a/db/migrate/036_add_public_body_tags.rb
+++ b/db/migrate/036_add_public_body_tags.rb
@@ -1,9 +1,9 @@
class AddPublicBodyTags < ActiveRecord::Migration[4.2] # 2.0
def self.up
create_table :public_body_tags do |t|
- t.column :public_body_id, :integer, :null => false
- t.column :name, :text, :null => false
- t.column :created_at, :datetime, :null => false
+ t.column :public_body_id, :integer, null: false
+ t.column :name, :text, null: false
+ t.column :created_at, :datetime, null: false
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
@@ -13,7 +13,7 @@ def self.up
# MySQL cannot index text blobs like this
# TODO: perhaps should change :name to be a :string
if ActiveRecord::Base.connection.adapter_name != "MySQL"
- add_index :public_body_tags, [:public_body_id, :name], :unique => true
+ add_index :public_body_tags, [:public_body_id, :name], unique: true
end
end
diff --git a/db/migrate/037_add_url_name.rb b/db/migrate/037_add_url_name.rb
index 8536b7f2ca..f8e12f6db3 100644
--- a/db/migrate/037_add_url_name.rb
+++ b/db/migrate/037_add_url_name.rb
@@ -9,9 +9,9 @@ def self.up
end
# MySQL cannot index text blobs like this
if ActiveRecord::Base.connection.adapter_name != "MySQL"
- add_index :public_bodies, :url_name, :unique => true
+ add_index :public_bodies, :url_name, unique: true
end
- change_column :public_bodies, :url_name, :text, :null => false
+ change_column :public_bodies, :url_name, :text, null: false
end
def self.down
diff --git a/db/migrate/038_add_more_url_names.rb b/db/migrate/038_add_more_url_names.rb
index f64347bf1b..0ab90598cb 100644
--- a/db/migrate/038_add_more_url_names.rb
+++ b/db/migrate/038_add_more_url_names.rb
@@ -10,7 +10,7 @@ def self.up
if ActiveRecord::Base.connection.adapter_name != "MySQL"
add_index :users, :url_name
end
- change_column :users, :url_name, :text, :null => false
+ change_column :users, :url_name, :text, null: false
end
def self.down
diff --git a/db/migrate/039_request_url_names.rb b/db/migrate/039_request_url_names.rb
index 549a586f4b..4dff313092 100644
--- a/db/migrate/039_request_url_names.rb
+++ b/db/migrate/039_request_url_names.rb
@@ -8,9 +8,9 @@ def self.up
end
# MySQL cannot index text blobs like this
if ActiveRecord::Base.connection.adapter_name != "MySQL"
- add_index :info_requests, :url_title, :unique => true
+ add_index :info_requests, :url_title, unique: true
end
- change_column :info_requests, :url_title, :text, :null => false
+ change_column :info_requests, :url_title, :text, null: false
end
def self.down
diff --git a/db/migrate/041_index_requests_with_solr.rb b/db/migrate/041_index_requests_with_solr.rb
index e269a93fe1..6e8369efe5 100644
--- a/db/migrate/041_index_requests_with_solr.rb
+++ b/db/migrate/041_index_requests_with_solr.rb
@@ -1,6 +1,6 @@
class IndexRequestsWithSolr < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :info_requests, :solr_up_to_date, :boolean, :default => false, :null => false
+ add_column :info_requests, :solr_up_to_date, :boolean, default: false, null: false
add_index :info_requests, :solr_up_to_date
end
diff --git a/db/migrate/042_unique_user_urls.rb b/db/migrate/042_unique_user_urls.rb
index 038d98d5aa..ecf9d80ee9 100644
--- a/db/migrate/042_unique_user_urls.rb
+++ b/db/migrate/042_unique_user_urls.rb
@@ -8,7 +8,7 @@ def self.up
# MySQL cannot index text blobs like this
if ActiveRecord::Base.connection.adapter_name != "MySQL"
remove_index :users, :url_name
- add_index :users, :url_name, :unique => true
+ add_index :users, :url_name, unique: true
end
end
@@ -16,7 +16,7 @@ def self.down
# MySQL cannot index text blobs like this
if ActiveRecord::Base.connection.adapter_name != "MySQL"
remove_index :users, :url_name
- add_index :users, :url_name, :unique => false
+ add_index :users, :url_name, unique: false
end
end
diff --git a/db/migrate/044_remove_is_bounce.rb b/db/migrate/044_remove_is_bounce.rb
index f919a86ab7..f60479cd32 100644
--- a/db/migrate/044_remove_is_bounce.rb
+++ b/db/migrate/044_remove_is_bounce.rb
@@ -4,6 +4,6 @@ def self.up
end
def self.down
- add_column :incoming_messages, :is_bounce, :boolean, :default => false
+ add_column :incoming_messages, :is_bounce, :boolean, default: false
end
end
diff --git a/db/migrate/045_add_circumstance_to_post_redirect.rb b/db/migrate/045_add_circumstance_to_post_redirect.rb
index b176518860..a538186228 100644
--- a/db/migrate/045_add_circumstance_to_post_redirect.rb
+++ b/db/migrate/045_add_circumstance_to_post_redirect.rb
@@ -1,8 +1,8 @@
class AddCircumstanceToPostRedirect < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :post_redirects, :circumstance, :text, :default => "normal"
+ add_column :post_redirects, :circumstance, :text, default: "normal"
PostRedirect.update_all "circumstance = 'normal'"
- change_column :post_redirects, :circumstance, :text, :default => "normal", :null => false
+ change_column :post_redirects, :circumstance, :text, default: "normal", null: false
end
def self.down
diff --git a/db/migrate/046_add_last_event_id_to_alert_table.rb b/db/migrate/046_add_last_event_id_to_alert_table.rb
index 23e1bb0e20..cd25aaa4e6 100644
--- a/db/migrate/046_add_last_event_id_to_alert_table.rb
+++ b/db/migrate/046_add_last_event_id_to_alert_table.rb
@@ -1,6 +1,6 @@
class AddLastEventIdToAlertTable < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :user_info_request_sent_alerts, :info_request_event_id, :integer, :default => nil
+ add_column :user_info_request_sent_alerts, :info_request_event_id, :integer, default: nil
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
execute "ALTER TABLE user_info_request_sent_alerts ADD CONSTRAINT fk_user_info_request_sent_alert_info_request_event FOREIGN KEY (info_request_event_id) REFERENCES info_request_events(id)"
# The coalesce is because null values are considered not equal in SQL, and we want them
diff --git a/db/migrate/047_add_calculated_state.rb b/db/migrate/047_add_calculated_state.rb
index 18ce52526b..9372e56766 100644
--- a/db/migrate/047_add_calculated_state.rb
+++ b/db/migrate/047_add_calculated_state.rb
@@ -1,6 +1,6 @@
class AddCalculatedState < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :info_request_events, :calculated_state, :string, :default => nil
+ add_column :info_request_events, :calculated_state, :string, default: nil
end
def self.down
diff --git a/db/migrate/049_track_things.rb b/db/migrate/049_track_things.rb
index e371dd74ab..e7fe3c05cd 100644
--- a/db/migrate/049_track_things.rb
+++ b/db/migrate/049_track_things.rb
@@ -1,15 +1,15 @@
class TrackThings < ActiveRecord::Migration[4.2] # 2.0
def self.up
create_table :track_things do |t|
- t.column :tracking_user_id, :integer, :null => false
- t.column :track_query, :string, :null => false
+ t.column :tracking_user_id, :integer, null: false
+ t.column :track_query, :string, null: false
# optional foreign key links, for displaying people who are tracking this on pages
- t.column :info_request_id, :integer, :default => nil
- t.column :tracked_user_id, :integer, :default => nil
- t.column :public_body_id, :integer, :default => nil
+ t.column :info_request_id, :integer, default: nil
+ t.column :tracked_user_id, :integer, default: nil
+ t.column :public_body_id, :integer, default: nil
- t.column :track_medium, :string, :null => false
+ t.column :track_medium, :string, null: false
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
@@ -20,11 +20,11 @@ def self.up
end
create_table :track_things_sent_emails do |t|
- t.column :track_thing_id, :integer, :null => false
+ t.column :track_thing_id, :integer, null: false
- t.column :info_request_event_id, :integer, :default => nil
- t.column :user_id, :integer, :default => nil
- t.column :public_body_id, :integer, :default => nil
+ t.column :info_request_event_id, :integer, default: nil
+ t.column :user_id, :integer, default: nil
+ t.column :public_body_id, :integer, default: nil
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
diff --git a/db/migrate/050_improve_track_things.rb b/db/migrate/050_improve_track_things.rb
index de0d8ad590..399ef0f8ce 100644
--- a/db/migrate/050_improve_track_things.rb
+++ b/db/migrate/050_improve_track_things.rb
@@ -1,7 +1,7 @@
class ImproveTrackThings < ActiveRecord::Migration[4.2] # 2.0
def self.up
# SQLite at least needs a default for this
- add_column :track_things, :track_type, :string, :null => false, :default => "internal_error"
+ add_column :track_things, :track_type, :string, null: false, default: "internal_error"
add_column :track_things, :created_at, :datetime
add_column :track_things, :updated_at, :datetime
@@ -10,7 +10,7 @@ def self.up
add_column :users, :last_daily_track_email, :datetime
User.update_all "last_daily_track_email = '2000-01-01'"
- change_column :users, :last_daily_track_email, :datetime, :default => "2000-01-01"
+ change_column :users, :last_daily_track_email, :datetime, default: "2000-01-01"
end
def self.down
diff --git a/db/migrate/051_add_track_things_unique_indices.rb b/db/migrate/051_add_track_things_unique_indices.rb
index 9ac875e215..89e4caa1ce 100644
--- a/db/migrate/051_add_track_things_unique_indices.rb
+++ b/db/migrate/051_add_track_things_unique_indices.rb
@@ -1,6 +1,6 @@
class AddTrackThingsUniqueIndices < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_index :track_things, [:tracking_user_id, :track_query], :unique => true
+ add_index :track_things, [:tracking_user_id, :track_query], unique: true
# GRRR - this index confuses Rails migrations, and it makes part of the index but not all
# of it for the schema.rb, and hence in test databases, and the test databases fail.
# I guess the query in ./activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff --git a/db/migrate/053_acts_as_xapian_migration.rb b/db/migrate/053_acts_as_xapian_migration.rb
index 683fde32ff..c5965291c5 100644
--- a/db/migrate/053_acts_as_xapian_migration.rb
+++ b/db/migrate/053_acts_as_xapian_migration.rb
@@ -1,12 +1,12 @@
class ActsAsXapianMigration < ActiveRecord::Migration[4.2] # 2.0
def self.up
create_table :acts_as_xapian_jobs do |t|
- t.column :model, :string, :null => false
- t.column :model_id, :integer, :null => false
+ t.column :model, :string, null: false
+ t.column :model_id, :integer, null: false
- t.column :action, :string, :null => false
+ t.column :action, :string, null: false
end
- add_index :acts_as_xapian_jobs, [:model, :model_id], :unique => true
+ add_index :acts_as_xapian_jobs, [:model, :model_id], unique: true
remove_index :info_requests, :solr_up_to_date
remove_column :info_requests, :solr_up_to_date
@@ -17,7 +17,7 @@ def self.up
def self.down
drop_table :acts_as_xapian_jobs
- add_column :info_requests, :solr_up_to_date, :boolean, :default => false, :null => false
+ add_column :info_requests, :solr_up_to_date, :boolean, default: false, null: false
add_index :info_requests, :solr_up_to_date
end
end
diff --git a/db/migrate/055_stop_new_responses.rb b/db/migrate/055_stop_new_responses.rb
index 6fbf1ca33b..0bd72cb148 100644
--- a/db/migrate/055_stop_new_responses.rb
+++ b/db/migrate/055_stop_new_responses.rb
@@ -1,6 +1,6 @@
class StopNewResponses < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :info_requests, :stop_new_responses, :boolean, :default => false, :null => false
+ add_column :info_requests, :stop_new_responses, :boolean, default: false, null: false
end
def self.down
diff --git a/db/migrate/057_add_law_used.rb b/db/migrate/057_add_law_used.rb
index bb9d9fc583..725e836794 100644
--- a/db/migrate/057_add_law_used.rb
+++ b/db/migrate/057_add_law_used.rb
@@ -1,6 +1,6 @@
class AddLawUsed < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :info_requests, :law_used, :string, :null => false, :default => 'foi'
+ add_column :info_requests, :law_used, :string, null: false, default: 'foi'
end
def self.down
diff --git a/db/migrate/059_add_url_notes.rb b/db/migrate/059_add_url_notes.rb
index b78dacea0c..6e0ce4eb00 100644
--- a/db/migrate/059_add_url_notes.rb
+++ b/db/migrate/059_add_url_notes.rb
@@ -1,7 +1,7 @@
class AddUrlNotes < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :public_bodies, :home_page, :text, :null => false, :default => ""
- add_column :public_bodies, :notes, :text, :null => false, :default => ""
+ add_column :public_bodies, :home_page, :text, null: false, default: ""
+ add_column :public_bodies, :notes, :text, null: false, default: ""
add_column :public_body_versions, :home_page, :text
add_column :public_body_versions, :notes, :text
end
diff --git a/db/migrate/062_add_comments.rb b/db/migrate/062_add_comments.rb
index 2dd28e5a58..dfdd481b1d 100644
--- a/db/migrate/062_add_comments.rb
+++ b/db/migrate/062_add_comments.rb
@@ -1,16 +1,16 @@
class AddComments < ActiveRecord::Migration[4.2] # 2.0
def self.up
create_table :comments do |t|
- t.column :user_id, :integer, :null => false
- t.column :comment_type, :string, :null => false, :default => "internal_error"
+ t.column :user_id, :integer, null: false
+ t.column :comment_type, :string, null: false, default: "internal_error"
t.column :info_request_id, :integer
- t.column :body, :text, :null => false
- t.column :visible, :boolean, :default => true, :null => false
+ t.column :body, :text, null: false
+ t.column :visible, :boolean, default: true, null: false
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :updated_at, :datetime, null: false
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
diff --git a/db/migrate/063_add_admin_users.rb b/db/migrate/063_add_admin_users.rb
index e4121515c1..1a050757c6 100644
--- a/db/migrate/063_add_admin_users.rb
+++ b/db/migrate/063_add_admin_users.rb
@@ -1,6 +1,6 @@
class AddAdminUsers < ActiveRecord::Migration[4.2] # 2.0
def self.up
- add_column :users, :admin_level, :string, :null => false, :default => 'none'
+ add_column :users, :admin_level, :string, null: false, default: 'none'
end
def self.down
diff --git a/db/migrate/065_add_comments_to_user_track.rb b/db/migrate/065_add_comments_to_user_track.rb
index c8b03a5ce1..b5b2721094 100644
--- a/db/migrate/065_add_comments_to_user_track.rb
+++ b/db/migrate/065_add_comments_to_user_track.rb
@@ -1,7 +1,7 @@
class AddCommentsToUserTrack < ActiveRecord::Migration[4.2] # 2.1
def self.up
TrackThing.update_all "track_query = replace(track_query, 'variety:sent ', '') where track_type in ('public_body_updates', 'user_updates')"
- TrackThing.where(:track_type => 'user_updates').each do |track_thing|
+ TrackThing.where(track_type: 'user_updates').each do |track_thing|
track_thing.track_query = track_thing.track_query.gsub(/^requested_by:([^\s]+)$/, "requested_by:\\1 OR commented_by:\\1")
track_thing.save!
end
diff --git a/db/migrate/066_add_first_letter.rb b/db/migrate/066_add_first_letter.rb
index 61d0ce7403..98d66bd674 100644
--- a/db/migrate/066_add_first_letter.rb
+++ b/db/migrate/066_add_first_letter.rb
@@ -3,7 +3,7 @@ def self.up
add_column :public_bodies, :first_letter, :string
add_index :public_bodies, :first_letter
PublicBody.update_all "first_letter = upper(substr(name, 1, 1))"
- change_column :public_bodies, :first_letter, :string, :null => false
+ change_column :public_bodies, :first_letter, :string, null: false
end
def self.down
diff --git a/db/migrate/067_factor_out_raw_email.rb b/db/migrate/067_factor_out_raw_email.rb
index 9bd77757b9..1d3b8da20f 100644
--- a/db/migrate/067_factor_out_raw_email.rb
+++ b/db/migrate/067_factor_out_raw_email.rb
@@ -1,17 +1,17 @@
class FactorOutRawEmail < ActiveRecord::Migration[4.2] # 2.1
def self.up
create_table :raw_emails do |t|
- t.column :data, :text, :null => false
+ t.column :data, :text, null: false
end
- add_column :incoming_messages, :raw_email_id, :integer, :null => true
- change_column :incoming_messages, :raw_data, :text, :null => true
+ add_column :incoming_messages, :raw_email_id, :integer, null: true
+ change_column :incoming_messages, :raw_data, :text, null: true
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
execute "ALTER TABLE incoming_messages ADD CONSTRAINT fk_incoming_messages_raw_email FOREIGN KEY (raw_email_id) REFERENCES raw_emails(id)"
end
- IncomingMessage.find_each(:batch_size => 10) do |incoming_message|
+ IncomingMessage.find_each(batch_size: 10) do |incoming_message|
if incoming_message.raw_email_id.nil?
STDERR.puts "doing incoming_message id #{incoming_message.id}"
ActiveRecord::Base.transaction do
@@ -25,7 +25,7 @@ def self.up
end
end
- change_column :incoming_messages, :raw_email_id, :integer, :null => false
+ change_column :incoming_messages, :raw_email_id, :integer, null: false
remove_column :incoming_messages, :raw_data
end
diff --git a/db/migrate/068_add_censor_table.rb b/db/migrate/068_add_censor_table.rb
index 4a5630a29e..489a746f69 100644
--- a/db/migrate/068_add_censor_table.rb
+++ b/db/migrate/068_add_censor_table.rb
@@ -5,14 +5,14 @@ def self.up
t.column :user_id, :integer
t.column :public_body_id, :integer
- t.column :text, :text, :null => false
- t.column :replacement, :text, :null => false
+ t.column :text, :text, null: false
+ t.column :replacement, :text, null: false
- t.column :last_edit_editor, :string, :null => false
- t.column :last_edit_comment, :text, :null => false
+ t.column :last_edit_editor, :string, null: false
+ t.column :last_edit_comment, :text, null: false
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :updated_at, :datetime, null: false
end
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
diff --git a/db/migrate/069_add_what_doing.rb b/db/migrate/069_add_what_doing.rb
index 38cca80d29..35b39cdcff 100644
--- a/db/migrate/069_add_what_doing.rb
+++ b/db/migrate/069_add_what_doing.rb
@@ -3,7 +3,7 @@ def self.up
add_column :outgoing_messages, :what_doing, :string
add_index :outgoing_messages, :what_doing
OutgoingMessage.update_all "what_doing = 'normal_sort'"
- change_column :outgoing_messages, :what_doing, :string, :null => false
+ change_column :outgoing_messages, :what_doing, :string, null: false
end
def self.down
diff --git a/db/migrate/071_add_exim_log.rb b/db/migrate/071_add_exim_log.rb
index f2b15f53f7..19e3d70c5a 100644
--- a/db/migrate/071_add_exim_log.rb
+++ b/db/migrate/071_add_exim_log.rb
@@ -4,19 +4,19 @@ def self.up
t.column :exim_log_done_id, :integer
t.column :info_request_id, :integer
- t.column :order, :integer, :null => false
- t.column :line, :text, :null => false
+ t.column :order, :integer, null: false
+ t.column :line, :text, null: false
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :updated_at, :datetime, null: false
end
create_table :exim_log_dones do |t|
- t.column :filename, :text, :null => false, :unique => true
- t.column :last_stat, :datetime, :null => false
+ t.column :filename, :text, null: false, unique: true
+ t.column :last_stat, :datetime, null: false
- t.column :created_at, :datetime, :null => false
- t.column :updated_at, :datetime, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :updated_at, :datetime, null: false
end
add_index :exim_log_dones, :last_stat
diff --git a/db/migrate/072_add_publication_scheme.rb b/db/migrate/072_add_publication_scheme.rb
index aa966f80d2..d18fff0452 100644
--- a/db/migrate/072_add_publication_scheme.rb
+++ b/db/migrate/072_add_publication_scheme.rb
@@ -1,7 +1,7 @@
class AddPublicationScheme < ActiveRecord::Migration[4.2] # 2.1
def self.up
- add_column :public_bodies, :publication_scheme, :text, :null => false, :default => ""
- add_column :public_body_versions, :publication_scheme, :text, :null => false, :default => ""
+ add_column :public_bodies, :publication_scheme, :text, null: false, default: ""
+ add_column :public_body_versions, :publication_scheme, :text, null: false, default: ""
end
def self.down
diff --git a/db/migrate/073_add_ban_user.rb b/db/migrate/073_add_ban_user.rb
index 43baa6599d..f89e61c9c1 100644
--- a/db/migrate/073_add_ban_user.rb
+++ b/db/migrate/073_add_ban_user.rb
@@ -1,6 +1,6 @@
class AddBanUser < ActiveRecord::Migration[4.2] # 2.1
def self.up
- add_column :users, :ban_text, :text, :null => false, :default => ""
+ add_column :users, :ban_text, :text, null: false, default: ""
end
def self.down
diff --git a/db/migrate/074_create_holidays.rb b/db/migrate/074_create_holidays.rb
index 106e49dd20..32872afd3b 100644
--- a/db/migrate/074_create_holidays.rb
+++ b/db/migrate/074_create_holidays.rb
@@ -60,7 +60,7 @@ def self.up
}
holidays.sort.each { |date, desc|
- Holiday.create :day => date, :description => desc
+ Holiday.create day: date, description: desc
}
end
diff --git a/db/migrate/075_add_charity_number.rb b/db/migrate/075_add_charity_number.rb
index 1a529d1d13..7237ab9980 100644
--- a/db/migrate/075_add_charity_number.rb
+++ b/db/migrate/075_add_charity_number.rb
@@ -1,7 +1,7 @@
class AddCharityNumber < ActiveRecord::Migration[4.2] # 2.1
def self.up
- add_column :public_bodies, :charity_number, :text, :null => false, :default => ""
- add_column :public_body_versions, :charity_number, :text, :null => false, :default => ""
+ add_column :public_bodies, :charity_number, :text, null: false, default: ""
+ add_column :public_body_versions, :charity_number, :text, null: false, default: ""
end
def self.down
diff --git a/db/migrate/078_expand_stop_new_responses.rb b/db/migrate/078_expand_stop_new_responses.rb
index ef7a77a318..25200bd601 100644
--- a/db/migrate/078_expand_stop_new_responses.rb
+++ b/db/migrate/078_expand_stop_new_responses.rb
@@ -3,12 +3,12 @@ def self.up
add_column :info_requests, :allow_new_responses_from, :string
InfoRequest.update_all "allow_new_responses_from = 'anybody'"
InfoRequest.update_all "allow_new_responses_from = 'nobody' where stop_new_responses"
- change_column :info_requests, :allow_new_responses_from, :string, :null => false, :default => 'anybody'
+ change_column :info_requests, :allow_new_responses_from, :string, null: false, default: 'anybody'
remove_column :info_requests, :stop_new_responses
add_column :info_requests, :handle_rejected_responses, :string
InfoRequest.update_all "handle_rejected_responses = 'bounce'"
- change_column :info_requests, :handle_rejected_responses, :string, :null => false, :default => 'bounce'
+ change_column :info_requests, :handle_rejected_responses, :string, null: false, default: 'bounce'
end
def self.down
diff --git a/db/migrate/079_add_profile_photo.rb b/db/migrate/079_add_profile_photo.rb
index 0344fb7e35..9308691945 100644
--- a/db/migrate/079_add_profile_photo.rb
+++ b/db/migrate/079_add_profile_photo.rb
@@ -1,11 +1,11 @@
class AddProfilePhoto < ActiveRecord::Migration[4.2] # 2.1
def self.up
create_table :profile_photos do |t|
- t.column :data, :binary, :null => false
- t.column :user_id, :integer, :null => false
+ t.column :data, :binary, null: false
+ t.column :user_id, :integer, null: false
end
- add_column :users, :profile_photo_id, :integer, :null => true
+ add_column :users, :profile_photo_id, :integer, null: true
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
execute "ALTER TABLE profile_photos ADD CONSTRAINT fk_profile_photos_user FOREIGN KEY (user_id) REFERENCES users(id)"
diff --git a/db/migrate/081_add_event_prominence.rb b/db/migrate/081_add_event_prominence.rb
index 3562e12136..a961f0ee8f 100644
--- a/db/migrate/081_add_event_prominence.rb
+++ b/db/migrate/081_add_event_prominence.rb
@@ -1,6 +1,6 @@
class AddEventProminence < ActiveRecord::Migration[4.2] # 2.1
def self.up
- add_column :info_request_events, :prominence, :string, :null => false, :default => 'normal'
+ add_column :info_request_events, :prominence, :string, null: false, default: 'normal'
end
def self.down
diff --git a/db/migrate/082_change_raw_email_to_binary.rb b/db/migrate/082_change_raw_email_to_binary.rb
index f1cb28793f..7e3e075d3b 100644
--- a/db/migrate/082_change_raw_email_to_binary.rb
+++ b/db/migrate/082_change_raw_email_to_binary.rb
@@ -1,6 +1,6 @@
class ChangeRawEmailToBinary < ActiveRecord::Migration[4.2] # 2.1
def self.up
- change_column :raw_emails, :data, :text, :null => true # allow null
+ change_column :raw_emails, :data, :text, null: true # allow null
rename_column :raw_emails, :data, :data_text
add_column :raw_emails, :data_binary, :binary
end
diff --git a/db/migrate/085_draft_profile_photo.rb b/db/migrate/085_draft_profile_photo.rb
index 9083d9c943..1aab24128b 100644
--- a/db/migrate/085_draft_profile_photo.rb
+++ b/db/migrate/085_draft_profile_photo.rb
@@ -1,6 +1,6 @@
class DraftProfilePhoto < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :profile_photos, :draft, :boolean, :default => false, :null => false
+ add_column :profile_photos, :draft, :boolean, default: false, null: false
end
def self.down
diff --git a/db/migrate/086_allow_null_profile_photo_user.rb b/db/migrate/086_allow_null_profile_photo_user.rb
index 9eba3deccb..788cff3306 100644
--- a/db/migrate/086_allow_null_profile_photo_user.rb
+++ b/db/migrate/086_allow_null_profile_photo_user.rb
@@ -1,6 +1,6 @@
class AllowNullProfilePhotoUser < ActiveRecord::Migration[4.2] # 2.3
def self.up
- change_column :profile_photos, :user_id, :integer, :null => true
+ change_column :profile_photos, :user_id, :integer, null: true
end
def self.down
diff --git a/db/migrate/087_add_about_me.rb b/db/migrate/087_add_about_me.rb
index 0f84e34d75..41ade2a852 100644
--- a/db/migrate/087_add_about_me.rb
+++ b/db/migrate/087_add_about_me.rb
@@ -1,6 +1,6 @@
class AddAboutMe < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :users, :about_me, :text, :null => false, :default => ""
+ add_column :users, :about_me, :text, null: false, default: ""
end
def self.down
diff --git a/db/migrate/090_remove_tag_uniqueness.rb b/db/migrate/090_remove_tag_uniqueness.rb
index 51b93d8f1d..595db36b9a 100644
--- a/db/migrate/090_remove_tag_uniqueness.rb
+++ b/db/migrate/090_remove_tag_uniqueness.rb
@@ -5,7 +5,7 @@ def self.up
if ActiveRecord::Base.connection.adapter_name != "MySQL"
remove_index :public_body_tags, [:public_body_id, :name]
# allow the key to repeat, but not the value also
- add_index :public_body_tags, [:public_body_id, :name, :value], :unique => true
+ add_index :public_body_tags, [:public_body_id, :name, :value], unique: true
end
end
diff --git a/db/migrate/093_move_to_has_tag_string.rb b/db/migrate/093_move_to_has_tag_string.rb
index b819626611..59d6b70cb8 100644
--- a/db/migrate/093_move_to_has_tag_string.rb
+++ b/db/migrate/093_move_to_has_tag_string.rb
@@ -10,7 +10,7 @@ def self.up
# the model needs a default value, so build in stages:
add_column :has_tag_string_tags, :model, :string
HasTagString::HasTagStringTag.update_all "model = 'PublicBody'"
- change_column :has_tag_string_tags, :model, :string, :null => false
+ change_column :has_tag_string_tags, :model, :string, null: false
# just use this for a fresh project:
# add_column :has_tag_string_tags, :model, :string, :null => false
diff --git a/db/migrate/094_remove_old_tags_foreign_key.rb b/db/migrate/094_remove_old_tags_foreign_key.rb
index b361d437ff..760b9b8cbc 100644
--- a/db/migrate/094_remove_old_tags_foreign_key.rb
+++ b/db/migrate/094_remove_old_tags_foreign_key.rb
@@ -4,7 +4,7 @@ def self.up
execute "ALTER TABLE has_tag_string_tags DROP CONSTRAINT fk_public_body_tags_public_body"
end
- add_index :has_tag_string_tags, [:model, :model_id, :name, :value], :name => 'by_model_and_model_id_and_name_and_value'
+ add_index :has_tag_string_tags, [:model, :model_id, :name, :value], name: 'by_model_and_model_id_and_name_and_value'
end
def self.down
diff --git a/db/migrate/096_create_translation_tables.rb b/db/migrate/096_create_translation_tables.rb
index c914a6fc6f..bf3d7b741c 100644
--- a/db/migrate/096_create_translation_tables.rb
+++ b/db/migrate/096_create_translation_tables.rb
@@ -6,13 +6,13 @@ class ::PublicBody
end
def self.up
- fields = { :name => :text,
- :short_name => :text,
- :request_email => :text,
- :url_name => :text,
- :notes => :text,
- :first_letter => :string,
- :publication_scheme => :text }
+ fields = { name: :text,
+ short_name: :text,
+ request_email: :text,
+ url_name: :text,
+ notes: :text,
+ first_letter: :string,
+ publication_scheme: :text }
PublicBody.create_translation_table!(fields)
# copy current values across to default locale
diff --git a/db/migrate/097_add_comment_locale.rb b/db/migrate/097_add_comment_locale.rb
index 920a89d76e..3be8631521 100644
--- a/db/migrate/097_add_comment_locale.rb
+++ b/db/migrate/097_add_comment_locale.rb
@@ -1,6 +1,6 @@
class AddCommentLocale < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :comments, :locale, :text, :null => false, :default => ""
+ add_column :comments, :locale, :text, null: false, default: ""
end
def self.down
diff --git a/db/migrate/099_move_raw_email_to_filesystem.rb b/db/migrate/099_move_raw_email_to_filesystem.rb
index 3676ae6953..4bc053005e 100644
--- a/db/migrate/099_move_raw_email_to_filesystem.rb
+++ b/db/migrate/099_move_raw_email_to_filesystem.rb
@@ -1,6 +1,6 @@
class MoveRawEmailToFilesystem < ActiveRecord::Migration[4.2] # 2.3
def self.up
- RawEmail.find_each(:batch_size => 10) do |raw_email|
+ RawEmail.find_each(batch_size: 10) do |raw_email|
if !File.exist?(raw_email.filepath)
STDERR.puts "converting raw_email #{raw_email.id.to_s}"
raw_email.data = raw_email.dbdata
diff --git a/db/migrate/101_add_hash_to_info_request.rb b/db/migrate/101_add_hash_to_info_request.rb
index ad8da2ef76..8613721974 100644
--- a/db/migrate/101_add_hash_to_info_request.rb
+++ b/db/migrate/101_add_hash_to_info_request.rb
@@ -9,7 +9,7 @@ def self.up
info_request.idhash = Digest::SHA1.hexdigest(info_request.id.to_s + AlaveteliConfiguration::incoming_email_secret)[0,8]
info_request.save!
end
- change_column :info_requests, :idhash, :string, :null => false
+ change_column :info_requests, :idhash, :string, null: false
end
def self.down
remove_column :info_requests, :idhash
diff --git a/db/migrate/103_add_user_bounce_columns.rb b/db/migrate/103_add_user_bounce_columns.rb
index 5d27d4b072..d4ac9a181d 100644
--- a/db/migrate/103_add_user_bounce_columns.rb
+++ b/db/migrate/103_add_user_bounce_columns.rb
@@ -3,7 +3,7 @@
class AddUserBounceColumns < ActiveRecord::Migration[4.2] # 2.3
def self.up
add_column :users, :email_bounced_at, :datetime
- add_column :users, :email_bounce_message, :text, :default => "", :null => false
+ add_column :users, :email_bounce_message, :text, default: "", null: false
end
def self.down
remove_column :users, :email_bounced_at
diff --git a/db/migrate/106_add_hex_digest_to_foi_attachment.rb b/db/migrate/106_add_hex_digest_to_foi_attachment.rb
index 2df588f4f3..390127e23e 100644
--- a/db/migrate/106_add_hex_digest_to_foi_attachment.rb
+++ b/db/migrate/106_add_hex_digest_to_foi_attachment.rb
@@ -1,6 +1,6 @@
class AddHexDigestToFoiAttachment < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :foi_attachments, :hexdigest, :string, :limit => 32
+ add_column :foi_attachments, :hexdigest, :string, limit: 32
end
def self.down
diff --git a/db/migrate/110_add_user_no_limit.rb b/db/migrate/110_add_user_no_limit.rb
index be4094742f..25f2cd4538 100644
--- a/db/migrate/110_add_user_no_limit.rb
+++ b/db/migrate/110_add_user_no_limit.rb
@@ -2,7 +2,7 @@
class AddUserNoLimit < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :users, :no_limit, :boolean, :default => false, :null => false
+ add_column :users, :no_limit, :boolean, default: false, null: false
end
def self.down
remove_column :users, :no_limit
diff --git a/db/migrate/111_create_purge_requests.rb b/db/migrate/111_create_purge_requests.rb
index c732894797..12e7a21f96 100644
--- a/db/migrate/111_create_purge_requests.rb
+++ b/db/migrate/111_create_purge_requests.rb
@@ -2,9 +2,9 @@ class CreatePurgeRequests < ActiveRecord::Migration[4.2] # 2.3
def self.up
create_table :purge_requests do |t|
t.column :url, :string
- t.column :created_at, :datetime, :null => false
- t.column :model, :string, :null => false
- t.column :model_id, :integer, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :model, :string, null: false
+ t.column :model_id, :integer, null: false
end
end
diff --git a/db/migrate/113_add_external_fields_to_info_requests.rb b/db/migrate/113_add_external_fields_to_info_requests.rb
index 3ac03b57de..38ec6449fb 100644
--- a/db/migrate/113_add_external_fields_to_info_requests.rb
+++ b/db/migrate/113_add_external_fields_to_info_requests.rb
@@ -1,8 +1,8 @@
class AddExternalFieldsToInfoRequests < ActiveRecord::Migration[4.2] # 2.3
def self.up
change_column_null :info_requests, :user_id, true
- add_column :info_requests, :external_user_name, :string, :null => true
- add_column :info_requests, :external_url, :string, :null => true
+ add_column :info_requests, :external_user_name, :string, null: true
+ add_column :info_requests, :external_url, :string, null: true
# NB This is corrected in 20120822145640
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
diff --git a/db/migrate/114_add_attention_requested_flag_to_info_requests.rb b/db/migrate/114_add_attention_requested_flag_to_info_requests.rb
index 878f484a30..e6df33d6f5 100644
--- a/db/migrate/114_add_attention_requested_flag_to_info_requests.rb
+++ b/db/migrate/114_add_attention_requested_flag_to_info_requests.rb
@@ -2,7 +2,7 @@
class AddAttentionRequestedFlagToInfoRequests < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :info_requests, :attention_requested, :boolean, :default => false
+ add_column :info_requests, :attention_requested, :boolean, default: false
end
def self.down
remove_column :info_requests, :attention_requested
diff --git a/db/migrate/115_add_receive_email_alerts_to_user.rb b/db/migrate/115_add_receive_email_alerts_to_user.rb
index 5428acb919..587227e7f3 100644
--- a/db/migrate/115_add_receive_email_alerts_to_user.rb
+++ b/db/migrate/115_add_receive_email_alerts_to_user.rb
@@ -1,6 +1,6 @@
class AddReceiveEmailAlertsToUser < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :users, :receive_email_alerts, :boolean, :default => true, :null => false
+ add_column :users, :receive_email_alerts, :boolean, default: true, null: false
end
def self.down
remove_column :users, :receive_email_alerts
diff --git a/db/migrate/117_create_sessions.rb b/db/migrate/117_create_sessions.rb
index ee0f7c8739..48a44d456c 100644
--- a/db/migrate/117_create_sessions.rb
+++ b/db/migrate/117_create_sessions.rb
@@ -1,9 +1,9 @@
class CreateSessions < ActiveRecord::Migration[4.2] # 2.3
def self.up
create_table :sessions do |t|
- t.string :session_id, :null => false
+ t.string :session_id, null: false
t.text :data
- t.timestamps :null => false
+ t.timestamps null: false
end
add_index :sessions, :session_id
diff --git a/db/migrate/118_remove_sessions_again.rb b/db/migrate/118_remove_sessions_again.rb
index 40fb624b98..4f011553c4 100644
--- a/db/migrate/118_remove_sessions_again.rb
+++ b/db/migrate/118_remove_sessions_again.rb
@@ -5,9 +5,9 @@ def self.up
def self.down
create_table :sessions do |t|
- t.string :session_id, :null => false
+ t.string :session_id, null: false
t.text :data
- t.timestamps :null => false
+ t.timestamps null: false
end
add_index :sessions, :session_id
diff --git a/db/migrate/20120910153022_create_request_classifications.rb b/db/migrate/20120910153022_create_request_classifications.rb
index 72ff8cd331..14e51c170b 100644
--- a/db/migrate/20120910153022_create_request_classifications.rb
+++ b/db/migrate/20120910153022_create_request_classifications.rb
@@ -3,7 +3,7 @@ def self.up
create_table :request_classifications do |t|
t.integer :user_id
t.integer :info_request_event_id
- t.timestamps :null => false
+ t.timestamps null: false
end
add_index :request_classifications, :user_id
end
diff --git a/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb b/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb
index 94a9a1bee6..e97dfa5c07 100644
--- a/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb
+++ b/db/migrate/20120912170035_add_info_requests_count_to_public_bodies.rb
@@ -1,6 +1,6 @@
class AddInfoRequestsCountToPublicBodies < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :public_bodies, :info_requests_count, :integer, :null => false, :default => 0
+ add_column :public_bodies, :info_requests_count, :integer, null: false, default: 0
PublicBody.connection.execute("UPDATE public_bodies
SET info_requests_count = (SELECT COUNT(*) FROM info_requests
diff --git a/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb b/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb
index 02c7b5736c..c1968fc190 100644
--- a/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb
+++ b/db/migrate/20120919140404_add_comments_allowed_to_info_request.rb
@@ -1,6 +1,6 @@
class AddCommentsAllowedToInfoRequest < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :info_requests, :comments_allowed, :boolean, :null => false, :default => true
+ add_column :info_requests, :comments_allowed, :boolean, null: false, default: true
end
def self.down
diff --git a/db/migrate/20121022031914_add_disclosure_log.rb b/db/migrate/20121022031914_add_disclosure_log.rb
index 54917bfbb4..e14cd55f52 100644
--- a/db/migrate/20121022031914_add_disclosure_log.rb
+++ b/db/migrate/20121022031914_add_disclosure_log.rb
@@ -1,7 +1,7 @@
class AddDisclosureLog < ActiveRecord::Migration[4.2] # 2.3
def self.up
- add_column :public_bodies, :disclosure_log, :text, :null => false, :default => ""
- add_column :public_body_versions, :disclosure_log, :text, :null => false, :default => ""
+ add_column :public_bodies, :disclosure_log, :text, null: false, default: ""
+ add_column :public_body_versions, :disclosure_log, :text, null: false, default: ""
add_column :public_body_translations, :disclosure_log, :text
end
diff --git a/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb b/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb
index c2f48c6130..b102b1bc63 100644
--- a/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb
+++ b/db/migrate/20130731142632_remove_prominence_from_info_request_event.rb
@@ -4,6 +4,6 @@ def up
end
def down
- add_column :info_request_events, :prominence, :string, :null => false, :default => 'normal'
+ add_column :info_request_events, :prominence, :string, null: false, default: 'normal'
end
end
diff --git a/db/migrate/20130731145325_add_prominence_to_incoming_message.rb b/db/migrate/20130731145325_add_prominence_to_incoming_message.rb
index 3362894cf8..eca1868f8d 100644
--- a/db/migrate/20130731145325_add_prominence_to_incoming_message.rb
+++ b/db/migrate/20130731145325_add_prominence_to_incoming_message.rb
@@ -1,5 +1,5 @@
class AddProminenceToIncomingMessage < ActiveRecord::Migration[4.2] # 3.1
def change
- add_column :incoming_messages, :prominence, :string, :null => false, :default => 'normal'
+ add_column :incoming_messages, :prominence, :string, null: false, default: 'normal'
end
end
diff --git a/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb b/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb
index dbef805924..39b9ec3fd1 100644
--- a/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb
+++ b/db/migrate/20130822161803_add_prominence_fields_to_outgoing_message.rb
@@ -1,6 +1,6 @@
class AddProminenceFieldsToOutgoingMessage < ActiveRecord::Migration[4.2] # 3.1
def change
- add_column :outgoing_messages, :prominence, :string, :null => false, :default => 'normal'
+ add_column :outgoing_messages, :prominence, :string, null: false, default: 'normal'
add_column :outgoing_messages, :prominence_reason, :text
end
end
diff --git a/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb b/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb
index e66683c8a1..ec1f7fd7f4 100644
--- a/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb
+++ b/db/migrate/20130919151140_add_can_make_batch_requests_to_user.rb
@@ -1,5 +1,5 @@
class AddCanMakeBatchRequestsToUser < ActiveRecord::Migration[4.2] # 3.2
def change
- add_column :users, :can_make_batch_requests, :boolean, :default => false, :null => false
+ add_column :users, :can_make_batch_requests, :boolean, default: false, null: false
end
end
diff --git a/db/migrate/20131024114346_create_info_request_batches.rb b/db/migrate/20131024114346_create_info_request_batches.rb
index 95fb2433b4..b311151cf9 100644
--- a/db/migrate/20131024114346_create_info_request_batches.rb
+++ b/db/migrate/20131024114346_create_info_request_batches.rb
@@ -1,11 +1,11 @@
class CreateInfoRequestBatches < ActiveRecord::Migration[4.2] # 3.2
def up
create_table :info_request_batches do |t|
- t.column :title, :text, :null => false
- t.column :user_id, :integer, :null => false
- t.timestamps :null => false
+ t.column :title, :text, null: false
+ t.column :user_id, :integer, null: false
+ t.timestamps null: false
end
- add_column :info_requests, :info_request_batch_id, :integer, :null => true
+ add_column :info_requests, :info_request_batch_id, :integer, null: true
if ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
execute "ALTER TABLE info_requests
ADD CONSTRAINT fk_info_requests_info_request_batch
diff --git a/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb
index 8c2fc616ee..44dc9e17eb 100644
--- a/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb
+++ b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb
@@ -1,6 +1,6 @@
class CreateInfoRequestBatchPublicBodiesJoinTable < ActiveRecord::Migration[4.2] # 3.2
def change
- create_table :info_request_batches_public_bodies, :id => false do |t|
+ create_table :info_request_batches_public_bodies, id: false do |t|
t.integer :info_request_batch_id
t.integer :public_body_id
end
diff --git a/db/migrate/20131211152641_create_public_body_change_requests.rb b/db/migrate/20131211152641_create_public_body_change_requests.rb
index 39d5cee080..98cabe0635 100644
--- a/db/migrate/20131211152641_create_public_body_change_requests.rb
+++ b/db/migrate/20131211152641_create_public_body_change_requests.rb
@@ -9,8 +9,8 @@ def up
t.column :public_body_email, :string
t.column :source_url, :text
t.column :notes, :text
- t.column :is_open, :boolean, :null => false, :default => true
- t.timestamps :null => false
+ t.column :is_open, :boolean, null: false, default: true
+ t.timestamps null: false
end
end
diff --git a/db/migrate/20140325120619_create_spam_addresses.rb b/db/migrate/20140325120619_create_spam_addresses.rb
index 7225a7ca42..9e99b23f25 100644
--- a/db/migrate/20140325120619_create_spam_addresses.rb
+++ b/db/migrate/20140325120619_create_spam_addresses.rb
@@ -1,9 +1,9 @@
class CreateSpamAddresses < ActiveRecord::Migration[4.2] # 3.2
def change
create_table :spam_addresses do |t|
- t.string :email, :null => false
+ t.string :email, null: false
- t.timestamps :null => false
+ t.timestamps null: false
end
end
end
diff --git a/db/migrate/20140710094405_create_public_body_headings_and_categories.rb b/db/migrate/20140710094405_create_public_body_headings_and_categories.rb
index 28d2f796ce..d604681cce 100644
--- a/db/migrate/20140710094405_create_public_body_headings_and_categories.rb
+++ b/db/migrate/20140710094405_create_public_body_headings_and_categories.rb
@@ -1,21 +1,21 @@
class CreatePublicBodyHeadingsAndCategories < ActiveRecord::Migration[4.2] # 3.2
def up
- create_table :public_body_headings, :force => true do |t|
+ create_table :public_body_headings, force: true do |t|
t.string :locale
- t.text :name, :null => false
+ t.text :name, null: false
t.integer :display_order
end
- create_table :public_body_categories, :force => true do |t|
+ create_table :public_body_categories, force: true do |t|
t.string :locale
- t.text :title, :null => false
- t.text :category_tag, :null => false
- t.text :description, :null => false
+ t.text :title, null: false
+ t.text :category_tag, null: false
+ t.text :description, null: false
end
- create_table :public_body_categories_public_body_headings, :id => false do |t|
- t.integer :public_body_category_id, :null => false
- t.integer :public_body_heading_id, :null => false
+ create_table :public_body_categories_public_body_headings, id: false do |t|
+ t.integer :public_body_category_id, null: false
+ t.integer :public_body_heading_id, null: false
end
end
diff --git a/db/migrate/20140716131107_create_category_translation_tables.rb b/db/migrate/20140716131107_create_category_translation_tables.rb
index 798f40d404..72d26aca91 100644
--- a/db/migrate/20140716131107_create_category_translation_tables.rb
+++ b/db/migrate/20140716131107_create_category_translation_tables.rb
@@ -8,12 +8,12 @@ class PublicBodyHeading < ApplicationRecord
def up
default_locale = AlaveteliLocalization.default_locale
- fields = {:title => :text,
- :description => :text}
+ fields = {title: :text,
+ description: :text}
PublicBodyCategory.create_translation_table!(fields)
# copy current values across to the default locale
- PublicBodyCategory.where(:locale => default_locale).each do |category|
+ PublicBodyCategory.where(locale: default_locale).each do |category|
category.translated_attributes.each do |a, default|
value = category.read_attribute(a)
category.send(:"#{a}=", value) unless value.nil?
@@ -45,11 +45,11 @@ def up
end
end
- fields = { :name => :text }
+ fields = { name: :text }
PublicBodyHeading.create_translation_table!(fields)
# copy current values across to the default locale
- PublicBodyHeading.where(:locale => default_locale).each do |heading|
+ PublicBodyHeading.where(locale: default_locale).each do |heading|
heading.translated_attributes.each do |a, default|
value = heading.read_attribute(a)
heading.send(:"#{a}=", value) unless value.nil?
@@ -89,7 +89,7 @@ def up
remove_column :public_body_categories, :description
# and set category_tag to be unique
- add_index :public_body_categories, :category_tag, :unique => true
+ add_index :public_body_categories, :category_tag, unique: true
end
def down
diff --git a/db/migrate/20140804120601_add_display_order_to_categories_and_headings.rb b/db/migrate/20140804120601_add_display_order_to_categories_and_headings.rb
index 105335dd5f..73bec0b685 100644
--- a/db/migrate/20140804120601_add_display_order_to_categories_and_headings.rb
+++ b/db/migrate/20140804120601_add_display_order_to_categories_and_headings.rb
@@ -3,11 +3,11 @@ def up
add_column :public_body_categories_public_body_headings, :category_display_order, :integer
rename_table :public_body_categories_public_body_headings, :public_body_category_links
add_column :public_body_category_links, :id, :primary_key
- add_index :public_body_category_links, [:public_body_category_id, :public_body_heading_id], :name => "index_public_body_category_links_on_join_ids"
+ add_index :public_body_category_links, [:public_body_category_id, :public_body_heading_id], name: "index_public_body_category_links_on_join_ids"
end
def down
- remove_index :public_body_category_links, :name => "index_public_body_category_links_on_join_ids"
+ remove_index :public_body_category_links, name: "index_public_body_category_links_on_join_ids"
remove_column :public_body_category_links, :category_display_order
remove_column :public_body_category_links, :id
rename_table :public_body_category_links, :public_body_categories_public_body_headings
diff --git a/db/migrate/20140824191444_create_widget_votes.rb b/db/migrate/20140824191444_create_widget_votes.rb
index bc42597970..40cabc6337 100644
--- a/db/migrate/20140824191444_create_widget_votes.rb
+++ b/db/migrate/20140824191444_create_widget_votes.rb
@@ -2,9 +2,9 @@ class CreateWidgetVotes < ActiveRecord::Migration[4.2] # 3.2
def change
create_table :widget_votes do |t|
t.string :cookie
- t.belongs_to :info_request, :null => false
+ t.belongs_to :info_request, null: false
- t.timestamps :null => false
+ t.timestamps null: false
end
add_index :widget_votes, :info_request_id
end
diff --git a/db/migrate/20151006101417_add_otp_enabled_to_users.rb b/db/migrate/20151006101417_add_otp_enabled_to_users.rb
index 3eabd39997..a40a173c6e 100644
--- a/db/migrate/20151006101417_add_otp_enabled_to_users.rb
+++ b/db/migrate/20151006101417_add_otp_enabled_to_users.rb
@@ -1,5 +1,5 @@
class AddOtpEnabledToUsers < ActiveRecord::Migration[4.2] # 3.2
def change
- add_column :users, :otp_enabled, :boolean, :default => false, :null => false
+ add_column :users, :otp_enabled, :boolean, default: false, null: false
end
end
diff --git a/db/migrate/20151006104739_add_counter_for_otp_to_users.rb b/db/migrate/20151006104739_add_counter_for_otp_to_users.rb
index 792ac7dbdb..3d3320cebd 100644
--- a/db/migrate/20151006104739_add_counter_for_otp_to_users.rb
+++ b/db/migrate/20151006104739_add_counter_for_otp_to_users.rb
@@ -1,5 +1,5 @@
class AddCounterForOtpToUsers < ActiveRecord::Migration[4.2] # 3.2
def change
- add_column :users, :otp_counter, :integer, :default => 1
+ add_column :users, :otp_counter, :integer, default: 1
end
end
diff --git a/db/migrate/20151009162421_add_info_requests_visible_count_to_public_bodies.rb b/db/migrate/20151009162421_add_info_requests_visible_count_to_public_bodies.rb
index 957092b5c8..9dcea71c5f 100644
--- a/db/migrate/20151009162421_add_info_requests_visible_count_to_public_bodies.rb
+++ b/db/migrate/20151009162421_add_info_requests_visible_count_to_public_bodies.rb
@@ -1,6 +1,6 @@
class AddInfoRequestsVisibleCountToPublicBodies < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :public_bodies, :info_requests_visible_count, :integer, :null => false, :default => 0
+ add_column :public_bodies, :info_requests_visible_count, :integer, null: false, default: 0
PublicBody.connection.execute("UPDATE public_bodies
SET info_requests_visible_count = (SELECT COUNT(*) FROM info_requests
diff --git a/db/migrate/20151020112248_set_longer_length_for_track_things_track_query.rb b/db/migrate/20151020112248_set_longer_length_for_track_things_track_query.rb
index d7765baee3..2da6b7c074 100644
--- a/db/migrate/20151020112248_set_longer_length_for_track_things_track_query.rb
+++ b/db/migrate/20151020112248_set_longer_length_for_track_things_track_query.rb
@@ -1,9 +1,9 @@
class SetLongerLengthForTrackThingsTrackQuery < ActiveRecord::Migration[4.2] # 3.2
def up
- change_column :track_things, :track_query, :string, :limit => 500
+ change_column :track_things, :track_query, :string, limit: 500
end
def down
- change_column :track_things, :track_query, :string, :limit => 255
+ change_column :track_things, :track_query, :string, limit: 255
end
end
diff --git a/db/migrate/20151104131702_add_last_public_response_at_to_info_request.rb b/db/migrate/20151104131702_add_last_public_response_at_to_info_request.rb
index 3aeb44b37a..c761d62514 100644
--- a/db/migrate/20151104131702_add_last_public_response_at_to_info_request.rb
+++ b/db/migrate/20151104131702_add_last_public_response_at_to_info_request.rb
@@ -1,6 +1,6 @@
class AddLastPublicResponseAtToInfoRequest < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :info_requests, :last_public_response_at, :datetime, :null => true
+ add_column :info_requests, :last_public_response_at, :datetime, null: true
InfoRequest.connection.
execute("UPDATE info_requests
diff --git a/db/migrate/20160526154304_add_confirmed_not_spam_to_users.rb b/db/migrate/20160526154304_add_confirmed_not_spam_to_users.rb
index 8691d9db5a..100e0970aa 100644
--- a/db/migrate/20160526154304_add_confirmed_not_spam_to_users.rb
+++ b/db/migrate/20160526154304_add_confirmed_not_spam_to_users.rb
@@ -1,5 +1,5 @@
class AddConfirmedNotSpamToUsers < ActiveRecord::Migration[4.2] # 3.2
def change
- add_column :users, :confirmed_not_spam, :boolean, :default => false, :null => false
+ add_column :users, :confirmed_not_spam, :boolean, default: false, null: false
end
end
diff --git a/db/migrate/20160602143125_add_reject_incoming_at_mta_to_info_request.rb b/db/migrate/20160602143125_add_reject_incoming_at_mta_to_info_request.rb
index 2f22e43108..b4a24dff0a 100644
--- a/db/migrate/20160602143125_add_reject_incoming_at_mta_to_info_request.rb
+++ b/db/migrate/20160602143125_add_reject_incoming_at_mta_to_info_request.rb
@@ -1,6 +1,6 @@
class AddRejectIncomingAtMtaToInfoRequest < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :info_requests, :reject_incoming_at_mta, :boolean, :default => false, :null => false
+ add_column :info_requests, :reject_incoming_at_mta, :boolean, default: false, null: false
end
def down
diff --git a/db/migrate/20160602145046_add_rejected_incoming_count_to_info_request.rb b/db/migrate/20160602145046_add_rejected_incoming_count_to_info_request.rb
index bc7763558b..719d56a2c1 100644
--- a/db/migrate/20160602145046_add_rejected_incoming_count_to_info_request.rb
+++ b/db/migrate/20160602145046_add_rejected_incoming_count_to_info_request.rb
@@ -1,6 +1,6 @@
class AddRejectedIncomingCountToInfoRequest < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :info_requests, :rejected_incoming_count, :integer, :default => 0
+ add_column :info_requests, :rejected_incoming_count, :integer, default: 0
end
def down
diff --git a/db/migrate/20160613145644_add_comments_count_to_users.rb b/db/migrate/20160613145644_add_comments_count_to_users.rb
index ca411329c2..fa328121fc 100644
--- a/db/migrate/20160613145644_add_comments_count_to_users.rb
+++ b/db/migrate/20160613145644_add_comments_count_to_users.rb
@@ -1,6 +1,6 @@
class AddCommentsCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :comments_count, :integer, :default => 0, :null => false
+ add_column :users, :comments_count, :integer, default: 0, null: false
Comment.distinct.pluck(:user_id).compact.each do |user_id|
User.reset_counters(user_id, :comments)
diff --git a/db/migrate/20160613151127_add_info_requests_count_to_users.rb b/db/migrate/20160613151127_add_info_requests_count_to_users.rb
index ab7c1dd936..3145e2baca 100644
--- a/db/migrate/20160613151127_add_info_requests_count_to_users.rb
+++ b/db/migrate/20160613151127_add_info_requests_count_to_users.rb
@@ -1,6 +1,6 @@
class AddInfoRequestsCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :info_requests_count, :integer, :default => 0, :null => false
+ add_column :users, :info_requests_count, :integer, default: 0, null: false
InfoRequest.distinct.pluck(:user_id).compact.each do |user_id|
User.reset_counters(user_id, :info_requests)
diff --git a/db/migrate/20160613151912_add_track_things_count_to_users.rb b/db/migrate/20160613151912_add_track_things_count_to_users.rb
index b17e7bfafb..17dd14a847 100644
--- a/db/migrate/20160613151912_add_track_things_count_to_users.rb
+++ b/db/migrate/20160613151912_add_track_things_count_to_users.rb
@@ -1,6 +1,6 @@
class AddTrackThingsCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :track_things_count, :integer, :default => 0, :null => false
+ add_column :users, :track_things_count, :integer, default: 0, null: false
TrackThing.distinct.pluck(:tracking_user_id).compact.each do |user_id|
User.reset_counters(user_id, :track_things)
diff --git a/db/migrate/20160613152433_add_request_classifications_count_to_users.rb b/db/migrate/20160613152433_add_request_classifications_count_to_users.rb
index 8225001cd4..36510c2cf7 100644
--- a/db/migrate/20160613152433_add_request_classifications_count_to_users.rb
+++ b/db/migrate/20160613152433_add_request_classifications_count_to_users.rb
@@ -1,6 +1,6 @@
class AddRequestClassificationsCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :request_classifications_count, :integer, :default => 0, :null => false
+ add_column :users, :request_classifications_count, :integer, default: 0, null: false
RequestClassification.distinct.pluck(:user_id).compact.each do |user_id|
User.reset_counters(user_id, :request_classifications)
diff --git a/db/migrate/20160613153739_add_public_body_change_requests_count_to_users.rb b/db/migrate/20160613153739_add_public_body_change_requests_count_to_users.rb
index 871f99940b..108c1ab016 100644
--- a/db/migrate/20160613153739_add_public_body_change_requests_count_to_users.rb
+++ b/db/migrate/20160613153739_add_public_body_change_requests_count_to_users.rb
@@ -1,6 +1,6 @@
class AddPublicBodyChangeRequestsCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :public_body_change_requests_count, :integer, :default => 0, :null => false
+ add_column :users, :public_body_change_requests_count, :integer, default: 0, null: false
PublicBodyChangeRequest.distinct.pluck(:user_id).compact.each do |user_id|
User.reset_counters(user_id, :public_body_change_requests)
diff --git a/db/migrate/20160613154616_add_info_request_batches_count_to_users.rb b/db/migrate/20160613154616_add_info_request_batches_count_to_users.rb
index cd802279ec..777ea609be 100644
--- a/db/migrate/20160613154616_add_info_request_batches_count_to_users.rb
+++ b/db/migrate/20160613154616_add_info_request_batches_count_to_users.rb
@@ -1,6 +1,6 @@
class AddInfoRequestBatchesCountToUsers < ActiveRecord::Migration[4.2] # 3.2
def up
- add_column :users, :info_request_batches_count, :integer, :default => 0, :null => false
+ add_column :users, :info_request_batches_count, :integer, default: 0, null: false
InfoRequestBatch.distinct.pluck(:user_id).compact.each do |user_id|
User.reset_counters(user_id, :info_request_batches)
diff --git a/db/migrate/20160701155339_remove_comment_type_from_comment.rb b/db/migrate/20160701155339_remove_comment_type_from_comment.rb
index 9b99a3186c..dbcdfc5b26 100644
--- a/db/migrate/20160701155339_remove_comment_type_from_comment.rb
+++ b/db/migrate/20160701155339_remove_comment_type_from_comment.rb
@@ -4,6 +4,6 @@ def up
end
def down
- add_column :comments, :comment_type, :string, :null => false, :default => 'request'
+ add_column :comments, :comment_type, :string, null: false, default: 'request'
end
end
diff --git a/db/migrate/20170216101547_add_attention_requested_to_comment.rb b/db/migrate/20170216101547_add_attention_requested_to_comment.rb
index 1c3b419713..09487c1f5c 100644
--- a/db/migrate/20170216101547_add_attention_requested_to_comment.rb
+++ b/db/migrate/20170216101547_add_attention_requested_to_comment.rb
@@ -1,6 +1,6 @@
class AddAttentionRequestedToComment < ActiveRecord::Migration[4.2] # 4.0
def change
add_column :comments, :attention_requested, :boolean,
- :null => false, :default => false
+ null: false, default: false
end
end
diff --git a/db/migrate/20170227140831_rolify_create_roles.rb b/db/migrate/20170227140831_rolify_create_roles.rb
index 83e238b70b..fcc4ca7d86 100644
--- a/db/migrate/20170227140831_rolify_create_roles.rb
+++ b/db/migrate/20170227140831_rolify_create_roles.rb
@@ -2,12 +2,12 @@ class RolifyCreateRoles < ActiveRecord::Migration[4.2] # 4.0
def change
create_table(:roles) do |t|
t.string :name
- t.references :resource, :polymorphic => true
+ t.references :resource, polymorphic: true
- t.timestamps :null => false
+ t.timestamps null: false
end
- create_table(:users_roles, :id => false) do |t|
+ create_table(:users_roles, id: false) do |t|
t.references :user
t.references :role
end
diff --git a/db/migrate/20170301163735_create_draft_info_request_batches.rb b/db/migrate/20170301163735_create_draft_info_request_batches.rb
index 301533d70b..ee5d72822e 100644
--- a/db/migrate/20170301163735_create_draft_info_request_batches.rb
+++ b/db/migrate/20170301163735_create_draft_info_request_batches.rb
@@ -5,7 +5,7 @@ def change
t.text :body
t.references :user
- t.timestamps :null => false
+ t.timestamps null: false
end
add_index :draft_info_request_batches, :user_id
end
diff --git a/db/migrate/20170301164705_create_draft_info_request_batches_public_bodies_table.rb b/db/migrate/20170301164705_create_draft_info_request_batches_public_bodies_table.rb
index 9179e28a7d..d5253f12f5 100644
--- a/db/migrate/20170301164705_create_draft_info_request_batches_public_bodies_table.rb
+++ b/db/migrate/20170301164705_create_draft_info_request_batches_public_bodies_table.rb
@@ -1,7 +1,7 @@
class CreateDraftInfoRequestBatchesPublicBodiesTable < ActiveRecord::Migration[4.2] # 4.0
def change
create_table :draft_info_request_batches_public_bodies,
- :id => false do |t|
+ id: false do |t|
t.references :draft_info_request_batch
t.references :public_body
end
diff --git a/db/migrate/20170316170248_edit_info_request_batch_index.rb b/db/migrate/20170316170248_edit_info_request_batch_index.rb
index 0cf71de5d1..ffa081ab54 100644
--- a/db/migrate/20170316170248_edit_info_request_batch_index.rb
+++ b/db/migrate/20170316170248_edit_info_request_batch_index.rb
@@ -1,6 +1,6 @@
class EditInfoRequestBatchIndex < ActiveRecord::Migration[4.2] # 4.0
def change
- remove_index :info_request_batches, :column => [:user_id, :body, :title]
+ remove_index :info_request_batches, column: [:user_id, :body, :title]
add_index :info_request_batches, [:user_id, :title]
end
end
diff --git a/db/migrate/20170411113908_create_alaveteli_pro_request_summaries.rb b/db/migrate/20170411113908_create_alaveteli_pro_request_summaries.rb
index 4c9c8c736b..42b93f086a 100644
--- a/db/migrate/20170411113908_create_alaveteli_pro_request_summaries.rb
+++ b/db/migrate/20170411113908_create_alaveteli_pro_request_summaries.rb
@@ -4,9 +4,9 @@ def change
t.text :title
t.text :body
t.text :public_body_names
- t.references :summarisable, :polymorphic => true
+ t.references :summarisable, polymorphic: true
- t.timestamps :null => false
+ t.timestamps null: false
end
end
end
diff --git a/db/migrate/20170412141214_add_unique_index_to_summarisable.rb b/db/migrate/20170412141214_add_unique_index_to_summarisable.rb
index 167df22e25..90832d6c25 100644
--- a/db/migrate/20170412141214_add_unique_index_to_summarisable.rb
+++ b/db/migrate/20170412141214_add_unique_index_to_summarisable.rb
@@ -2,7 +2,7 @@ class AddUniqueIndexToSummarisable < ActiveRecord::Migration[4.2] # 4.1
def change
add_index :request_summaries,
[:summarisable_type, :summarisable_id],
- :unique => true,
- :name => "index_request_summaries_on_summarisable"
+ unique: true,
+ name: "index_request_summaries_on_summarisable"
end
end
diff --git a/db/migrate/20170412150729_create_alaveteli_pro_request_summary_categories.rb b/db/migrate/20170412150729_create_alaveteli_pro_request_summary_categories.rb
index d1979a48d5..0769d37bd1 100644
--- a/db/migrate/20170412150729_create_alaveteli_pro_request_summary_categories.rb
+++ b/db/migrate/20170412150729_create_alaveteli_pro_request_summary_categories.rb
@@ -1,18 +1,18 @@
class CreateAlaveteliProRequestSummaryCategories < ActiveRecord::Migration[4.2] # 4.1
def change
create_table :request_summary_categories do |t|
- t.text :slug, :unique => true
- t.timestamps :null => false
+ t.text :slug, unique: true
+ t.timestamps null: false
end
create_join_table :request_summaries, :request_summary_categories,
table_name: 'request_summaries_summary_categories' do |t|
t.index [:request_summary_id, :request_summary_category_id],
- :unique => :true,
- :name => 'index_request_summaries_summary_categories_unique'
+ unique: :true,
+ name: 'index_request_summaries_summary_categories_unique'
t.index [:request_summary_category_id, :request_summary_id],
- :unique => :true,
- :name => 'index_request_summary_categories_summaries_unique'
+ unique: :true,
+ name: 'index_request_summary_categories_summaries_unique'
end
end
end
diff --git a/db/migrate/20170717141302_drop_public_body_translated_columns.rb b/db/migrate/20170717141302_drop_public_body_translated_columns.rb
index 1effc1d374..46ae9fb9f7 100644
--- a/db/migrate/20170717141302_drop_public_body_translated_columns.rb
+++ b/db/migrate/20170717141302_drop_public_body_translated_columns.rb
@@ -5,14 +5,14 @@ def up
translation =
record.translation_for(AlaveteliLocalization.default_locale) ||
record.translations.build(
- :locale => AlaveteliLocalization.default_locale
+ locale: AlaveteliLocalization.default_locale
)
if translation.new_record?
fields = record.translated_attribute_names
fields.each do |attribute_name|
translation[attribute_name] =
- record.read_attribute(attribute_name, :translated => false)
+ record.read_attribute(attribute_name, translated: false)
end
if translation.save
@@ -68,15 +68,15 @@ def down
# UPDATE statement rather than record.update which will
# use the overridden attribute setters and update translations instead)
puts "Migrating default locale translation to public body #{record.id}"
- PublicBody.where(:id => record.id).update_all(fields_to_update)
+ PublicBody.where(id: record.id).update_all(fields_to_update)
end
end
# Re-add the constraints
change_column :public_bodies,
- :name, :text, :null => false
- change_column :public_bodies, :request_email, :text, :null => false
- change_column :public_bodies, :url_name, :text, :null => false
- change_column :public_bodies, :first_letter, :string, :null => false
+ :name, :text, null: false
+ change_column :public_bodies, :request_email, :text, null: false
+ change_column :public_bodies, :url_name, :text, null: false
+ change_column :public_bodies, :first_letter, :string, null: false
end
end
diff --git a/db/migrate/20170914164031_remove_purge_request.rb b/db/migrate/20170914164031_remove_purge_request.rb
index 42507cfdbe..9a2d1d8605 100644
--- a/db/migrate/20170914164031_remove_purge_request.rb
+++ b/db/migrate/20170914164031_remove_purge_request.rb
@@ -6,9 +6,9 @@ def up
def down
create_table :purge_requests do |t|
t.column :url, :string
- t.column :created_at, :datetime, :null => false
- t.column :model, :string, :null => false
- t.column :model_id, :integer, :null => false
+ t.column :created_at, :datetime, null: false
+ t.column :model, :string, null: false
+ t.column :model_id, :integer, null: false
end
end
end
diff --git a/db/migrate/20170922160120_remove_admin_level.rb b/db/migrate/20170922160120_remove_admin_level.rb
index b3221fb326..188b3c0917 100644
--- a/db/migrate/20170922160120_remove_admin_level.rb
+++ b/db/migrate/20170922160120_remove_admin_level.rb
@@ -4,6 +4,6 @@ def self.up
end
def self.down
- add_column :users, :admin_level, :string, :null => false, :default => 'none'
+ add_column :users, :admin_level, :string, null: false, default: 'none'
end
end
From 338a84d8305d65d41fc1ca5f895f389d4633e614 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:03:08 +0000
Subject: [PATCH 100/289] Style: HashSyntax Rubocop (mailers)
---
app/mailers/alaveteli_pro/account_mailer.rb | 6 +-
app/mailers/alaveteli_pro/embargo_mailer.rb | 6 +-
app/mailers/application_mailer.rb | 6 +-
app/mailers/contact_mailer.rb | 20 ++--
app/mailers/info_request_batch_mailer.rb | 2 +-
app/mailers/notification_mailer.rb | 6 +-
app/mailers/outgoing_mailer.rb | 18 ++--
app/mailers/reminder_mailer.rb | 6 +-
app/mailers/request_mailer.rb | 70 ++++++------
app/mailers/track_mailer.rb | 22 ++--
app/mailers/user_mailer.rb | 12 +--
.../mailers/info_request_batch_mailer_spec.rb | 2 +-
spec/mailers/outgoing_mailer_spec.rb | 24 ++---
spec/mailers/request_mailer_spec.rb | 102 +++++++++---------
spec/mailers/track_mailer_spec.rb | 32 +++---
15 files changed, 167 insertions(+), 167 deletions(-)
diff --git a/app/mailers/alaveteli_pro/account_mailer.rb b/app/mailers/alaveteli_pro/account_mailer.rb
index af4ea2e789..b33d9f0c18 100644
--- a/app/mailers/alaveteli_pro/account_mailer.rb
+++ b/app/mailers/alaveteli_pro/account_mailer.rb
@@ -10,9 +10,9 @@ def account_request(account_request)
set_reply_to_headers(nil, 'Reply-To' => @account_request.email)
# From is an address we control so that strict DMARC senders don't get refused
- mail(:from => blackhole_email,
- :to => pro_contact_from_name_and_email,
- :subject => _("{{pro_site_name}} account request",
+ mail(from: blackhole_email,
+ to: pro_contact_from_name_and_email,
+ subject: _("{{pro_site_name}} account request",
pro_site_name: pro_site_name)
)
end
diff --git a/app/mailers/alaveteli_pro/embargo_mailer.rb b/app/mailers/alaveteli_pro/embargo_mailer.rb
index 8d8bc2b53e..28769da5b4 100644
--- a/app/mailers/alaveteli_pro/embargo_mailer.rb
+++ b/app/mailers/alaveteli_pro/embargo_mailer.rb
@@ -106,9 +106,9 @@ def auto_generated_headers
def mail_user(user, subject)
mail({
- :from => pro_contact_from_name_and_email,
- :to => user.name_and_email,
- :subject => subject,
+ from: pro_contact_from_name_and_email,
+ to: user.name_and_email,
+ subject: subject,
})
end
end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index e5e80adeb2..a08db4028a 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -30,9 +30,9 @@ def blackhole_email
def mail_user(user, subject, opts = {})
default_opts = {
- :from => contact_for_user(user),
- :to => user.name_and_email,
- :subject => subject,
+ from: contact_for_user(user),
+ to: user.name_and_email,
+ subject: subject,
}
default_opts.merge!(opts)
mail(default_opts)
diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb
index c84661a621..f7c90fb3c8 100644
--- a/app/mailers/contact_mailer.rb
+++ b/app/mailers/contact_mailer.rb
@@ -18,9 +18,9 @@ def to_admin_message(name, email, subject, message, logged_in_user, last_request
set_reply_to_headers(nil, 'Reply-To' => reply_to_address)
# From is an address we control so that strict DMARC senders don't get refused
- mail(:from => MailHandler.address_from_name_and_email(name, blackhole_email),
- :to => contact_for_user(@logged_in_user),
- :subject => subject)
+ mail(from: MailHandler.address_from_name_and_email(name, blackhole_email),
+ to: contact_for_user(@logged_in_user),
+ subject: subject)
end
# Send message to another user
@@ -33,9 +33,9 @@ def user_message(from_user, recipient_user, from_user_url, subject, message)
set_reply_to_headers(nil, 'Reply-To' => from_user.name_and_email)
# From is an address we control so that strict DMARC senders don't get refused
- mail(:from => MailHandler.address_from_name_and_email(from_user.name, blackhole_email),
- :to => recipient_user.name_and_email,
- :subject => subject)
+ mail(from: MailHandler.address_from_name_and_email(from_user.name, blackhole_email),
+ to: recipient_user.name_and_email,
+ subject: subject)
end
# Send message to a user from the administrator
@@ -46,9 +46,9 @@ def from_admin_message(recipient_name, recipient_email, subject, message)
recipient_user = User.find_by_email(recipient_email)
- mail(:from => contact_for_user(recipient_user),
- :to => MailHandler.address_from_name_and_email(@recipient_name, @recipient_email),
- :bcc => AlaveteliConfiguration::contact_email,
- :subject => subject)
+ mail(from: contact_for_user(recipient_user),
+ to: MailHandler.address_from_name_and_email(@recipient_name, @recipient_email),
+ bcc: AlaveteliConfiguration::contact_email,
+ subject: subject)
end
end
diff --git a/app/mailers/info_request_batch_mailer.rb b/app/mailers/info_request_batch_mailer.rb
index 4d7ed3475c..774e3303c4 100644
--- a/app/mailers/info_request_batch_mailer.rb
+++ b/app/mailers/info_request_batch_mailer.rb
@@ -16,7 +16,7 @@ def batch_sent(info_request_batch, unrequestable, user)
mail_user(
user,
_("Your batch request \"{{title}}\" has been sent",
- :title => info_request_batch.title.html_safe)
+ title: info_request_batch.title.html_safe)
)
end
end
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 4d4db92687..2e17660cd7 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -106,7 +106,7 @@ def response_notification(notification)
set_auto_generated_headers
subject = _("New response to your FOI request - {{request_title}}",
- :request_title => @info_request.title.html_safe)
+ request_title: @info_request.title.html_safe)
mail_user(@info_request.user,
subject,
template_name: 'response_notification')
@@ -156,7 +156,7 @@ def overdue_notification(notification)
set_auto_generated_headers
subject = _("Delayed response to your FOI request - {{request_title}}",
- :request_title => @info_request.title.html_safe)
+ request_title: @info_request.title.html_safe)
mail_user(@info_request.user,
subject,
@@ -172,7 +172,7 @@ def very_overdue_notification(notification)
subject = _("You're long overdue a response to your FOI request " \
"- {{request_title}}",
- :request_title => @info_request.title.html_safe)
+ request_title: @info_request.title.html_safe)
mail_user(@info_request.user,
subject,
diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb
index b61d43ed84..18bd868331 100644
--- a/app/mailers/outgoing_mailer.rb
+++ b/app/mailers/outgoing_mailer.rb
@@ -20,9 +20,9 @@ def initial_request(info_request, outgoing_message)
@contact_email = AlaveteliConfiguration.contact_email
headers["message-id"] = OutgoingMailer.id_for_message(@outgoing_message)
- mail(:from => @outgoing_message.from,
- :to => @outgoing_message.to,
- :subject => @outgoing_message.subject)
+ mail(from: @outgoing_message.from,
+ to: @outgoing_message.to,
+ subject: @outgoing_message.subject)
end
# Later message to public body regarding existing request
@@ -33,9 +33,9 @@ def followup(info_request, outgoing_message, incoming_message_followup)
@contact_email = AlaveteliConfiguration.contact_email
headers["message-id"] = OutgoingMailer.id_for_message(@outgoing_message)
- mail(:from => @outgoing_message.from,
- :to => @outgoing_message.to,
- :subject => @outgoing_message.subject)
+ mail(from: @outgoing_message.from,
+ to: @outgoing_message.to,
+ subject: @outgoing_message.subject)
end
# TODO: the condition checking valid_to_reply_to? also appears in views/request/_followup.html.erb,
@@ -72,10 +72,10 @@ def self.email_for_followup(info_request, incoming_message_followup)
# Subject to use for followup
def self.subject_for_followup(info_request, outgoing_message, options = {})
if outgoing_message.what_doing == 'internal_review'
- return _("Internal review of {{email_subject}}", :email_subject => info_request.email_subject_request(:html => options[:html]))
+ return _("Internal review of {{email_subject}}", email_subject: info_request.email_subject_request(html: options[:html]))
else
- return info_request.email_subject_followup(:incoming_message => outgoing_message.incoming_message_followup,
- :html => options[:html])
+ return info_request.email_subject_followup(incoming_message: outgoing_message.incoming_message_followup,
+ html: options[:html])
end
end
# Whether we have a valid email address for a followup
diff --git a/app/mailers/reminder_mailer.rb b/app/mailers/reminder_mailer.rb
index 9a33e1c56c..78b91e4e7b 100644
--- a/app/mailers/reminder_mailer.rb
+++ b/app/mailers/reminder_mailer.rb
@@ -8,8 +8,8 @@ def public_holidays(name, email, subject)
'Reply-To' => MailHandler.address_from_name_and_email(name, email)
)
- mail(:from => MailHandler.address_from_name_and_email(name, email),
- :to => MailHandler.address_from_name_and_email(name, email),
- :subject => subject)
+ mail(from: MailHandler.address_from_name_and_email(name, email),
+ to: MailHandler.address_from_name_and_email(name, email),
+ subject: subject)
end
end
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 210838dad1..db06f03072 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -8,7 +8,7 @@ class RequestMailer < ApplicationMailer
include AlaveteliFeatures::Helpers
before_action :set_footer_template,
- :only => [
+ only: [
:new_response, :overdue_alert, :very_overdue_alert,
:new_response_reminder_alert, :old_unclassified_updated,
:not_clarified_alert, :comment_on_alert,
@@ -24,13 +24,13 @@ def fake_response(info_request, from_user, message_body, attachment_name, attach
if !attachment_name.nil? && !attachment_content.nil?
content_type = AlaveteliFileTypes.filename_to_mimetype(attachment_name) || 'application/octet-stream'
- attachments[attachment_name] = {:content => attachment_content,
- :content_type => content_type}
+ attachments[attachment_name] = {content: attachment_content,
+ content_type: content_type}
end
- mail(:from => from_user.name_and_email,
- :to => info_request.incoming_name_and_email,
- :subject => info_request.email_subject_followup(:html => false))
+ mail(from: from_user.name_and_email,
+ to: info_request.incoming_name_and_email,
+ subject: info_request.email_subject_followup(html: false))
end
# Used when a response is uploaded using the API
@@ -38,13 +38,13 @@ def external_response(info_request, message_body, sent_at, attachment_hashes)
@message_body = message_body
attachment_hashes.each do |attachment_hash|
- attachments[attachment_hash[:filename]] = {:content => attachment_hash[:body],
- :content_type => attachment_hash[:content_type]}
+ attachments[attachment_hash[:filename]] = {content: attachment_hash[:body],
+ content_type: attachment_hash[:content_type]}
end
- mail(:from => blackhole_email,
- :to => info_request.incoming_name_and_email,
- :date => sent_at)
+ mail(from: blackhole_email,
+ to: info_request.incoming_name_and_email,
+ date: sent_at)
end
# Incoming message arrived for a request, but new responses have been stopped.
@@ -55,10 +55,10 @@ def stopped_responses(info_request, email, raw_email_data)
@info_request = info_request
@contact_email = AlaveteliConfiguration::contact_email
- mail(:to => email.from_addrs[0].to_s,
- :from => contact_from_name_and_email,
- :reply_to => contact_from_name_and_email,
- :subject => _("Your response to an FOI request was not delivered"))
+ mail(to: email.from_addrs[0].to_s,
+ from: contact_from_name_and_email,
+ reply_to: contact_from_name_and_email,
+ subject: _("Your response to an FOI request was not delivered"))
end
# An FOI response is outside the scope of the system, and needs admin attention
@@ -72,15 +72,15 @@ def requires_admin(info_request, set_by = nil, message = "")
set_reply_to_headers(nil, 'Reply-To' => user.name_and_email)
# From is an address we control so that strict DMARC senders don't get refused
- mail(:from => MailHandler.address_from_name_and_email(
+ mail(from: MailHandler.address_from_name_and_email(
user.name,
blackhole_email
),
- :to => contact_for_user(user),
- :subject => _("FOI response requires admin ({{reason}}) - " \
+ to: contact_for_user(user),
+ subject: _("FOI response requires admin ({{reason}}) - " \
"{{request_title}}",
- :reason => info_request.described_state,
- :request_title => info_request.title.html_safe))
+ reason: info_request.described_state,
+ request_title: info_request.title.html_safe))
end
# Tell the requester that a new response has arrived
@@ -92,11 +92,11 @@ def new_response(info_request, incoming_message)
set_auto_generated_headers
mail(
- :from => contact_for_user(info_request.user),
- :to => info_request.user.name_and_email,
- :subject => _("New response to your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe),
- :charset => "UTF-8"
+ from: contact_for_user(info_request.user),
+ to: info_request.user.name_and_email,
+ subject: _("New response to your FOI request - {{request_title}}",
+ request_title: info_request.title.html_safe),
+ charset: "UTF-8"
)
end
@@ -111,7 +111,7 @@ def overdue_alert(info_request, user)
mail_user(
user,
_("Delayed response to your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe)
+ request_title: info_request.title.html_safe)
)
end
@@ -126,7 +126,7 @@ def very_overdue_alert(info_request, user)
mail_user(
user,
_("You're long overdue a response to your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe)
+ request_title: info_request.title.html_safe)
)
end
@@ -162,9 +162,9 @@ def old_unclassified_updated(info_request)
# Tell the requester that they need to clarify their request
def not_clarified_alert(info_request, incoming_message)
- respond_url = new_request_incoming_followup_url(:request_id => info_request.id,
- :incoming_message_id => incoming_message.id,
- :anchor => 'followup')
+ respond_url = new_request_incoming_followup_url(request_id: info_request.id,
+ incoming_message_id: incoming_message.id,
+ anchor: 'followup')
@url = respond_url
@incoming_message = incoming_message
@info_request = info_request
@@ -174,7 +174,7 @@ def not_clarified_alert(info_request, incoming_message)
mail_user(
info_request.user,
_("Clarify your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe)
+ request_title: info_request.title.html_safe)
)
end
@@ -189,7 +189,7 @@ def comment_on_alert(info_request, comment)
mail_user(
info_request.user,
_("Somebody added a note to your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe)
+ request_title: info_request.title.html_safe)
)
end
@@ -205,7 +205,7 @@ def comment_on_alert_plural(info_request, count, earliest_unalerted_comment)
mail_user(
info_request.user,
_("Some notes have been added to your FOI request - {{request_title}}",
- :request_title => info_request.title.html_safe)
+ request_title: info_request.title.html_safe)
)
end
@@ -239,7 +239,7 @@ def requests_matching_email(email)
# Member function, called on the new class made in self.receive above
def receive(email, raw_email, source = :mailin)
- opts = { :source => source }
+ opts = { source: source }
# Find which info requests the email is for
reply_info_requests = requests_matching_email(email)
@@ -467,7 +467,7 @@ def self.alert_comment_on_request
info_requests =
InfoRequest.
- includes(:info_request_events => :user_info_request_sent_alerts).
+ includes(info_request_events: :user_info_request_sent_alerts).
where(conditions).
order(:id).merge(InfoRequestEvent.order(:created_at)).
references(:info_request_events)
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index 37f682dedd..5739f4714a 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -7,7 +7,7 @@
class TrackMailer < ApplicationMailer
helper UnsubscribeHelper
- before_action :set_footer_template, :only => :event_digest
+ before_action :set_footer_template, only: :event_digest
# Note that this is different from all the other mailers, as tracks are
# sent from a different email address and have different bounce handling.
@@ -31,10 +31,10 @@ def event_digest(user, email_about_things)
# (We let it return bounces for now, so we can manually kill the tracks that bounce so Yahoo
# etc. don't decide we are spammers.)
- mail(:from => contact_from_name_and_email,
- :to => user.name_and_email,
- :subject => _("Your {{site_name}} email alert",
- :site_name => site_name.html_safe))
+ mail(from: contact_from_name_and_email,
+ to: user.name_and_email,
+ subject: _("Your {{site_name}} email alert",
+ site_name: site_name.html_safe))
end
# Send email alerts for tracked things. Never more than one email
@@ -52,8 +52,8 @@ def self.alert_tracks
next unless user.should_be_emailed?
email_about_things = []
- track_things = TrackThing.where(:tracking_user_id => user.id,
- :track_medium => 'email_daily')
+ track_things = TrackThing.where(tracking_user_id: user.id,
+ track_medium: 'email_daily')
for track_thing in track_things
# What have we alerted on already?
#
@@ -74,10 +74,10 @@ def self.alert_tracks
# ordering, so we catch anything new (before described), or
# anything whose new status has been described.
xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], track_thing.track_query,
- :sort_by_prefix => 'described_at',
- :sort_by_ascending => true,
- :collapse_by_prefix => nil,
- :limit => 100)
+ sort_by_prefix: 'described_at',
+ sort_by_ascending: true,
+ collapse_by_prefix: nil,
+ limit: 100)
# Go through looking for unalerted things
alert_results = []
for result in xapian_object.results
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 390a1d4ed2..56aeb3fef8 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -30,9 +30,9 @@ def changeemail_confirm(user, new_email, url)
@new_email = new_email
set_reply_to_headers(user)
- mail(:from => contact_for_user(user),
- :to => new_email,
- :subject => _("Confirm your new email address on {{site_name}}", :site_name => site_name))
+ mail(from: contact_for_user(user),
+ to: new_email,
+ subject: _("Confirm your new email address on {{site_name}}", site_name: site_name))
end
def changeemail_already_used(old_email, new_email)
@@ -41,8 +41,8 @@ def changeemail_already_used(old_email, new_email)
user = User.find_by_email(@old_email)
set_reply_to_headers(user)
- mail(:from => contact_for_user(user),
- :to => new_email,
- :subject => _("Unable to change email address on {{site_name}}", :site_name=>site_name))
+ mail(from: contact_for_user(user),
+ to: new_email,
+ subject: _("Unable to change email address on {{site_name}}", site_name: site_name))
end
end
diff --git a/spec/mailers/info_request_batch_mailer_spec.rb b/spec/mailers/info_request_batch_mailer_spec.rb
index 57e579ba05..83e1edb89e 100644
--- a/spec/mailers/info_request_batch_mailer_spec.rb
+++ b/spec/mailers/info_request_batch_mailer_spec.rb
@@ -19,7 +19,7 @@
end
it "does not add HTMLEntities to the subject line" do
- batch = FactoryBot.create(:info_request_batch, :title => "Apostrophe's")
+ batch = FactoryBot.create(:info_request_batch, title: "Apostrophe's")
mail = InfoRequestBatchMailer.batch_sent(batch, @unrequestable, @user)
expect(mail.subject).
to eq('Your batch request "Apostrophe\'s" has been sent')
diff --git a/spec/mailers/outgoing_mailer_spec.rb b/spec/mailers/outgoing_mailer_spec.rb
index ef7b6035a2..ea9ccf30b8 100644
--- a/spec/mailers/outgoing_mailer_spec.rb
+++ b/spec/mailers/outgoing_mailer_spec.rb
@@ -4,12 +4,12 @@
before do
@info_request = mock_model(InfoRequest,
- :recipient_name_and_email => 'test ',
- :recipient_email => 'test@example.com')
+ recipient_name_and_email: 'test ',
+ recipient_email: 'test@example.com')
allow(@info_request).to receive_message_chain(:public_body, :name).and_return("Test Authority")
@incoming_message = mock_model(IncomingMessage,
- :from_email => 'specific@example.com',
- :safe_from_name => 'Specific Person')
+ from_email: 'specific@example.com',
+ safe_from_name: 'Specific Person')
end
describe 'if there is no incoming message being replied to' do
@@ -67,14 +67,14 @@
ir = info_requests(:fancy_dog_request)
im = ir.incoming_messages[0]
- expect(ir.email_subject_request(:html => false)).to eq("Freedom of Information request - Why do you have & such a fancy dog?")
+ expect(ir.email_subject_request(html: false)).to eq("Freedom of Information request - Why do you have & such a fancy dog?")
end
it "should use 'Re:' and inital request subject for followups which aren't replies to particular messages" do
ir = info_requests(:fancy_dog_request)
om = outgoing_messages(:useless_outgoing_message)
- expect(OutgoingMailer.subject_for_followup(ir, om, :html => false)).to eq("Re: Freedom of Information request - Why do you have & such a fancy dog?")
+ expect(OutgoingMailer.subject_for_followup(ir, om, html: false)).to eq("Re: Freedom of Information request - Why do you have & such a fancy dog?")
end
it "should prefix with Re: the subject of the message being replied to" do
@@ -83,7 +83,7 @@
om = outgoing_messages(:useless_outgoing_message)
om.incoming_message_followup = im
- expect(OutgoingMailer.subject_for_followup(ir, om, :html => false)).to eq("Re: Geraldine FOI Code AZXB421")
+ expect(OutgoingMailer.subject_for_followup(ir, om, html: false)).to eq("Re: Geraldine FOI Code AZXB421")
end
it "should not add Re: prefix if there already is such a prefix" do
@@ -93,7 +93,7 @@
om.incoming_message_followup = im
im.raw_email.data = im.raw_email.data.sub("Subject: Geraldine FOI Code AZXB421", "Subject: Re: Geraldine FOI Code AZXB421")
- expect(OutgoingMailer.subject_for_followup(ir, om, :html => false)).to eq("Re: Geraldine FOI Code AZXB421")
+ expect(OutgoingMailer.subject_for_followup(ir, om, html: false)).to eq("Re: Geraldine FOI Code AZXB421")
end
it "should not add Re: prefix if there already is a lower case re: prefix" do
@@ -105,7 +105,7 @@
im.raw_email.data = im.raw_email.data.sub("Subject: Geraldine FOI Code AZXB421", "Subject: re: Geraldine FOI Code AZXB421")
im.parse_raw_email! true
- expect(OutgoingMailer.subject_for_followup(ir, om, :html => false)).to eq("re: Geraldine FOI Code AZXB421")
+ expect(OutgoingMailer.subject_for_followup(ir, om, html: false)).to eq("re: Geraldine FOI Code AZXB421")
end
it "should use 'Re:' and initial request subject when replying to failed delivery notifications" do
@@ -118,7 +118,7 @@
im.raw_email.data = im.raw_email.data.sub("Subject: Geraldine FOI Code AZXB421", "Subject: Delivery Failed")
im.parse_raw_email! true
- expect(OutgoingMailer.subject_for_followup(ir, om, :html => false)).to eq("Re: Freedom of Information request - Why do you have & such a fancy dog?")
+ expect(OutgoingMailer.subject_for_followup(ir, om, html: false)).to eq("Re: Freedom of Information request - Why do you have & such a fancy dog?")
end
context "dealing with an internal review" do
@@ -126,7 +126,7 @@
it "prefixes the subject of the message with 'Internal review of " \
"Freedom of Information request'" do
request = FactoryBot.create(:info_request_with_internal_review_request,
- :title => "Test")
+ title: "Test")
expect(OutgoingMailer.subject_for_followup(
request,
request.outgoing_messages.last)).
@@ -135,7 +135,7 @@
it "does not add HTMLEntities to the subject of the message" do
request = FactoryBot.create(:info_request_with_internal_review_request,
- :title => "Apostrophe's Test")
+ title: "Apostrophe's Test")
expect(OutgoingMailer.subject_for_followup(
request,
request.outgoing_messages.last)).
diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb
index e5ae6c0cd1..3037fb581e 100644
--- a/spec/mailers/request_mailer_spec.rb
+++ b/spec/mailers/request_mailer_spec.rb
@@ -286,7 +286,7 @@
info_request = FactoryBot.create(:info_request_with_incoming)
mail = RequestMailer.
fake_response(info_request,
- mock_model(User, :name_and_email => "test"),
+ mock_model(User, name_and_email: "test"),
"The body of the email...",
"blah.txt",
"The content of blah.txt")
@@ -308,10 +308,10 @@ def send_alerts
end
def sent_alert_params(request, type)
- {:info_request_id => request.id,
- :user_id => request.user.id,
- :info_request_event_id => request.get_last_public_response_event_id,
- :alert_type => type}
+ {info_request_id: request.id,
+ user_id: request.user.id,
+ info_request_event_id: request.get_last_public_response_event_id,
+ alert_type: type}
end
it 'should raise an error if a request does not have a last response event id' do
@@ -325,7 +325,7 @@ def sent_alert_params(request, type)
context 'if the request is embargoed' do
it 'sends the reminder' do
- old_request.create_embargo(:publish_at => Time.zone.now + 3.days)
+ old_request.create_embargo(publish_at: Time.zone.now + 3.days)
send_alerts
deliveries = ActionMailer::Base.deliveries
mail = deliveries[0]
@@ -382,16 +382,16 @@ def sent_alert_params(request, type)
describe "when sending mail when someone has updated an old unclassified request" do
let(:user) do
- FactoryBot.create(:user, :name => "test name", :email => "email@localhost")
+ FactoryBot.create(:user, name: "test name", email: "email@localhost")
end
- let(:public_body) { FactoryBot.create(:public_body, :name => "Test public body") }
+ let(:public_body) { FactoryBot.create(:public_body, name: "Test public body") }
let(:info_request) do
- FactoryBot.create(:info_request, :user => user,
- :title => "Test request",
- :public_body => public_body,
- :url_title => "test_request")
+ FactoryBot.create(:info_request, user: user,
+ title: "Test request",
+ public_body: public_body,
+ url_title: "test_request")
end
let(:mail) { RequestMailer.old_unclassified_updated(info_request) }
@@ -417,12 +417,12 @@ def sent_alert_params(request, type)
describe "when generating a fake response for an upload" do
before do
- @foi_officer = mock_model(User, :name_and_email => "FOI officer's name and email")
+ @foi_officer = mock_model(User, name_and_email: "FOI officer's name and email")
@request_user = mock_model(User)
- @public_body = mock_model(PublicBody, :name => 'Test public body')
- @info_request = mock_model(InfoRequest, :user => @request_user,
- :email_subject_followup => 'Re: Freedom of Information - Test request',
- :incoming_name_and_email => 'Someone ')
+ @public_body = mock_model(PublicBody, name: 'Test public body')
+ @info_request = mock_model(InfoRequest, user: @request_user,
+ email_subject_followup: 'Re: Freedom of Information - Test request',
+ incoming_name_and_email: 'Someone ')
end
it 'should should generate a "fake response" email with a reasonable subject line' do
@@ -439,25 +439,25 @@ def sent_alert_params(request, type)
describe "when sending a new response email" do
let(:user) do
- FactoryBot.create(:user, :name => "test name",
- :email => "email@localhost")
+ FactoryBot.create(:user, name: "test name",
+ email: "email@localhost")
end
let(:public_body) do
- FactoryBot.create(:public_body, :name => "Test public body")
+ FactoryBot.create(:public_body, name: "Test public body")
end
let(:info_request) do
FactoryBot.create(:info_request,
- :user => user,
- :title => "Here is a character that needs quoting …",
- :public_body => public_body,
- :described_state => 'rejected',
- :url_title => "test_request")
+ user: user,
+ title: "Here is a character that needs quoting …",
+ public_body: public_body,
+ described_state: 'rejected',
+ url_title: "test_request")
end
let(:incoming_message) do
- FactoryBot.create(:incoming_message, :info_request => info_request)
+ FactoryBot.create(:incoming_message, info_request: info_request)
end
it 'should not error when sending mails requests with characters requiring quoting in the subject' do
@@ -465,7 +465,7 @@ def sent_alert_params(request, type)
end
it 'should not create HTML entities in the subject line' do
- mail = RequestMailer.new_response(FactoryBot.create(:info_request, :title => "Here's a request"), FactoryBot.create(:incoming_message))
+ mail = RequestMailer.new_response(FactoryBot.create(:info_request, title: "Here's a request"), FactoryBot.create(:incoming_message))
expect(mail.subject).to eq "New response to your FOI request - Here's a request"
end
@@ -478,7 +478,7 @@ def sent_alert_params(request, type)
mail.body.to_s =~ /(http:\/\/.*)/
mail_url = $1
- message_url = incoming_message_url(incoming_message, :cachebust => true)
+ message_url = incoming_message_url(incoming_message, cachebust: true)
expected_url = signin_url(r: message_url)
expect(mail_url).to eq expected_url
end
@@ -487,7 +487,7 @@ def sent_alert_params(request, type)
mail = RequestMailer.new_response(info_request, incoming_message)
mail.body.to_s =~ /(http:\/\/\S*)/
mail_url = $1
- expected_url = incoming_message_url(incoming_message, :cachebust => true)
+ expected_url = incoming_message_url(incoming_message, cachebust: true)
expect(mail_url).to eq expected_url
end
@@ -527,15 +527,15 @@ def sent_alert_params(request, type)
describe "requires_admin" do
let(:user) do
- FactoryBot.create(:user, :name => "Bruce Jones",
- :email => "bruce@example.com")
+ FactoryBot.create(:user, name: "Bruce Jones",
+ email: "bruce@example.com")
end
let(:info_request) do
- FactoryBot.create(:info_request, :user => user,
- :title => "It's a Test request",
- :url_title => "test_request",
- :id => 123)
+ FactoryBot.create(:info_request, user: user,
+ title: "It's a Test request",
+ url_title: "test_request",
+ id: 123)
end
before do
@@ -586,11 +586,11 @@ def sent_alert_params(request, type)
end
- describe "sending overdue request alerts", :focus => true do
+ describe "sending overdue request alerts", focus: true do
before(:each) do
@kitten_request = FactoryBot.create(:info_request,
- :title => "Do you really own a kitten?")
+ title: "Do you really own a kitten?")
end
def kitten_mails
@@ -599,7 +599,7 @@ def kitten_mails
it 'should not create HTML entities in the subject line' do
info_request = FactoryBot.create(:info_request,
- :title => "Here's a request")
+ title: "Here's a request")
mail = RequestMailer.overdue_alert(info_request, info_request.user)
expect(mail.subject).to eq "Delayed response to your FOI request - Here's a request"
end
@@ -627,11 +627,11 @@ def kitten_mails
user = @kitten_request.user
user.ban_text = 'Banned'
user.save!
- expect(UserInfoRequestSentAlert.where(:user_id => user.id).count).to eq(0)
+ expect(UserInfoRequestSentAlert.where(user_id: user.id).count).to eq(0)
RequestMailer.alert_overdue_requests
expect(kitten_mails.size).to eq(0)
- expect(UserInfoRequestSentAlert.where(:user_id => user.id).count).to be > 0
+ expect(UserInfoRequestSentAlert.where(user_id: user.id).count).to be > 0
end
end
@@ -652,11 +652,11 @@ def kitten_mails
@kitten_request.set_described_state('waiting_clarification')
# Followup message is sent
- outgoing_message = OutgoingMessage.new(:status => 'ready',
- :message_type => 'followup',
- :info_request_id => @kitten_request.id,
- :body => 'Some text',
- :what_doing => 'normal_sort')
+ outgoing_message = OutgoingMessage.new(status: 'ready',
+ message_type: 'followup',
+ info_request_id: @kitten_request.id,
+ body: 'Some text',
+ what_doing: 'normal_sort')
outgoing_message.sendable?
mail_message = OutgoingMailer.followup(
@@ -710,7 +710,7 @@ def kitten_mails
it 'should not create HTML entities in the subject line' do
info_request = FactoryBot.create(:info_request,
- :title => "Here's a request")
+ title: "Here's a request")
mail = RequestMailer.very_overdue_alert(info_request,
info_request.user)
expect(mail.subject).to eq "You're long overdue a response " \
@@ -769,7 +769,7 @@ def kitten_mails
describe "not_clarified_alert" do
it 'should not create HTML entities in the subject line' do
- mail = RequestMailer.not_clarified_alert(FactoryBot.create(:info_request, :title => "Here's a request"), FactoryBot.create(:incoming_message))
+ mail = RequestMailer.not_clarified_alert(FactoryBot.create(:info_request, title: "Here's a request"), FactoryBot.create(:incoming_message))
expect(mail.subject).to eq "Clarify your FOI request - Here's a request"
end
@@ -778,7 +778,7 @@ def kitten_mails
describe "comment_on_alert" do
it 'should not create HTML entities in the subject line' do
- mail = RequestMailer.comment_on_alert(FactoryBot.create(:info_request, :title => "Here's a request"), FactoryBot.create(:comment))
+ mail = RequestMailer.comment_on_alert(FactoryBot.create(:info_request, title: "Here's a request"), FactoryBot.create(:comment))
expect(mail.subject).to eq "Somebody added a note to your FOI request - Here's a request"
end
@@ -787,7 +787,7 @@ def kitten_mails
describe "comment_on_alert_plural" do
it 'should not create HTML entities in the subject line' do
- mail = RequestMailer.comment_on_alert_plural(FactoryBot.create(:info_request, :title => "Here's a request"), 2, FactoryBot.create(:comment))
+ mail = RequestMailer.comment_on_alert_plural(FactoryBot.create(:info_request, title: "Here's a request"), 2, FactoryBot.create(:comment))
expect(mail.subject).to eq "Some notes have been added to your FOI request - Here's a request"
end
@@ -819,8 +819,8 @@ def force_updated_at_to_past(request)
mail_url = $1
expect(mail_url).
- to match(new_request_incoming_followup_path(:request_id => ir.id,
- :incoming_message_id => ir.incoming_messages.last.id))
+ to match(new_request_incoming_followup_path(request_id: ir.id,
+ incoming_message_id: ir.incoming_messages.last.id))
end
it "skips requests that don't have a public last response" do
diff --git a/spec/mailers/track_mailer_spec.rb b/spec/mailers/track_mailer_spec.rb
index fcb7f8344f..4d4d9195fd 100644
--- a/spec/mailers/track_mailer_spec.rb
+++ b/spec/mailers/track_mailer_spec.rb
@@ -74,31 +74,31 @@
before do
@track_things_sent_emails_array = []
allow(@track_things_sent_emails_array).to receive(:where).and_return([]) # this is for the date range find (created in last 14 days)
- @track_thing = mock_model(TrackThing, :track_query => 'test query',
- :track_things_sent_emails => @track_things_sent_emails_array,
- :created_at => Time.utc(2007, 11, 9, 23, 59))
+ @track_thing = mock_model(TrackThing, track_query: 'test query',
+ track_things_sent_emails: @track_things_sent_emails_array,
+ created_at: Time.utc(2007, 11, 9, 23, 59))
allow(TrackThing).to receive(:where).and_return([@track_thing])
@track_things_sent_email = mock_model(TrackThingsSentEmail, :save! => true,
:track_thing_id= => true,
:info_request_event_id= => true)
allow(TrackThingsSentEmail).to receive(:new).and_return(@track_things_sent_email)
- @xapian_search = double('xapian search', :results => [])
- @found_event = mock_model(InfoRequestEvent, :described_at => @track_thing.created_at + 1.day)
- @search_result = {:model => @found_event}
+ @xapian_search = double('xapian search', results: [])
+ @found_event = mock_model(InfoRequestEvent, described_at: @track_thing.created_at + 1.day)
+ @search_result = {model: @found_event}
allow(ActsAsXapian::Search).to receive(:new).and_return(@xapian_search)
end
it 'should ask for the events returned by the tracking query' do
expect(ActsAsXapian::Search).to receive(:new).with([InfoRequestEvent], 'test query',
- :sort_by_prefix => 'described_at',
- :sort_by_ascending => true,
- :collapse_by_prefix => nil,
- :limit => 100).and_return(@xapian_search)
+ sort_by_prefix: 'described_at',
+ sort_by_ascending: true,
+ collapse_by_prefix: nil,
+ limit: 100).and_return(@xapian_search)
TrackMailer.alert_tracks
end
it 'should not include in the email any events that the user has already been sent a tracking email about' do
- sent_email = mock_model(TrackThingsSentEmail, :info_request_event_id => @found_event.id)
+ sent_email = mock_model(TrackThingsSentEmail, info_request_event_id: @found_event.id)
allow(@track_things_sent_emails_array).to receive(:where).and_return([sent_email]) # this is for the date range find (created in last 14 days)
allow(@xapian_search).to receive(:results).and_return([@search_result])
expect(TrackMailer).not_to receive(:event_digest)
@@ -120,7 +120,7 @@
end
it 'should raise an error if a non-event class is returned by the tracking query' do
- allow(@xapian_search).to receive(:results).and_return([{:model => 'string class'}])
+ allow(@xapian_search).to receive(:results).and_return([{model: 'string class'}])
expect { TrackMailer.alert_tracks }.to raise_error('need to add other types to TrackMailer.alert_tracks (unalerted)')
end
@@ -186,13 +186,13 @@
before :each do
allow(AlaveteliConfiguration).to receive(:site_name).
and_return("L'information")
- @post_redirect = mock_model(PostRedirect, :save! => true,
- :email_token => "token")
+ @post_redirect = mock_model(PostRedirect, save!: true,
+ email_token: "token")
allow(PostRedirect).to receive(:new).and_return(@post_redirect)
ActionMailer::Base.deliveries = []
@user = mock_model(User,
- :name_and_email => MailHandler.address_from_name_and_email('Tippy Test', 'tippy@localhost'),
- :url_name => 'tippy_test'
+ name_and_email: MailHandler.address_from_name_and_email('Tippy Test', 'tippy@localhost'),
+ url_name: 'tippy_test'
)
TrackMailer.event_digest(@user, []).deliver_now # no items in it email for minimal test
end
From 11b23de804727db5f5c9ae4b6434bebb09590ca0 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 17 Feb 2023 15:03:43 +0000
Subject: [PATCH 101/289] Style: HashSyntax Rubocop (lib files)
---
lib/acts_as_xapian/acts_as_xapian.rb | 26 +-
lib/acts_as_xapian/tasks/xapian.rake | 12 +-
lib/alaveteli_mail_poller.rb | 2 +-
lib/alaveteli_rate_limiter/ip_rate_limiter.rb | 4 +-
.../ip_rate_limiter/defaults.rb | 6 +-
lib/attachment_to_html/adapter.rb | 2 +-
lib/attachment_to_html/adapters/pdf.rb | 4 +-
lib/attachment_to_html/adapters/rtf.rb | 2 +-
.../acts_as_xapian/templates/migration.rb | 8 +-
lib/graphs.rb | 28 +--
lib/mail_handler.rb | 16 +-
lib/mail_handler/backends/mail_backend.rb | 14 +-
lib/memory_profiler.rb | 2 +-
lib/no_constraint_disabling.rb | 2 +-
lib/normalize_string.rb | 2 +-
lib/public_body_csv.rb | 2 +-
lib/quiet_opener.rb | 2 +-
lib/tasks/assets.rake | 2 +-
lib/tasks/cleanup.rake | 16 +-
lib/tasks/config_files.rake | 74 +++---
lib/tasks/embargoes.rake | 2 +-
lib/tasks/export.rake | 2 +-
lib/tasks/gettext.rake | 6 +-
lib/tasks/graphs.rake | 100 ++++----
lib/tasks/import.rake | 2 +-
lib/tasks/reindex.rake | 12 +-
lib/tasks/reminder.rake | 2 +-
lib/tasks/stats.rake | 46 ++--
lib/tasks/submodules.rake | 2 +-
lib/tasks/themes.rake | 44 ++--
lib/tasks/translation.rake | 16 +-
lib/tasks/users.rake | 8 +-
lib/typeahead_search.rb | 14 +-
lib/user_spam_scorer.rb | 30 +--
lib/user_stats.rb | 2 +-
lib/world_foi_websites.rb | 224 +++++++++---------
spec/lib/acts_as_xapian_spec.rb | 38 +--
.../backends/pstore_database_spec.rb | 24 +-
.../ip_rate_limiter/defaults_spec.rb | 12 +-
.../ip_rate_limiter_spec.rb | 38 +--
spec/lib/alaveteli_rate_limiter/rule_spec.rb | 44 ++--
.../lib/alaveteli_rate_limiter/window_spec.rb | 6 +-
spec/lib/alaveteli_text_masker_spec.rb | 32 +--
.../adapters/google_docs_viewer_spec.rb | 2 +-
.../attachment_to_html/adapters/pdf_spec.rb | 4 +-
.../attachment_to_html/adapters/rtf_spec.rb | 6 +-
.../attachment_to_html/adapters/text_spec.rb | 12 +-
.../attachment_to_html_spec.rb | 8 +-
spec/lib/attachment_to_html/view_spec.rb | 8 +-
spec/lib/data_export_spec.rb | 36 +--
spec/lib/database_collation_spec.rb | 8 +-
spec/lib/graphs_spec.rb | 24 +-
.../health_checks/checks/period_check_spec.rb | 4 +-
.../health_checks/health_checkable_spec.rb | 8 +-
spec/lib/health_checks/health_checks_spec.rb | 30 +--
spec/lib/i18n_interpolation_spec.rb | 12 +-
spec/lib/mail_handler/mail_handler_spec.rb | 138 +++++------
spec/lib/public_body_csv_spec.rb | 48 ++--
spec/lib/typeahead_search_spec.rb | 22 +-
spec/lib/user_spam_scorer_spec.rb | 178 +++++++-------
spec/lib/user_stats_spec.rb | 52 ++--
61 files changed, 766 insertions(+), 766 deletions(-)
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 73b3fd4a31..fad7c03640 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -422,10 +422,10 @@ def results
# Pull out all the results
iter = matches._begin
while not iter.equals(matches._end)
- docs.push({:data => iter.document.data,
- :percent => iter.percent,
- :weight => iter.weight,
- :collapse_count => iter.collapse_count})
+ docs.push({data: iter.document.data,
+ percent: iter.percent,
+ weight: iter.weight,
+ collapse_count: iter.collapse_count})
iter.next
end
}
@@ -459,10 +459,10 @@ def results
k = doc[:data].split('-')
model_instance = chash[[k[0], k[1].to_i]]
if model_instance
- results << { :model => model_instance,
- :percent => doc[:percent],
- :weight => doc[:weight],
- :collapse_count => doc[:collapse_count] }
+ results << { model: model_instance,
+ percent: doc[:percent],
+ weight: doc[:weight],
+ collapse_count: doc[:collapse_count] }
end
end
self.cached_results = results
@@ -523,7 +523,7 @@ def initialize(model_classes, query_string, options = {}, user_query = nil)
# date ranges or similar. Use this for cheap highlighting with
# TextHelper::highlight, and excerpt.
def words_to_highlight(opts = {})
- default_opts = { :include_original => false, :regex => false }
+ default_opts = { include_original: false, regex: false }
opts = default_opts.merge(opts)
# Reject all prefixes other than Z, which we know is reserved for stems
@@ -1126,14 +1126,14 @@ def xapian_mark_needs_index_if_reindex
def xapian_create_job(action, model, model_id)
begin
- ActiveRecord::Base.transaction(:requires_new => true) do
+ ActiveRecord::Base.transaction(requires_new: true) do
ActsAsXapianJob.
where([ "model = ? and model_id = ?", model, model_id]).
delete_all
xapian_before_create_job_hook(action, model, model_id)
- ActsAsXapianJob.create!(:model => model,
- :model_id => model_id,
- :action => action)
+ ActsAsXapianJob.create!(model: model,
+ model_id: model_id,
+ action: action)
end
rescue ActiveRecord::RecordNotUnique => e
# Given the error handling in ActsAsXapian::update_index, we can just fail silently if
diff --git a/lib/acts_as_xapian/tasks/xapian.rake b/lib/acts_as_xapian/tasks/xapian.rake
index 01e3c0facf..569743995d 100644
--- a/lib/acts_as_xapian/tasks/xapian.rake
+++ b/lib/acts_as_xapian/tasks/xapian.rake
@@ -8,7 +8,7 @@ namespace :xapian do
# after each model that is updated. This is safer, but slower. Specify
# "verbose=true" to print model name as it is run.
desc 'Updates Xapian search index with changes to models since last call'
- task :update_index => :environment do
+ task update_index: :environment do
ActsAsXapian.update_index(ENV['flush'], ENV['verbose'])
end
@@ -27,7 +27,7 @@ namespace :xapian do
# index the two terms I and V (and "terms=false" will index none,
# and "terms=true", the default, will index all)
desc 'Completely rebuilds Xapian search index (must specify all models)'
- task :destroy_and_rebuild_index => :environment do
+ task destroy_and_rebuild_index: :environment do
def coerce_arg(arg, default)
if arg == "false"
return false
@@ -53,16 +53,16 @@ namespace :xapian do
# Parameters - are models, query, offset, limit, sort_by_prefix,
# collapse_by_prefix
desc 'Run a query, return YAML of results'
- task :query => :environment do
+ task query: :environment do
if ENV['models'].nil?
raise "specify models=\"ModelName1 ModelName2\" as parameter"
end
raise "specify query=\"your terms\" as parameter" if ENV['query'].nil?
s = ActsAsXapian::Search.new(ENV['models'].split(" ").map { |m| m.constantize },
ENV['query'],
- :offset => (ENV['offset'] || 0), :limit => (ENV['limit'] || 10),
- :sort_by_prefix => (ENV['sort_by_prefix'] || nil),
- :collapse_by_prefix => (ENV['collapse_by_prefix'] || nil)
+ offset: (ENV['offset'] || 0), limit: (ENV['limit'] || 10),
+ sort_by_prefix: (ENV['sort_by_prefix'] || nil),
+ collapse_by_prefix: (ENV['collapse_by_prefix'] || nil)
)
STDOUT.puts(s.results.to_yaml)
end
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index 27a1f4f984..b12c236793 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -67,7 +67,7 @@ def get_mail(popmail)
if send_exception_notifications?
ExceptionNotifier.notify_exception(
error,
- :data => { mail: raw_email,
+ data: { mail: raw_email,
unique_id: unique_id }
)
end
diff --git a/lib/alaveteli_rate_limiter/ip_rate_limiter.rb b/lib/alaveteli_rate_limiter/ip_rate_limiter.rb
index b11d5a083e..8be4cba95f 100644
--- a/lib/alaveteli_rate_limiter/ip_rate_limiter.rb
+++ b/lib/alaveteli_rate_limiter/ip_rate_limiter.rb
@@ -26,7 +26,7 @@ def initialize(rule, opts = {})
@rule = find_rule(rule)
path =
Pathname.new(Rails.root + "tmp/#{@rule.name}_ip_rate_limiter.pstore")
- @backend = opts[:backend] || Backends::PStoreDatabase.new(:path => path)
+ @backend = opts[:backend] || Backends::PStoreDatabase.new(path: path)
@whitelist = opts[:whitelist] || self.class.defaults.whitelist
end
@@ -61,7 +61,7 @@ def find_rule(rule)
case rule
when Symbol
rules = self.class.defaults.event_rules.fetch(rule)
- Rule.from_hash(rules.merge(:name => rule))
+ Rule.from_hash(rules.merge(name: rule))
when Rule
rule
else
diff --git a/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults.rb b/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults.rb
index 6d5856f334..1cbe94060e 100644
--- a/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults.rb
+++ b/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults.rb
@@ -3,9 +3,9 @@ module AlaveteliRateLimiter
class IPRateLimiter
class Defaults
EVENT_RULES = {
- :signup => { :count => 3, :window => { :value => 1, :unit => :hour } },
- :request => { :count => 3, :window => { :value => 1, :unit => :hour } },
- :comment => { :count => 20, :window => { :value => 1, :unit => :hour } }
+ signup: { count: 3, window: { value: 1, unit: :hour } },
+ request: { count: 3, window: { value: 1, unit: :hour } },
+ comment: { count: 20, window: { value: 1, unit: :hour } }
}
attr_accessor :whitelist
diff --git a/lib/attachment_to_html/adapter.rb b/lib/attachment_to_html/adapter.rb
index 8da1a078bd..e66298abff 100644
--- a/lib/attachment_to_html/adapter.rb
+++ b/lib/attachment_to_html/adapter.rb
@@ -45,7 +45,7 @@ def contains_images?
end
def create_tempfile(text)
- tempfile = Tempfile.new('foiextract', '.', :encoding => text.encoding)
+ tempfile = Tempfile.new('foiextract', '.', encoding: text.encoding)
tempfile.print(text)
tempfile.flush
tempfile
diff --git a/lib/attachment_to_html/adapters/pdf.rb b/lib/attachment_to_html/adapters/pdf.rb
index 76b8fd0d74..5787accf00 100644
--- a/lib/attachment_to_html/adapters/pdf.rb
+++ b/lib/attachment_to_html/adapters/pdf.rb
@@ -57,8 +57,8 @@ def convert
"-enc", "UTF-8",
"-noframes",
"./#{File.basename(tempfile.path)}",
- :timeout => 30,
- :binary_output => false)
+ timeout: 30,
+ binary_output: false)
cleanup_tempfile(tempfile)
html
diff --git a/lib/attachment_to_html/adapters/rtf.rb b/lib/attachment_to_html/adapters/rtf.rb
index 0d98a1b19d..9ed0ff6f1c 100644
--- a/lib/attachment_to_html/adapters/rtf.rb
+++ b/lib/attachment_to_html/adapters/rtf.rb
@@ -39,7 +39,7 @@ def convert
tempfile = create_tempfile(text)
html = AlaveteliExternalCommand.run("unrtf", "--html",
- tempfile.path, :timeout => 120
+ tempfile.path, timeout: 120
)
cleanup_tempfile(tempfile)
diff --git a/lib/generators/acts_as_xapian/templates/migration.rb b/lib/generators/acts_as_xapian/templates/migration.rb
index 84a9dd766f..436aa9efc0 100644
--- a/lib/generators/acts_as_xapian/templates/migration.rb
+++ b/lib/generators/acts_as_xapian/templates/migration.rb
@@ -1,11 +1,11 @@
class CreateActsAsXapian < ActiveRecord::Migration
def self.up
create_table :acts_as_xapian_jobs do |t|
- t.column :model, :string, :null => false
- t.column :model_id, :integer, :null => false
- t.column :action, :string, :null => false
+ t.column :model, :string, null: false
+ t.column :model_id, :integer, null: false
+ t.column :action, :string, null: false
end
- add_index :acts_as_xapian_jobs, [:model, :model_id], :unique => true
+ add_index :acts_as_xapian_jobs, [:model, :model_id], unique: true
end
def self.down
drop_table :acts_as_xapian_jobs
diff --git a/lib/graphs.rb b/lib/graphs.rb
index f6a37b4f6e..3ffea5846f 100644
--- a/lib/graphs.rb
+++ b/lib/graphs.rb
@@ -6,19 +6,19 @@ module Graphs
# as provided by our basic gnuplot configuration, do not rely on them
# if you have altered the gnuplot install
COLOURS = {
- :darkblue => 8,
- :lightblue => 3,
- :yellow => 9,
- :red => 6,
- :lightgreen => 2,
- :darkgreen => 10,
- :cyan => 5,
- :darkyellow => 7,
- :mauve => 4,
- :redbrown => 12, # previously "darky reddy brown"
- :pink => 13,
- :bluemauve => 11,
- :limegreen => 14
+ darkblue: 8,
+ lightblue: 3,
+ yellow: 9,
+ red: 6,
+ lightgreen: 2,
+ darkgreen: 10,
+ cyan: 5,
+ darkyellow: 7,
+ mauve: 4,
+ redbrown: 12, # previously "darky reddy brown"
+ pink: 13,
+ bluemauve: 11,
+ limegreen: 14
}.freeze
COLORS = COLOURS
@@ -46,7 +46,7 @@ def select_as_columns(sql)
# for outputting the graph
# returns the resulting Gnuplot::DataSet
def create_dataset(data, options)
- default = {:using => "1:2"} #in most cases, we just want the first 2 columns
+ default = {using: "1:2"} #in most cases, we just want the first 2 columns
options = default.merge(options)
Gnuplot::DataSet.new(data) do |ds|
options.keys.each do |option|
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index 218bdae694..b180857a0e 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -29,8 +29,8 @@ def tnef_attachments(content)
Dir.new(dir).sort.each do |file| # sort for deterministic behaviour
if file != "." && file != ".."
file_content = File.open("#{dir}/#{file}", "rb").read
- attachments << { :content => file_content,
- :filename => file }
+ attachments << { content: file_content,
+ filename: file }
found += 1
end
end
@@ -74,12 +74,12 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
tempfile.binmode
tempfile.print body
tempfile.flush
- default_params = { :append_to => text,
- :binary_output => false,
- :timeout => 1200 }
+ default_params = { append_to: text,
+ binary_output: false,
+ timeout: 1200 }
if content_type == 'application/vnd.ms-word'
AlaveteliExternalCommand.run("wvText", tempfile.path, tempfile.path + ".txt",
- { :memory_limit => 536_870_912, :timeout => 120 } )
+ { memory_limit: 536_870_912, timeout: 120 } )
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
if not File.exist?(tempfile.path + ".txt")
AlaveteliExternalCommand.run("catdoc", tempfile.path, default_params)
@@ -99,7 +99,7 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
"-dump-charset", "utf-8",
"-force-html", "-dump",
tempfile.path,
- default_params.merge(:env => {"LANG" => "C"}))
+ default_params.merge(env: {"LANG" => "C"}))
elsif content_type == 'application/vnd.ms-excel'
# Bit crazy using /usr/bin/strings - but xls2csv, xlhtml and
# py_xls2txt only extract text from cells, not from floating
@@ -119,7 +119,7 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
"-c",
tempfile.path,
"word/document.xml",
- {:binary_output => false})
+ {binary_output: false})
if !xml.nil?
doc = REXML::Document.new(xml)
text += doc.each_element( './/text()' ) {}.join(" ")
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 42b34cc87c..d9c46d0a24 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -374,13 +374,13 @@ def get_attachment_attributes(mail)
body = extract_attached_message_headers(leaf)
end
- leaf_attributes = { :url_part_number => leaf.url_part_number,
- :content_type => get_content_type(leaf),
- :filename => get_part_file_name(leaf),
- :charset => leaf.charset,
- :within_rfc822_subject => within_rfc822_subject,
- :body => body,
- :hexdigest => Digest::MD5.hexdigest(body) }
+ leaf_attributes = { url_part_number: leaf.url_part_number,
+ content_type: get_content_type(leaf),
+ filename: get_part_file_name(leaf),
+ charset: leaf.charset,
+ within_rfc822_subject: within_rfc822_subject,
+ body: body,
+ hexdigest: Digest::MD5.hexdigest(body) }
end
end
diff --git a/lib/memory_profiler.rb b/lib/memory_profiler.rb
index b418a777f4..17f7128460 100644
--- a/lib/memory_profiler.rb
+++ b/lib/memory_profiler.rb
@@ -13,7 +13,7 @@
# strings `ls -1t *profiler_strings* | head --lines=1` |sort > a; strings `ls -1t *profiler_strings* | head --lines=2 | tail --lines=1` |sort > b; diff b a |less
class MemoryProfiler
- DEFAULTS = {:delay => 10, :string_debug => false}
+ DEFAULTS = {delay: 10, string_debug: false}
def self.start(opt={})
opt = DEFAULTS.dup.merge(opt)
diff --git a/lib/no_constraint_disabling.rb b/lib/no_constraint_disabling.rb
index 0503efd99b..f6e00cf179 100644
--- a/lib/no_constraint_disabling.rb
+++ b/lib/no_constraint_disabling.rb
@@ -52,7 +52,7 @@ def self.create_fixtures(fixtures_directory, fixture_set_names, class_names = {}
update_all_loaded_fixtures fixtures_map
- connection.transaction(:requires_new => true) do
+ connection.transaction(requires_new: true) do
# Patch - replace this...
# ***
# fixture_sets.each do |fs|
diff --git a/lib/normalize_string.rb b/lib/normalize_string.rb
index 8e1effb669..48530f0e4a 100644
--- a/lib/normalize_string.rb
+++ b/lib/normalize_string.rb
@@ -87,7 +87,7 @@ def convert_string_to_utf8(s, suggested_character_encoding=nil)
def scrub(string)
string = string.force_encoding("utf-8")
- string.valid_encoding? ? string : string.encode("utf-16le", :invalid => :replace, :replace => "").encode("utf-8")
+ string.valid_encoding? ? string : string.encode("utf-16le", invalid: :replace, replace: "").encode("utf-8")
end
def log_text_details(message, text)
diff --git a/lib/public_body_csv.rb b/lib/public_body_csv.rb
index faea44b6f9..15526ce9ad 100644
--- a/lib/public_body_csv.rb
+++ b/lib/public_body_csv.rb
@@ -67,7 +67,7 @@ def initialize(args = {})
end
def <<(public_body)
- rows << CSV.generate_line(collect_public_body_attributes(public_body), :row_sep => '')
+ rows << CSV.generate_line(collect_public_body_attributes(public_body), row_sep: '')
end
# TODO: Just use CSV.generate
diff --git a/lib/quiet_opener.rb b/lib/quiet_opener.rb
index 81abfe1eea..aac5cc1f62 100644
--- a/lib/quiet_opener.rb
+++ b/lib/quiet_opener.rb
@@ -16,7 +16,7 @@ def quietly_try_to_open(url, timeout=60)
if !AlaveteliConfiguration.exception_notifications_from.blank? &&
!AlaveteliConfiguration.exception_notifications_to.blank? &&
defined?(request)
- ExceptionNotifier.notify_exception(e, :env => request.env)
+ ExceptionNotifier.notify_exception(e, env: request.env)
end
Rails.logger.warn(e.message)
result = ""
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index c177e5ff81..636add9692 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -1,6 +1,6 @@
namespace :assets do
desc 'Symlink non-digest asset paths to the most recent digest versions'
- task :link_non_digest => :environment do
+ task link_non_digest: :environment do
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
assets.each do |file|
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 9b85695c3f..e5f3bc56eb 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -1,12 +1,12 @@
namespace :cleanup do
desc 'Clean up all message redelivery and destroy actions from the holding pen to make admin actions there faster'
- task :holding_pen => :environment do
+ task holding_pen: :environment do
dryrun = ENV['DRYRUN'] != '0' if ENV['DRYRUN']
$stderr.puts "This is a dryrun - nothing will be deleted" if dryrun
holding_pen = InfoRequest.holding_pen_request
holding_pen.info_request_events.
- where(:event_type => %w(redeliver_incoming destroy_incoming)).
+ where(event_type: %w(redeliver_incoming destroy_incoming)).
find_each do |event|
$stderr.puts event.inspect if verbose or dryrun
event.destroy if not dryrun
@@ -14,7 +14,7 @@ namespace :cleanup do
end
desc 'Interactively cleanup spam user users'
- task :spam_users => :environment do
+ task spam_users: :environment do
spam_scorer = UserSpamScorer.new
results = {}
@@ -41,10 +41,10 @@ namespace :cleanup do
case input
when 'Y'
puts "Banning #{ user.id }\n\n"
- user.update!(:ban_text => 'Banned for spamming')
+ user.update!(ban_text: 'Banned for spamming')
when 'n'
puts "Marking #{ user.id } as genuine\n\n"
- user.update!(:confirmed_not_spam => true)
+ user.update!(confirmed_not_spam: true)
when 's'
puts "Skipping #{ user.id }\n\n"
end
@@ -53,14 +53,14 @@ namespace :cleanup do
end
desc 'Reindex banned users'
- task :reindex_banned_users => :environment do
+ task reindex_banned_users: :environment do
User.banned.find_each do |user|
user.xapian_mark_needs_index
end
end
desc 'Export of last 2 days of requests to search for spam'
- task :spam_requests => :environment do
+ task spam_requests: :environment do
str = CSV.generate do |csv|
# Make headers
csv << [
@@ -74,7 +74,7 @@ namespace :cleanup do
]
# Add rows
- InfoRequest.where(:created_at => [2.days.ago..Time.zone.now]).find_each do |request|
+ InfoRequest.where(created_at: [2.days.ago..Time.zone.now]).find_each do |request|
csv << [
request.id,
request.title,
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index be32028121..83a2f81bf1 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -35,17 +35,17 @@ namespace :config_files do
desc 'Return list of daemons to install based on the settings defined
in general.yml'
- task :active_daemons => :environment do
+ task active_daemons: :environment do
puts daemons(true)
end
desc 'Return list of all daemons the application defines'
- task :all_daemons => :environment do
+ task all_daemons: :environment do
puts daemons
end
desc 'Return the value of a config param'
- task :get_config_value => :environment do
+ task get_config_value: :environment do
example = 'rake config_files:get_config_value ' \
'KEY=PRODUCTION_MAILER_RETRIEVER_METHOD'
check_for_env_vars(['KEY'], example)
@@ -57,13 +57,13 @@ namespace :config_files do
end
desc 'Convert wrapper example in config to a form suitable for running mail handling scripts with rbenv'
- task :convert_wrapper => :environment do
+ task convert_wrapper: :environment do
example = 'rake config_files:convert_wrapper DEPLOY_USER=deploy SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(['DEPLOY_USER',
'SCRIPT_FILE'], example)
replacements = {
- :user => ENV['DEPLOY_USER'],
+ user: ENV['DEPLOY_USER'],
}
# Generate the template for potential further processing
@@ -73,7 +73,7 @@ namespace :config_files do
end
desc 'Convert Debian example init script in config to a form suitable for installing in /etc/init.d'
- task :convert_init_script => :environment do
+ task convert_init_script: :environment do
example = 'rake config_files:convert_init_script ' \
'DEPLOY_USER=deploy ' \
'VHOST_DIR=/dir/above/alaveteli ' \
@@ -87,19 +87,19 @@ namespace :config_files do
'SCRIPT_FILE'], example)
replacements = {
- :user => ENV['DEPLOY_USER'],
- :vhost_dir => ENV['VHOST_DIR'],
- :vcspath => ENV.fetch('VCSPATH') { 'alaveteli' },
- :site => ENV.fetch('SITE') { 'foi' },
- :cpus => ENV.fetch('CPUS') { '1' },
- :rails_env => ENV.fetch('RAILS_ENV') { 'development' },
- :ruby_version => ENV.fetch('RUBY_VERSION') { '' },
- :use_rbenv? => ENV['USE_RBENV'] == 'true'
+ user: ENV['DEPLOY_USER'],
+ vhost_dir: ENV['VHOST_DIR'],
+ vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
+ site: ENV.fetch('SITE') { 'foi' },
+ cpus: ENV.fetch('CPUS') { '1' },
+ rails_env: ENV.fetch('RAILS_ENV') { 'development' },
+ ruby_version: ENV.fetch('RUBY_VERSION') { '' },
+ use_rbenv?: ENV['USE_RBENV'] == 'true'
}
# Use the filename for the $daemon_name ugly variable
daemon_name = File.basename(ENV['SCRIPT_FILE'], '-debian.example')
- replacements.update(:daemon_name => "#{ replacements[:site] }-#{ daemon_name }")
+ replacements.update(daemon_name: "#{ replacements[:site] }-#{ daemon_name }")
# Generate the template for potential further processing
converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
@@ -119,7 +119,7 @@ namespace :config_files do
end
desc 'Convert Debian example crontab file in config to a form suitable for installing in /etc/cron.d'
- task :convert_crontab => :environment do
+ task convert_crontab: :environment do
example = 'rake config_files:convert_crontab ' \
'DEPLOY_USER=deploy ' \
'VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli ' \
@@ -133,13 +133,13 @@ namespace :config_files do
'SITE',
'CRONTAB'], example)
replacements = {
- :user => ENV['DEPLOY_USER'],
- :vhost_dir => ENV['VHOST_DIR'],
- :vcspath => ENV['VCSPATH'],
- :site => ENV['SITE'],
- :mailto => ENV.fetch('MAILTO') { "#{ ENV['DEPLOY_USER'] }@localhost" },
- :ruby_version => ENV.fetch('RUBY_VERSION') { '' },
- :use_rbenv? => ENV['USE_RBENV'] == 'true'
+ user: ENV['DEPLOY_USER'],
+ vhost_dir: ENV['VHOST_DIR'],
+ vcspath: ENV['VCSPATH'],
+ site: ENV['SITE'],
+ mailto: ENV.fetch('MAILTO') { "#{ ENV['DEPLOY_USER'] }@localhost" },
+ ruby_version: ENV.fetch('RUBY_VERSION') { '' },
+ use_rbenv?: ENV['USE_RBENV'] == 'true'
}
lines = []
@@ -153,17 +153,17 @@ namespace :config_files do
end
desc 'Convert miscellaneous example scripts. This does not check for required environment variables for the script, so please check the script file itself.'
- task :convert_script => :environment do
+ task convert_script: :environment do
example = 'rake config_files:convert_script SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(['SCRIPT_FILE'], example)
replacements = {
- :user => ENV.fetch('DEPLOY_USER') { 'alaveteli' },
- :vhost_dir => ENV.fetch('VHOST_DIR') { '/var/www/alaveteli' },
- :vcspath => ENV.fetch('VCSPATH') { 'alaveteli' },
- :site => ENV.fetch('SITE') { 'foi' },
- :cpus => ENV.fetch('CPUS') { '1' },
- :rails_env => ENV.fetch('RAILS_ENV') { 'development' }
+ user: ENV.fetch('DEPLOY_USER') { 'alaveteli' },
+ vhost_dir: ENV.fetch('VHOST_DIR') { '/var/www/alaveteli' },
+ vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
+ site: ENV.fetch('SITE') { 'foi' },
+ cpus: ENV.fetch('CPUS') { '1' },
+ rails_env: ENV.fetch('RAILS_ENV') { 'development' }
}
# Generate the template for potential further processing
@@ -184,14 +184,14 @@ namespace :config_files do
end
desc 'Set reject_incoming_at_mta on old requests that are rejecting incoming mail'
- task :set_reject_incoming_at_mta => :environment do
+ task set_reject_incoming_at_mta: :environment do
example = 'rake config_files:set_reject_incoming_at_mta REJECTED_THRESHOLD=5 AGE_IN_MONTHS=12'
check_for_env_vars(['REJECTED_THRESHOLD', 'AGE_IN_MONTHS'], example)
dryrun = ENV['DRYRUN'] != '0'
STDERR.puts "Only a dry run; info_requests will not be updated" if dryrun
- options = {:rejection_threshold => ENV['REJECTED_THRESHOLD'],
- :age_in_months => ENV['AGE_IN_MONTHS'],
- :dryrun => dryrun}
+ options = {rejection_threshold: ENV['REJECTED_THRESHOLD'],
+ age_in_months: ENV['AGE_IN_MONTHS'],
+ dryrun: dryrun}
updated_count = InfoRequest.reject_incoming_at_mta(options) do |ids|
puts "Info Request\tRejected incoming count\tLast updated"
@@ -219,7 +219,7 @@ namespace :config_files do
end
desc 'Unset reject_incoming_at_mta on a request'
- task :unset_reject_incoming_at_mta => :environment do
+ task unset_reject_incoming_at_mta: :environment do
example = 'rake config_files:unset_reject_incoming_at_mta REQUEST_ID=4'
check_for_env_vars(['REQUEST_ID'], example)
info_request = InfoRequest.find(ENV['REQUEST_ID'])
@@ -235,7 +235,7 @@ namespace :config_files do
end
desc 'Produce a list of email addresses for which the MTA should reject messages at RCPT time'
- task :generate_mta_rejection_list => :environment do
+ task generate_mta_rejection_list: :environment do
example = 'rake config_files:generate_mta_rejection_list MTA=(exim|postfix)'
check_for_env_vars(['MTA'], example)
mta = ENV['MTA'].downcase
@@ -243,7 +243,7 @@ namespace :config_files do
puts "Error: Unrecognised MTA"
exit 1
end
- InfoRequest.where(:reject_incoming_at_mta => true).each do |info_request|
+ InfoRequest.where(reject_incoming_at_mta: true).each do |info_request|
if mta == 'postfix'
puts "#{info_request.incoming_email} REJECT"
else
diff --git a/lib/tasks/embargoes.rake b/lib/tasks/embargoes.rake
index 0cabeeab71..1dc76343ba 100644
--- a/lib/tasks/embargoes.rake
+++ b/lib/tasks/embargoes.rake
@@ -1,7 +1,7 @@
namespace :embargoes do
desc "Delete any embargoes that have expired"
- task :expire_publishable => :environment do
+ task expire_publishable: :environment do
AlaveteliPro::Embargo.expire_publishable
end
diff --git a/lib/tasks/export.rake b/lib/tasks/export.rake
index 3c1327d2e1..6b15d42f1a 100644
--- a/lib/tasks/export.rake
+++ b/lib/tasks/export.rake
@@ -36,7 +36,7 @@ namespace :export do
# file using something like `tee`
# nice -n 19 [task] 1> exports/stdout.log 2> >(tee -a exports/stderr.log >&2)
desc 'exports all non-personal information to export folder'
- task :research_export => :environment do
+ task research_export: :environment do
cut_off_date = ENV["CUTOFF_DATE"]
to_run = ENV["MODELS"]
diff --git a/lib/tasks/gettext.rake b/lib/tasks/gettext.rake
index 94b1e69f77..d32cd7b5ac 100644
--- a/lib/tasks/gettext.rake
+++ b/lib/tasks/gettext.rake
@@ -64,17 +64,17 @@ namespace :gettext do
Rake::Task['find'].clear
desc "Update pot/po files."
- task :find => :environment do
+ task find: :environment do
find(files: files_to_translate, root: locale_path)
end
desc "Update pot/po files for Alaveteli Pro."
- task :find_alaveteli_pro => :environment do
+ task find_alaveteli_pro: :environment do
find(files: pro_files_to_translate, root: pro_locale_path)
end
desc "Update pot/po files for a theme."
- task :find_theme => :environment do
+ task find_theme: :environment do
find(files: theme_files_to_translate, root: theme_locale_path)
end
diff --git a/lib/tasks/graphs.rake b/lib/tasks/graphs.rake
index 1c3d7e96bb..16a7f2ab89 100644
--- a/lib/tasks/graphs.rake
+++ b/lib/tasks/graphs.rake
@@ -4,7 +4,7 @@ require File.join(File.dirname(__FILE__), '../graphs')
namespace :graphs do
include Graphs
- task :generate_user_use_graph => :environment do
+ task generate_user_use_graph: :environment do
minimum_data_size = ENV.fetch('MINIMUM_DATA_SIZE', 1).to_i
# set the local font path for the current task
@@ -68,29 +68,29 @@ namespace :graphs do
state_list = [
{
- :title => "users each day ... who registered",
- :colour => :lightblue
+ title: "users each day ... who registered",
+ colour: :lightblue
},
{
- :title => "... and since confirmed their email",
- :with => "impulses",
- :linewidth => 15,
- :colour => :mauve,
- :sql => confirmed_users
+ title: "... and since confirmed their email",
+ with: "impulses",
+ linewidth: 15,
+ colour: :mauve,
+ sql: confirmed_users
},
{
- :title => "...who made an FOI request",
- :with => "lines",
- :linewidth => 1,
- :colour => :red,
- :sql => active_users
+ title: "...who made an FOI request",
+ with: "lines",
+ linewidth: 1,
+ colour: :red,
+ sql: active_users
}
]
# plot all users
- options = {:with => "impulses",
- :linecolor => COLOURS[state_list[0][:colour]],
- :linewidth => 15, :title => state_list[0][:title]}
+ options = {with: "impulses",
+ linecolor: COLOURS[state_list[0][:colour]],
+ linewidth: 15, title: state_list[0][:title]}
all_users = select_as_columns(aggregate_signups)
# nothing to do, bail
@@ -110,10 +110,10 @@ namespace :graphs do
graph_param_sets << GraphParams.new(
state_info[:sql],
options.merge({
- :title => state_info[:title],
- :linecolor => COLOURS[state_info[:colour]],
- :with => state_info[:with],
- :linewidth => state_info[:linewidth]})
+ title: state_info[:title],
+ linecolor: COLOURS[state_info[:colour]],
+ with: state_info[:with],
+ linewidth: state_info[:linewidth]})
)
end
end
@@ -125,19 +125,19 @@ namespace :graphs do
if all_users[0].size > 1
# plot cumulative user totals
options.merge!({
- :title => "cumulative total number of users",
- :axes => "x1y2",
- :with => "lines",
- :linewidth => 1,
- :linecolor => COLOURS[:lightgreen],
- :using => "1:3"})
+ title: "cumulative total number of users",
+ axes: "x1y2",
+ with: "lines",
+ linewidth: 1,
+ linecolor: COLOURS[:lightgreen],
+ using: "1:3"})
plot_data_from_columns(all_users, options, plot.data)
end
end
end
end
- task :generate_request_creation_graph => :environment do
+ task generate_request_creation_graph: :environment do
minimum_data_size = ENV.fetch('MINIMUM_DATA_SIZE', 2).to_i
# set the local font path for the current task
@@ -189,21 +189,21 @@ namespace :graphs do
# get the data, plot the graph
- state_list = [ {:state => 'waiting_response', :colour => :darkblue},
- {:state => 'waiting_clarification', :colour => :lightblue},
- {:state => 'not_held', :colour => :yellow},
- {:state => 'rejected', :colour => :red},
- {:state => 'successful', :colour => :lightgreen},
- {:state => 'partially_successful', :colour => :darkgreen},
- {:state => 'requires_admin', :colour => :cyan},
- {:state => 'gone_postal', :colour => :darkyellow},
- {:state => 'internal_review', :colour => :mauve},
- {:state => 'error_message', :colour => :redbrown},
- {:state => 'user_withdrawn', :colour => :pink} ]
-
- options = {:with => "impulses",
- :linecolor => COLOURS[state_list[0][:colour]],
- :linewidth => 4, :title => state_list[0][:state]}
+ state_list = [ {state: 'waiting_response', colour: :darkblue},
+ {state: 'waiting_clarification', colour: :lightblue},
+ {state: 'not_held', colour: :yellow},
+ {state: 'rejected', colour: :red},
+ {state: 'successful', colour: :lightgreen},
+ {state: 'partially_successful', colour: :darkgreen},
+ {state: 'requires_admin', colour: :cyan},
+ {state: 'gone_postal', colour: :darkyellow},
+ {state: 'internal_review', colour: :mauve},
+ {state: 'error_message', colour: :redbrown},
+ {state: 'user_withdrawn', colour: :pink} ]
+
+ options = {with: "impulses",
+ linecolor: COLOURS[state_list[0][:colour]],
+ linewidth: 4, title: state_list[0][:state]}
# here be database-specific dragons...
# this uses a window function which is not supported by MySQL, but
@@ -239,8 +239,8 @@ namespace :graphs do
graph_param_sets << GraphParams.new(
assemble_sql(state_exclusion_sql(previous_states)),
options.merge({
- :title => state_info[:state],
- :linecolor => COLOURS[state_info[:colour]]})
+ title: state_info[:state],
+ linecolor: COLOURS[state_info[:colour]]})
)
end
previous_states << state_list[index][:state]
@@ -250,12 +250,12 @@ namespace :graphs do
# plot the cumulative counts
options.merge!({
- :with => "lines",
- :linecolor => COLOURS[:lightgreen],
- :linewidth => 1,
- :title => "cumulative total number of requests",
- :using => "1:3",
- :axes => "x1y2",
+ with: "lines",
+ linecolor: COLOURS[:lightgreen],
+ linewidth: 1,
+ title: "cumulative total number of requests",
+ using: "1:3",
+ axes: "x1y2",
})
plot_data_from_columns(all_requests, options, plot.data)
end
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 6126cb7261..6c14682e52 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -3,7 +3,7 @@ require 'tempfile'
namespace :import do
desc 'Import public bodies from CSV provided on standard input'
- task :import_csv => :environment do
+ task import_csv: :environment do
dryrun = ENV['DRYRUN'] != '0'
STDERR.puts 'Only a dry run; public bodies will not be created' if dryrun
diff --git a/lib/tasks/reindex.rake b/lib/tasks/reindex.rake
index b4aa4ea0ea..bb94fe28c8 100644
--- a/lib/tasks/reindex.rake
+++ b/lib/tasks/reindex.rake
@@ -1,7 +1,7 @@
namespace :reindex do
desc "Reindex events in batches"
- task :events => :environment do
+ task events: :environment do
reindex_log = Logger.new("#{Rails.root}/log/reindex_events.log")
last_id = ENV["LAST_EVENT_ID"] || 0
batch_size = (ENV["BATCH_SIZE"] || 300).to_i # default to 300
@@ -11,7 +11,7 @@ namespace :reindex do
current_id = 0 # keep track of the current event
begin
- InfoRequestEvent.where("id > #{last_id}").find_in_batches(:batch_size => batch_size) do |events|
+ InfoRequestEvent.where("id > #{last_id}").find_in_batches(batch_size: batch_size) do |events|
events.each do |event|
current_id = event.id
event.xapian_mark_needs_index
@@ -32,7 +32,7 @@ namespace :reindex do
end
desc "Reindex public bodies in batches"
- task :public_bodies => :environment do
+ task public_bodies: :environment do
reindex_log = Logger.new("#{Rails.root}/log/reindex_public_bodies.log")
last_id = ENV["LAST_PUBLIC_BODY_ID"] || 0
batch_size = (ENV["BATCH_SIZE"] || 300).to_i # default to 300
@@ -42,7 +42,7 @@ namespace :reindex do
current_id = 0 # keep track of the current public body
begin
- PublicBody.where("id > #{last_id}").find_in_batches(:batch_size => batch_size) do |bodies|
+ PublicBody.where("id > #{last_id}").find_in_batches(batch_size: batch_size) do |bodies|
bodies.each do |body|
current_id = body.id
body.xapian_mark_needs_index
@@ -63,7 +63,7 @@ namespace :reindex do
end
desc "Reindex users in batches"
- task :users => :environment do
+ task users: :environment do
reindex_log = Logger.new("#{Rails.root}/log/reindex_users.log")
last_id = ENV["LAST_USER_ID"] || 0
batch_size = (ENV["BATCH_SIZE"] || 300).to_i # default to 300
@@ -73,7 +73,7 @@ namespace :reindex do
current_id = 0 # keep track of the current user
begin
- User.where("id > #{last_id}").find_in_batches(:batch_size => batch_size) do |users|
+ User.where("id > #{last_id}").find_in_batches(batch_size: batch_size) do |users|
users.each do |user|
current_id = user.id
user.xapian_mark_needs_index
diff --git a/lib/tasks/reminder.rake b/lib/tasks/reminder.rake
index cfb18d8097..a65db96ee4 100644
--- a/lib/tasks/reminder.rake
+++ b/lib/tasks/reminder.rake
@@ -1,7 +1,7 @@
namespace :reminder do
desc 'Send reminder email about public holiday data'
- task :public_holidays => :environment do
+ task public_holidays: :environment do
config = MySociety::Config.load_default
ReminderMailer.public_holidays(
diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake
index 41478c6ad9..356a5f6511 100644
--- a/lib/tasks/stats.rake
+++ b/lib/tasks/stats.rake
@@ -1,7 +1,7 @@
namespace :stats do
desc 'Produce monthly transaction stats for a period starting START_YEAR'
- task :show => :environment do
+ task show: :environment do
example = 'rake stats:show START_YEAR=2009 [START_MONTH=3 END_YEAR=2012 END_MONTH=10]'
check_for_env_vars(['START_YEAR'], example)
start_year = (ENV['START_YEAR']).to_i
@@ -72,13 +72,13 @@ namespace :stats do
confirmed_users_count =
User.active.
- where(:email_confirmed => true).
+ where(email_confirmed: true).
where(date_conditions).
count
pro_confirmed_users_count =
User.pro.active.
- where(:email_confirmed => true).
+ where(email_confirmed: true).
where('users.created_at >= ?
AND users.created_at < ?',
month_start, month_end+1).
@@ -112,7 +112,7 @@ namespace :stats do
end
desc 'Produce stats on volume of requests to authorities matching a set of tags. Specify tags as TAGS=tagone,tagtwo'
- task :volumes_by_authority_tag => :environment do
+ task volumes_by_authority_tag: :environment do
tags = ENV['TAGS'].split(',')
first_request_datetime = InfoRequest.minimum(:created_at)
start_year = first_request_datetime.strftime("%Y").to_i
@@ -168,7 +168,7 @@ namespace :stats do
Prints the per-quarter number of created FOI Requests made to each Public Body found by the query.
Specify the search query as QUERY='london school'
DESC
- task :number_of_requests_created => :environment do
+ task number_of_requests_created: :environment do
query = ENV['QUERY']
start_at = PublicBody.minimum(:created_at)
finish_at = PublicBody.maximum(:created_at)
@@ -195,7 +195,7 @@ namespace :stats do
Prints the per-quarter number of successful FOI Requests made to each Public Body found by the query.
Specify the search query as QUERY='london school'
DESC
- task :number_of_requests_successful => :environment do
+ task number_of_requests_successful: :environment do
query = ENV['QUERY']
start_at = PublicBody.minimum(:created_at)
finish_at = PublicBody.maximum(:created_at)
@@ -220,9 +220,9 @@ namespace :stats do
end
desc 'Update statistics in the public_bodies table'
- task :update_public_bodies_stats => :environment do
+ task update_public_bodies_stats: :environment do
verbose = ENV['VERBOSE'] == '1'
- PublicBody.find_each(:batch_size => 10) do |public_body|
+ PublicBody.find_each(batch_size: 10) do |public_body|
puts "Counting overdue requests for #{public_body.name}" if verbose
# Look for values of 'waiting_response_overdue' and
@@ -231,11 +231,11 @@ namespace :stats do
overdue_count = 0
very_overdue_count = 0
- conditions = { :public_body_id => public_body.id,
- :awaiting_description => false }
+ conditions = { public_body_id: public_body.id,
+ awaiting_description: false }
InfoRequest.
- is_searchable.where(conditions).find_each(:batch_size => 200) do |ir|
+ is_searchable.where(conditions).find_each(batch_size: 200) do |ir|
case ir.calculate_status
when 'waiting_response_very_overdue'
very_overdue_count += 1
@@ -253,35 +253,35 @@ namespace :stats do
desc 'Add InfoRequestEvents for the points when requests became overdue
and very overdue'
- task :update_overdue_info_request_events => :environment do
+ task update_overdue_info_request_events: :environment do
InfoRequest.log_overdue_events
InfoRequest.log_very_overdue_events
end
desc 'Add InfoRequestEvents for the points when requests embargoes began to
expire'
- task :update_expiring_embargo_info_request_events => :environment do
+ task update_expiring_embargo_info_request_events: :environment do
AlaveteliPro::Embargo.log_expiring_events
end
desc 'Print a list of the admin URLs of requests with hidden material'
- task :list_hidden => :environment do
+ task list_hidden: :environment do
include Rails.application.routes.url_helpers
- hidden_requests = InfoRequest.where(:prominence => 'hidden')
- requester_only_requests = InfoRequest.where(:prominence => 'requester_only')
+ hidden_requests = InfoRequest.where(prominence: 'hidden')
+ requester_only_requests = InfoRequest.where(prominence: 'requester_only')
hidden_incoming = InfoRequest.joins(:incoming_messages).
- where(:incoming_messages => {:prominence => 'hidden'}).uniq
+ where(incoming_messages: {prominence: 'hidden'}).uniq
requester_only_incoming = InfoRequest.joins(:incoming_messages).
- where(:incoming_messages => {:prominence => 'requester_only'}).uniq
+ where(incoming_messages: {prominence: 'requester_only'}).uniq
hidden_outgoing = InfoRequest.joins(:outgoing_messages).
- where(:outgoing_messages => {:prominence => 'hidden'}).uniq
+ where(outgoing_messages: {prominence: 'hidden'}).uniq
requester_only_outgoing = InfoRequest.joins(:outgoing_messages).
- where(:outgoing_messages => {:prominence => 'requester_only'}).uniq
+ where(outgoing_messages: {prominence: 'requester_only'}).uniq
hidden_comments = InfoRequest.joins(:comments).
- where(:comments => {:visible => false}).uniq
+ where(comments: {visible: false}).uniq
[['Hidden requests', hidden_requests],
['Requester-only requests', requester_only_requests],
@@ -293,7 +293,7 @@ namespace :stats do
unless list.empty?
puts "\n#{title}\n"
list.each do |request|
- request_line = "#{admin_request_url(request, :host => AlaveteliConfiguration::domain)}"
+ request_line = "#{admin_request_url(request, host: AlaveteliConfiguration::domain)}"
if ['vexatious', 'not_foi'].include? request.described_state
request_line << "\t#{request.described_state}"
end
@@ -304,7 +304,7 @@ namespace :stats do
end
desc 'Output all the requests made to the top 20 public bodies'
- task :get_top20_body_requests => :environment do
+ task get_top20_body_requests: :environment do
require 'csv'
puts CSV.generate_line(["public_body_id", "public_body_name", "request_created_timestamp", "request_title", "request_body"])
diff --git a/lib/tasks/submodules.rake b/lib/tasks/submodules.rake
index 50d768d93f..94e4034d98 100644
--- a/lib/tasks/submodules.rake
+++ b/lib/tasks/submodules.rake
@@ -1,7 +1,7 @@
namespace :submodules do
desc "Check the status of the project's submodules"
- task :check => :environment do
+ task check: :environment do
commit_info = `git submodule status commonlib`
case commit_info[0,1]
when '+'
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 247ee02c40..a09ffdd4c9 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -133,7 +133,7 @@ namespace :themes do
end
desc "Install themes specified in the config file's THEME_URLS"
- task :install => :environment do
+ task install: :environment do
verbose = true
theme_urls.each do |theme_url|
install_theme(theme_url, verbose)
@@ -191,7 +191,7 @@ namespace :themes do
end
desc "Check that all help sections referred to in the application are present in theme"
- task :check_help_sections => :environment do
+ task check_help_sections: :environment do
intro_message = <<-EOF
@@ -212,36 +212,36 @@ EOF
theme_url_to_theme_name(theme_url)
end
- help_templates_info = [{:name => 'about',
- :sections => ['whybother_them',
+ help_templates_info = [{name: 'about',
+ sections: ['whybother_them',
'reporting',
'reporting_unavailable']},
- {:name => 'alaveteli',
- :sections => []},
- {:name => 'api',
- :sections => []},
- {:name => 'contact',
- :sections => []},
- {:name => 'credits',
- :sections => ['helpus']},
- {:name => 'officers',
- :sections => ['copyright']},
- {:name => 'privacy',
- :sections => ['email_address',
+ {name: 'alaveteli',
+ sections: []},
+ {name: 'api',
+ sections: []},
+ {name: 'contact',
+ sections: []},
+ {name: 'credits',
+ sections: ['helpus']},
+ {name: 'officers',
+ sections: ['copyright']},
+ {name: 'privacy',
+ sections: ['email_address',
'full_address',
'postal_answer',
'public_request',
'real_name']},
- {:name => 'requesting',
- :sections => ['focused',
+ {name: 'requesting',
+ sections: ['focused',
'data_protection',
'missing_body',
'quickly_response',]},
- {:name => 'unhappy',
- :sections => ['internal_review',
+ {name: 'unhappy',
+ sections: ['internal_review',
'other_means']},
- {:name => '_why_they_should_reply_by_email',
- :sections => []}]
+ {name: '_why_they_should_reply_by_email',
+ sections: []}]
theme_names.each do |theme_name|
AlaveteliLocalization.available_locales.each do |locale|
diff --git a/lib/tasks/translation.rake b/lib/tasks/translation.rake
index 4cbb3bea69..b70158f6e1 100644
--- a/lib/tasks/translation.rake
+++ b/lib/tasks/translation.rake
@@ -26,7 +26,7 @@ namespace :translation do
end
desc "Create previews of translated emails"
- task :preview_emails => :environment do
+ task preview_emails: :environment do
check_for_env_vars(['INFO_REQUEST_ID',
'FOLLOW_UP_ID',
'INCOMING_MESSAGE_ID',
@@ -148,10 +148,10 @@ namespace :translation do
# track mailer
xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], track_thing.track_query,
- :sort_by_prefix => 'described_at',
- :sort_by_ascending => true,
- :collapse_by_prefix => nil,
- :limit => 100)
+ sort_by_prefix: 'described_at',
+ sort_by_ascending: true,
+ collapse_by_prefix: nil,
+ limit: 100)
event_digest_email = TrackMailer.event_digest(info_request.user,
[[track_thing,
xapian_object.results,
@@ -161,9 +161,9 @@ namespace :translation do
# user mailer
site_name = AlaveteliConfiguration::site_name
reasons = {
- :web => "",
- :email => _("Then you can sign in to {{site_name}}", :site_name => site_name),
- :email_subject => _("Confirm your account on {{site_name}}", :site_name => site_name)
+ web: "",
+ email: _("Then you can sign in to {{site_name}}", site_name: site_name),
+ email_subject: _("Confirm your account on {{site_name}}", site_name: site_name)
}
confirm_login_email = UserMailer.confirm_login(info_request.user,
reasons,
diff --git a/lib/tasks/users.rake b/lib/tasks/users.rake
index 5e25d73658..cd353cf30b 100644
--- a/lib/tasks/users.rake
+++ b/lib/tasks/users.rake
@@ -20,7 +20,7 @@ namespace :users do
end
desc "Lists per domain stats"
- task :stats_by_domain => :environment do
+ task stats_by_domain: :environment do
raise "must supply a DOMAIN value" unless ENV["DOMAIN"]
domain = ENV["DOMAIN"]
from = ENV["START_DATE"]
@@ -52,7 +52,7 @@ namespace :users do
end
desc "Bans all users for a specific domain"
- task :ban_by_domain => :environment do
+ task ban_by_domain: :environment do
raise "must supply a DOMAIN value" unless ENV["DOMAIN"]
domain = ENV["DOMAIN"]
from = ENV["START_DATE"]
@@ -70,7 +70,7 @@ namespace :users do
if input.downcase == "y"
to_ban = UserStats.unbanned_by_domain(domain, from)
count = to_ban.
- update_all(:ban_text => "Banned for spamming")
+ update_all(ban_text: "Banned for spamming")
p "#{count} accounts banned"
else
p "No action taken"
@@ -85,7 +85,7 @@ namespace :users do
FIELDS: A CSV list of User attributes to print
(default: "id,name,email,activity")
EOF
- task :pro_activity => :environment do
+ task pro_activity: :environment do
fields =
if ENV['FIELDS']
ENV['FIELDS'].split(',').map(&:strip)
diff --git a/lib/typeahead_search.rb b/lib/typeahead_search.rb
index 79fb122520..38c4e2f70c 100644
--- a/lib/typeahead_search.rb
+++ b/lib/typeahead_search.rb
@@ -34,13 +34,13 @@ def xapian_search
def options
{
- :offset => (@page - 1) * @per_page,
- :limit => @per_page,
- :sort_by_prefix => nil,
- :sort_by_ascending => true,
- :collapse_by_prefix => collapse?,
- :wildcard => @wildcard,
- :model => @model
+ offset: (@page - 1) * @per_page,
+ limit: @per_page,
+ sort_by_prefix: nil,
+ sort_by_ascending: true,
+ collapse_by_prefix: collapse?,
+ wildcard: @wildcard,
+ model: @model
}
end
diff --git a/lib/user_spam_scorer.rb b/lib/user_spam_scorer.rb
index c20fe8b8ed..d61501609a 100644
--- a/lib/user_spam_scorer.rb
+++ b/lib/user_spam_scorer.rb
@@ -1,20 +1,20 @@
class UserSpamScorer
DEFAULT_SCORE_MAPPINGS = {
- :name_is_all_lowercase? => 1,
- :name_is_one_word? => 1,
- :name_includes_non_alpha_characters? => 3,
- :name_is_garbled? => 5,
- :email_from_suspicious_domain? => 5,
- :email_from_spam_domain? => 8,
- :email_from_spam_tld? => 3,
- :name_is_spam_format? => 5,
- :about_me_includes_currency_symbol? => 2,
- :about_me_is_link_only? => 3,
- :about_me_is_spam_format? => 1,
- :about_me_includes_anchor_tag? => 1,
- :about_me_already_exists? => 4,
- :user_agent_is_suspicious? => 5,
- :ip_range_is_suspicious? => 5
+ name_is_all_lowercase?: 1,
+ name_is_one_word?: 1,
+ name_includes_non_alpha_characters?: 3,
+ name_is_garbled?: 5,
+ email_from_suspicious_domain?: 5,
+ email_from_spam_domain?: 8,
+ email_from_spam_tld?: 3,
+ name_is_spam_format?: 5,
+ about_me_includes_currency_symbol?: 2,
+ about_me_is_link_only?: 3,
+ about_me_is_spam_format?: 1,
+ about_me_includes_anchor_tag?: 1,
+ about_me_already_exists?: 4,
+ user_agent_is_suspicious?: 5,
+ ip_range_is_suspicious?: 5
}.freeze
DEFAULT_CURRENCY_SYMBOLS = %w(£ $ € ¥ ¢).freeze
diff --git a/lib/user_stats.rb b/lib/user_stats.rb
index 7ea2d94af0..42a7cd7f51 100644
--- a/lib/user_stats.rb
+++ b/lib/user_stats.rb
@@ -64,7 +64,7 @@ def self.unbanned_by_domain(domain, start_date=nil)
eligible = User.
where("email LIKE ?", "%@#{domain}").
not_banned.
- where.not(:id => User.with_role(:admin).pluck('users.id'))
+ where.not(id: User.with_role(:admin).pluck('users.id'))
if start_date
eligible.where("created_at >= ?", start_date)
diff --git a/lib/world_foi_websites.rb b/lib/world_foi_websites.rb
index 61828eaaae..8af67d89de 100644
--- a/lib/world_foi_websites.rb
+++ b/lib/world_foi_websites.rb
@@ -29,118 +29,118 @@ class WorldFOIWebsites
def self.world_foi_websites
world_foi_websites = [
- { :name => "WhatDoTheyKnow",
- :country_name => "United Kingdom",
- :country_iso_code => "GB",
- :url => "https://www.whatdotheyknow.com" },
- { :name => "Ask The EU",
- :country_name => "European Union",
- :country_iso_code => "",
- :url => "http://asktheeu.org" },
- { :name => "MuckRock.com",
- :country_name => "United States of America",
- :country_iso_code => "US",
- :url => "http://www.muckrock.com" },
- { :name => "FYI",
- :country_name => "New Zealand",
- :country_iso_code => "NZ",
- :url => "http://fyi.org.nz" },
- { :name => "Frag den Staat",
- :country_name => "Deutschland",
- :country_iso_code => "DE",
- :url => "http://fragdenstaat.de" },
- { :name => "Queremos Saber",
- :country_name => "Brasil",
- :country_iso_code => "BR",
- :url => "http://queremossaber.org.br" },
- { :name => "Ki Mit Tud",
- :country_name => "Magyarország",
- :country_iso_code => "HU",
- :url => "http://kimittud.atlatszo.hu/" },
- { :name => "PravoDaSznam",
- :country_name => "Bosna i Hercegovina",
- :country_iso_code => "BA",
- :url => "http://www.pravodaznam.ba/" },
- { :name => "Right To Know",
- :country_name => "Australia",
- :country_iso_code => "AU",
- :url => "http://www.righttoknow.org.au" },
- { :name => "Informace pro Vsechny",
- :country_name => "České Republiky",
- :country_iso_code => "CZ",
- :url => "http://www.infoprovsechny.cz" },
- { :name => "¿Qué Sabés?",
- :country_name => "Uruguay",
- :country_iso_code => "UY",
- :url => "http://www.quesabes.org/" },
- { :name => "Nu Vă Supărați",
- :country_name => "România",
- :country_iso_code => "RO",
- :url => "http://nuvasuparati.info/" },
- { :name => "Доступ до правди",
- :country_name => "Україна",
- :country_iso_code => "UA",
- :url => "https://dostup.pravda.com.ua/" },
- { :name => "Ask Data",
- :country_name => "מְדִינַת יִשְׂרָאֵל",
- :country_iso_code => "IL",
- :url => "http://askdata.org.il/" },
- { :name => "Слободен пристап",
- :country_name => "Република Македонија",
- :country_iso_code => "MK",
- :url => "http://www.slobodenpristap.mk/" },
- { :name => "Imamo pravo znati",
- :country_name => "Republika Hrvatska",
- :country_iso_code => "HR",
- :url => "http://imamopravoznati.org/" },
- { :name => 'Right2Know.my',
- :country_name => 'Malaysia',
- :country_iso_code => 'MY',
- :url => "http://foi.sinarproject.org/" },
- { :name => 'Sobanukirwa',
- :country_name => 'Rwanda',
- :country_iso_code => 'RW',
- :url => "https://sobanukirwa.rw/" },
- { :name => 'AccessInfo.hk',
- :country_name => '香港',
- :country_iso_code => 'HK',
- :url => "https://accessinfo.hk/" },
- { :name => 'Ask Your Government Uganda',
- :country_name => 'Uganda',
- :country_iso_code => 'UG',
- :url => "http://askyourgov.ug/" },
- { :name => 'Mimes Brønn',
- :country_name => 'Norge',
- :country_iso_code => 'NO',
- :url => "https://www.mimesbronn.no/" },
- { :name => 'QueremoSaber',
- :country_name => 'Paraguay',
- :country_iso_code => 'PY',
- :url => "https://www.queremosaber.org.py/" },
- { :name => 'Derecho a Preguntar',
- :country_name => 'Nicaragua',
- :country_iso_code => 'NI',
- :url => "https://derechoapreguntar.org/" },
- { :name => 'InfoLib',
- :country_name => 'Liberia',
- :country_iso_code => 'LR',
- :url => "http://infolib.org.lr/" },
- { :name => 'MaDada',
- :country_name => 'France',
- :country_iso_code => 'FR',
- :url => "https://madada.fr/" },
- { :name => 'Handlingar',
- :country_name => 'Sweden',
- :country_iso_code => 'SE',
- :url => "https://handlingar.se/" },
- { :name => 'VreauInfo',
- :country_name => 'Moldova',
- :country_iso_code => 'MD',
- :url => "https://www.vreauinfo.md/" },
- { :name => 'Derecho al Dato',
- :country_name => 'Argentina',
- :country_iso_code => 'AR',
- :url => 'https://derechoaldato.com.ar/' },
+ { name: "WhatDoTheyKnow",
+ country_name: "United Kingdom",
+ country_iso_code: "GB",
+ url: "https://www.whatdotheyknow.com" },
+ { name: "Ask The EU",
+ country_name: "European Union",
+ country_iso_code: "",
+ url: "http://asktheeu.org" },
+ { name: "MuckRock.com",
+ country_name: "United States of America",
+ country_iso_code: "US",
+ url: "http://www.muckrock.com" },
+ { name: "FYI",
+ country_name: "New Zealand",
+ country_iso_code: "NZ",
+ url: "http://fyi.org.nz" },
+ { name: "Frag den Staat",
+ country_name: "Deutschland",
+ country_iso_code: "DE",
+ url: "http://fragdenstaat.de" },
+ { name: "Queremos Saber",
+ country_name: "Brasil",
+ country_iso_code: "BR",
+ url: "http://queremossaber.org.br" },
+ { name: "Ki Mit Tud",
+ country_name: "Magyarország",
+ country_iso_code: "HU",
+ url: "http://kimittud.atlatszo.hu/" },
+ { name: "PravoDaSznam",
+ country_name: "Bosna i Hercegovina",
+ country_iso_code: "BA",
+ url: "http://www.pravodaznam.ba/" },
+ { name: "Right To Know",
+ country_name: "Australia",
+ country_iso_code: "AU",
+ url: "http://www.righttoknow.org.au" },
+ { name: "Informace pro Vsechny",
+ country_name: "České Republiky",
+ country_iso_code: "CZ",
+ url: "http://www.infoprovsechny.cz" },
+ { name: "¿Qué Sabés?",
+ country_name: "Uruguay",
+ country_iso_code: "UY",
+ url: "http://www.quesabes.org/" },
+ { name: "Nu Vă Supărați",
+ country_name: "România",
+ country_iso_code: "RO",
+ url: "http://nuvasuparati.info/" },
+ { name: "Доступ до правди",
+ country_name: "Україна",
+ country_iso_code: "UA",
+ url: "https://dostup.pravda.com.ua/" },
+ { name: "Ask Data",
+ country_name: "מְדִינַת יִשְׂרָאֵל",
+ country_iso_code: "IL",
+ url: "http://askdata.org.il/" },
+ { name: "Слободен пристап",
+ country_name: "Република Македонија",
+ country_iso_code: "MK",
+ url: "http://www.slobodenpristap.mk/" },
+ { name: "Imamo pravo znati",
+ country_name: "Republika Hrvatska",
+ country_iso_code: "HR",
+ url: "http://imamopravoznati.org/" },
+ { name: 'Right2Know.my',
+ country_name: 'Malaysia',
+ country_iso_code: 'MY',
+ url: "http://foi.sinarproject.org/" },
+ { name: 'Sobanukirwa',
+ country_name: 'Rwanda',
+ country_iso_code: 'RW',
+ url: "https://sobanukirwa.rw/" },
+ { name: 'AccessInfo.hk',
+ country_name: '香港',
+ country_iso_code: 'HK',
+ url: "https://accessinfo.hk/" },
+ { name: 'Ask Your Government Uganda',
+ country_name: 'Uganda',
+ country_iso_code: 'UG',
+ url: "http://askyourgov.ug/" },
+ { name: 'Mimes Brønn',
+ country_name: 'Norge',
+ country_iso_code: 'NO',
+ url: "https://www.mimesbronn.no/" },
+ { name: 'QueremoSaber',
+ country_name: 'Paraguay',
+ country_iso_code: 'PY',
+ url: "https://www.queremosaber.org.py/" },
+ { name: 'Derecho a Preguntar',
+ country_name: 'Nicaragua',
+ country_iso_code: 'NI',
+ url: "https://derechoapreguntar.org/" },
+ { name: 'InfoLib',
+ country_name: 'Liberia',
+ country_iso_code: 'LR',
+ url: "http://infolib.org.lr/" },
+ { name: 'MaDada',
+ country_name: 'France',
+ country_iso_code: 'FR',
+ url: "https://madada.fr/" },
+ { name: 'Handlingar',
+ country_name: 'Sweden',
+ country_iso_code: 'SE',
+ url: "https://handlingar.se/" },
+ { name: 'VreauInfo',
+ country_name: 'Moldova',
+ country_iso_code: 'MD',
+ url: "https://www.vreauinfo.md/" },
+ { name: 'Derecho al Dato',
+ country_name: 'Argentina',
+ country_iso_code: 'AR',
+ url: 'https://derechoaldato.com.ar/' },
]
return world_foi_websites
end
diff --git a/spec/lib/acts_as_xapian_spec.rb b/spec/lib/acts_as_xapian_spec.rb
index a061574d59..587457bc13 100644
--- a/spec/lib/acts_as_xapian_spec.rb
+++ b/spec/lib/acts_as_xapian_spec.rb
@@ -179,52 +179,52 @@
end
before do
- @alice = FactoryBot.create(:public_body, :name => 'alice')
+ @alice = FactoryBot.create(:public_body, name: 'alice')
update_xapian_index
end
it "should return a list of words used in the search" do
- s = ActsAsXapian::Search.new([PublicBody], "albatross words", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "albatross words", limit: 100)
expect(s.words_to_highlight).to eq(["albatross", "word"])
end
it "should remove any operators" do
- s = ActsAsXapian::Search.new([PublicBody], "albatross words tag:mice", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "albatross words tag:mice", limit: 100)
expect(s.words_to_highlight).to eq(["albatross", "word"])
end
it "should separate punctuation" do
- s = ActsAsXapian::Search.new([PublicBody], "The doctor's patient", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "The doctor's patient", limit: 100)
expect(s.words_to_highlight).to eq(["the", "doctor", "patient"].sort)
end
it "should handle non-ascii characters" do
- s = ActsAsXapian::Search.new([PublicBody], "adatigénylés words tag:mice", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "adatigénylés words tag:mice", limit: 100)
expect(s.words_to_highlight).to eq(["adatigénylé", "word"])
end
it "should ignore stopwords" do
- s = ActsAsXapian::Search.new([PublicBody], "department of humpadinking", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "department of humpadinking", limit: 100)
expect(s.words_to_highlight).not_to include('of')
end
it "uses stemming" do
- s = ActsAsXapian::Search.new([PublicBody], 'department of humpadinking', :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], 'department of humpadinking', limit: 100)
expect(s.words_to_highlight).to eq(["depart", "humpadink"])
end
it "doesn't stem proper nouns" do
- s = ActsAsXapian::Search.new([PublicBody], 'department of Humpadinking', :limit => 1)
+ s = ActsAsXapian::Search.new([PublicBody], 'department of Humpadinking', limit: 1)
expect(s.words_to_highlight).to eq(["depart", "humpadinking"])
end
it "includes the original search terms if requested" do
- s = ActsAsXapian::Search.new([PublicBody], 'boring', :limit => 1)
- expect(s.words_to_highlight(:include_original => true)).to eq(['bore', 'boring'])
+ s = ActsAsXapian::Search.new([PublicBody], 'boring', limit: 1)
+ expect(s.words_to_highlight(include_original: true)).to eq(['bore', 'boring'])
end
it "does not return duplicate terms" do
- s = ActsAsXapian::Search.new([PublicBody], 'boring boring', :limit => 1)
+ s = ActsAsXapian::Search.new([PublicBody], 'boring boring', limit: 1)
expect(s.words_to_highlight).to eq(['bore'])
end
@@ -232,14 +232,14 @@
it 'wraps each words in a regex that matches the full word' do
expected = [/\b(albatross)\b/iu]
- s = ActsAsXapian::Search.new([PublicBody], 'Albatross', :limit => 1)
- expect(s.words_to_highlight(:regex => true)).to eq(expected)
+ s = ActsAsXapian::Search.new([PublicBody], 'Albatross', limit: 1)
+ expect(s.words_to_highlight(regex: true)).to eq(expected)
end
it 'wraps each stem in a regex' do
expected = [/\b(depart)\w*\b/iu]
- s = ActsAsXapian::Search.new([PublicBody], 'department', :limit => 1)
- expect(s.words_to_highlight(:regex => true)).to eq(expected)
+ s = ActsAsXapian::Search.new([PublicBody], 'department', limit: 1)
+ expect(s.words_to_highlight(regex: true)).to eq(expected)
end
end
@@ -253,19 +253,19 @@
end
before do
- @alice = FactoryBot.create(:public_body, :name => 'alice')
- @bob = FactoryBot.create(:public_body, :name => 'bôbby')
+ @alice = FactoryBot.create(:public_body, name: 'alice')
+ @bob = FactoryBot.create(:public_body, name: 'bôbby')
update_xapian_index
end
it 'returns a UTF-8 encoded string' do
- s = ActsAsXapian::Search.new([PublicBody], "alece", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "alece", limit: 100)
expect(s.spelling_correction).to eq("alice")
expect(s.spelling_correction.encoding.to_s).to eq('UTF-8')
end
it 'handles non-ASCII characters' do
- s = ActsAsXapian::Search.new([PublicBody], "bobby", :limit => 100)
+ s = ActsAsXapian::Search.new([PublicBody], "bobby", limit: 100)
expect(s.spelling_correction).to eq("bôbby")
end
diff --git a/spec/lib/alaveteli_rate_limiter/backends/pstore_database_spec.rb b/spec/lib/alaveteli_rate_limiter/backends/pstore_database_spec.rb
index 0347a7fb15..b24445ca9f 100644
--- a/spec/lib/alaveteli_rate_limiter/backends/pstore_database_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/backends/pstore_database_spec.rb
@@ -16,13 +16,13 @@
it 'initializes a PStore at the given path' do
path = Pathname.new("#{ Rails.root }/tmp/custom_database.pstore")
- subject = described_class.new(:path => path)
+ subject = described_class.new(path: path)
expect(subject.pstore.path).to eq(path)
end
it 'converts a string path to a pathname' do
path = "#{ Rails.root }/tmp/custom_database.pstore"
- subject = described_class.new(:path => path)
+ subject = described_class.new(path: path)
expect(subject.pstore.path).to eq(Pathname.new(path))
end
@@ -31,7 +31,7 @@
describe '#get' do
it 'returns the values for the key' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
expected = [Time.zone.parse('2016-10-21'),
Time.zone.parse('2016-10-21'),
@@ -43,7 +43,7 @@
end
it 'only includes values recorded for the given key' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
expected = [Time.zone.parse('2016-10-21'),
Time.zone.parse('2016-10-21'),
@@ -62,13 +62,13 @@
describe '#set' do
it 'sets a new record for the given keys' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
subject.set('key', [])
expect(subject.get('key')).to eq([])
end
it 'overrides the records for the given keys' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
subject.record('key')
subject.record('key')
@@ -84,7 +84,7 @@
describe '#record' do
it 'records an event for a given IP and event' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
time = Time.zone.now.to_datetime
travel_to(time) do
@@ -98,14 +98,14 @@
describe '#==' do
it 'is equal if the pstore paths are the same' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
expect(subject).to eq(subject.dup)
end
it 'is not equal if the pstore paths are different' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
path = "#{ Rails.root }/tmp/custom_database.pstore"
- expect(subject).not_to eq(described_class.new(:path => path))
+ expect(subject).not_to eq(described_class.new(path: path))
end
end
@@ -113,14 +113,14 @@
describe '#destroy' do
it 'destroys the pstore' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
subject.set('1', '2')
subject.destroy
expect(File.exist?(test_path)).to eq(false)
end
it 'does not attempt to destroy the pstore if it does not yet exist' do
- subject = described_class.new(:path => test_path)
+ subject = described_class.new(path: test_path)
expect { subject.destroy }.not_to raise_error
end
diff --git a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults_spec.rb b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults_spec.rb
index dd8cb3d21b..114b3ee91c 100644
--- a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter/defaults_spec.rb
@@ -10,14 +10,14 @@
end
it 'sets the whitelist if the option is nil' do
- subject = described_class.new(:whitelist => nil)
+ subject = described_class.new(whitelist: nil)
expect(subject.whitelist).
to eq(AlaveteliRateLimiter::IPRateLimiter::Whitelist.new)
end
it 'sets the custom whitelist' do
whitelist = double
- subject = described_class.new(:whitelist => whitelist)
+ subject = described_class.new(whitelist: whitelist)
expect(subject.whitelist).to eq(whitelist)
end
@@ -26,13 +26,13 @@
end
it 'sets the event_rules if the option is nil' do
- subject = described_class.new(:event_rules => nil)
+ subject = described_class.new(event_rules: nil)
expect(subject.event_rules).to eq(described_class::EVENT_RULES)
end
it 'sets the custom event_rules' do
event_rules = double
- subject = described_class.new(:event_rules => event_rules)
+ subject = described_class.new(event_rules: event_rules)
expect(subject.event_rules).to eq(event_rules)
end
@@ -78,7 +78,7 @@
describe '#==' do
it 'is equal if its attributes are identical' do
- opts = { :whitelist => double }
+ opts = { whitelist: double }
subject = described_class.new(opts)
expect(subject).to eq(subject.dup)
end
@@ -86,7 +86,7 @@
it 'is not equal if any of the attributes vary' do
whitelist = AlaveteliRateLimiter::IPRateLimiter::Whitelist.
new(%w(127.0.0.1 0.0.0.1))
- subject2 = described_class.new(:whitelist => whitelist)
+ subject2 = described_class.new(whitelist: whitelist)
expect(subject).not_to eq(subject2)
end
diff --git a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
index 83dc81fa34..bd6f584f5f 100644
--- a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
@@ -17,7 +17,7 @@
whitelist = double
defaults = AlaveteliRateLimiter::IPRateLimiter::Defaults.
- new(:whitelist => whitelist)
+ new(whitelist: whitelist)
described_class.set_defaults do |defaults|
defaults.whitelist = whitelist
@@ -41,14 +41,14 @@
end
it 'looks up a Symbol rule from the configured defaults' do
- rule_attrs = { :count => 3, :window => { :value => 1, :unit => :hour } }
+ rule_attrs = { count: 3, window: { value: 1, unit: :hour } }
described_class.set_defaults do |defaults|
- defaults.event_rules = { :signup => rule_attrs }
+ defaults.event_rules = { signup: rule_attrs }
end
rule =
- AlaveteliRateLimiter::Rule.from_hash(rule_attrs.merge(:name => :signup))
+ AlaveteliRateLimiter::Rule.from_hash(rule_attrs.merge(name: :signup))
expect(described_class.new(:signup).rule).to eq(rule)
end
@@ -68,14 +68,14 @@
new(Rails.root + "tmp/#{ subject.rule.name }_ip_rate_limiter.pstore")
expected =
- AlaveteliRateLimiter::Backends::PStoreDatabase.new(:path => path)
+ AlaveteliRateLimiter::Backends::PStoreDatabase.new(path: path)
expect(subject.backend).to eq(expected)
end
it 'allows a custom backend' do
backend = double
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(subject.backend).to eq(backend)
end
@@ -86,7 +86,7 @@
it 'allows a custom whitelist' do
whitelist = double
- subject = described_class.new(:signup, :whitelist => whitelist)
+ subject = described_class.new(:signup, whitelist: whitelist)
expect(subject.whitelist).to eq(whitelist)
end
@@ -105,7 +105,7 @@
it 'returns the whitelist attribute' do
whitelist = double
- subject = described_class.new(:signup, :whitelist => whitelist)
+ subject = described_class.new(:signup, whitelist: whitelist)
expect(subject.whitelist).to eq(whitelist)
end
@@ -115,7 +115,7 @@
it 'returns the backend attribute' do
backend = double
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(subject.backend).to eq(backend)
end
@@ -128,7 +128,7 @@
backend = double
records = [10.days.ago, 1.day.ago].map(&:to_datetime)
allow(backend).to receive(:get).with(ip).and_return(records)
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(subject.records(ip)).to eq(records)
end
@@ -138,21 +138,21 @@
it 'records an event for the IP in the backend' do
backend = double
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(backend).to receive(:record).with('127.0.0.1')
subject.record('127.0.0.1')
end
it 'converts an IPAddr to a String key' do
backend = double
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(backend).to receive(:record).with('127.0.0.1')
subject.record(IPAddr.new('127.0.0.1'))
end
it 'cleans a poorly formatted IP' do
backend = double
- subject = described_class.new(:signup, :backend => backend)
+ subject = described_class.new(:signup, backend: backend)
expect(backend).to receive(:record).with('127.0.0.1')
subject.record(" 127.0.0.1\n")
end
@@ -167,9 +167,9 @@
describe '#record!' do
it 'purges old records before recording the new event' do
- attrs = { :name => :test,
- :count => 20,
- :window => { :value => 1, :unit => :day } }
+ attrs = { name: :test,
+ count: 20,
+ window: { value: 1, unit: :day } }
rule = AlaveteliRateLimiter::Rule.from_hash(attrs)
@@ -178,10 +178,10 @@
new(Rails.root + "tmp/#{ rule.name }_ip_rate_limiter.pstore")
backend =
- AlaveteliRateLimiter::Backends::PStoreDatabase.new(:path => path)
+ AlaveteliRateLimiter::Backends::PStoreDatabase.new(path: path)
- subject = described_class.new(rule, :backend => backend)
+ subject = described_class.new(rule, backend: backend)
ip = '127.0.0.1'
@@ -206,7 +206,7 @@
it 'returns false if the IP is in the whitelist' do
whitelist = AlaveteliRateLimiter::IPRateLimiter::Whitelist.new(%(0.0.0.0))
- subject = described_class.new(:signup, :whitelist => whitelist)
+ subject = described_class.new(:signup, whitelist: whitelist)
expect(subject.limit?('0.0.0.0')).to eq(false)
end
diff --git a/spec/lib/alaveteli_rate_limiter/rule_spec.rb b/spec/lib/alaveteli_rate_limiter/rule_spec.rb
index 8368b794bc..6e7535e332 100644
--- a/spec/lib/alaveteli_rate_limiter/rule_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/rule_spec.rb
@@ -5,9 +5,9 @@
describe '.from_hash' do
it 'constructs a Rule with associated Window from a Hash' do
- attrs = { :name => :test,
- :count => 2,
- :window => { :value => 1, :unit => :hour } }
+ attrs = { name: :test,
+ count: 2,
+ window: { value: 1, unit: :hour } }
window = AlaveteliRateLimiter::Window.new(1, :hour)
expected = described_class.new(:test, 2, window)
expect(described_class.from_hash(attrs)).to eq(expected)
@@ -18,22 +18,22 @@
end
it 'requires a :count key' do
- expect { described_class.from_hash(:name => :test) }.
+ expect { described_class.from_hash(name: :test) }.
to raise_error(KeyError)
end
it 'requires a :window key' do
- expect { described_class.from_hash(:name => :test, :count => 1) }.
+ expect { described_class.from_hash(name: :test, count: 1) }.
to raise_error(KeyError)
end
it 'requires a :window hash with a :value key' do
- attrs = { :name => :test, :count => 1, :window => { :unit => :hour } }
+ attrs = { name: :test, count: 1, window: { unit: :hour } }
expect { described_class.from_hash(attrs) }.to raise_error(KeyError)
end
it 'requires a :window hash with a :unit key' do
- attrs = { :name => :test, :count => 1, :window => { :value => 1 } }
+ attrs = { name: :test, count: 1, window: { value: 1 } }
expect { described_class.from_hash(attrs) }.to raise_error(KeyError)
end
@@ -72,35 +72,35 @@
it 'returns true if the given records are over the limit' do
records = [10, 5, 1].map { |i| i.minutes.ago }
- attrs = { :name => :test,
- :count => 2,
- :window => { :value => 1, :unit => :hour } }
+ attrs = { name: :test,
+ count: 2,
+ window: { value: 1, unit: :hour } }
subject = described_class.from_hash(attrs)
expect(subject.limit?(records)).to eq(true)
end
it 'returns false if the given records are under the limit' do
records = [10, 5, 1].map { |i| i.minutes.ago }
- attrs = { :name => :test,
- :count => 20,
- :window => { :value => 1, :unit => :hour } }
+ attrs = { name: :test,
+ count: 20,
+ window: { value: 1, unit: :hour } }
subject = described_class.from_hash(attrs)
expect(subject.limit?(records)).to eq(false)
end
it 'does not matter if the records are in a different order' do
records = [5, 10, 1].map { |i| i.minutes.ago }
- attrs = { :name => :test,
- :count => 2,
- :window => { :value => 1, :unit => :hour } }
+ attrs = { name: :test,
+ count: 2,
+ window: { value: 1, unit: :hour } }
subject = described_class.from_hash(attrs)
expect(subject.limit?(records.shuffle)).to eq(true)
end
it 'returns false if no records are given' do
- attrs = { :name => :test,
- :count => 20,
- :window => { :value => 1, :unit => :hour } }
+ attrs = { name: :test,
+ count: 20,
+ window: { value: 1, unit: :hour } }
subject = described_class.from_hash(attrs)
expect(subject.limit?([])).to eq(false)
end
@@ -111,9 +111,9 @@
it 'returns records in the window' do
records = [1, 5, 10].map { |i| i.days.ago }
- attrs = { :name => :test,
- :count => 20,
- :window => { :value => 7, :unit => :day } }
+ attrs = { name: :test,
+ count: 20,
+ window: { value: 7, unit: :day } }
subject = described_class.from_hash(attrs)
expected = records[0..1]
expect(subject.records_in_window(records)).to eq(expected)
diff --git a/spec/lib/alaveteli_rate_limiter/window_spec.rb b/spec/lib/alaveteli_rate_limiter/window_spec.rb
index d34cd3e340..2792960e51 100644
--- a/spec/lib/alaveteli_rate_limiter/window_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/window_spec.rb
@@ -6,17 +6,17 @@
it 'creates a Window from a Hash' do
expected = described_class.new(3, :day)
- hash = { :value => 3, :unit => :day }
+ hash = { value: 3, unit: :day }
expect(described_class.from_hash(hash)).to eq(expected)
end
it 'requires a :value key' do
- hash = { :unit => :day }
+ hash = { unit: :day }
expect { described_class.from_hash(hash) }.to raise_error(KeyError)
end
it 'requires a :unit key' do
- hash = { :value => 3 }
+ hash = { value: 3 }
expect { described_class.from_hash(hash) }.to raise_error(KeyError)
end
diff --git a/spec/lib/alaveteli_text_masker_spec.rb b/spec/lib/alaveteli_text_masker_spec.rb
index ec1550aa2f..bbb1e5fb6a 100644
--- a/spec/lib/alaveteli_text_masker_spec.rb
+++ b/spec/lib/alaveteli_text_masker_spec.rb
@@ -10,15 +10,15 @@
before do
@cheese_censor_rule = FactoryBot.build(:censor_rule,
- :text => 'Stilton',
- :replacement => 'Jarlsberg')
+ text: 'Stilton',
+ replacement: 'Jarlsberg')
@colour_censor_rule = FactoryBot.build(:censor_rule,
- :text => 'blue',
- :replacement => 'yellow')
+ text: 'blue',
+ replacement: 'yellow')
@regex_censor_rule = FactoryBot.build(:censor_rule,
- :text => 'm[a-z][a-z][a-z]e',
- :replacement => 'cat',
- :regexp => true)
+ text: 'm[a-z][a-z][a-z]e',
+ replacement: 'cat',
+ regexp: true)
@censor_rules = [@cheese_censor_rule,
@colour_censor_rule,
@regex_censor_rule]
@@ -29,7 +29,7 @@
result = class_instance.apply_masks(data,
"image/jpeg",
- :censor_rules => @censor_rules)
+ censor_rules: @censor_rules)
expect(result).
to eq("There was a mouse called Stilton, he wished that he was blue.")
@@ -39,7 +39,7 @@
data = "There was a mouse called Stilton, he wished that he was blue."
result = class_instance.apply_masks(data,
"application/vnd.ms-word",
- :censor_rules => @censor_rules)
+ censor_rules: @censor_rules)
expect(result).
to eq("There was a xxxxx called xxxxxxx, he wished that he was xxxx.")
end
@@ -49,7 +49,7 @@
@regex_censor_rule.text = 'á'
result = class_instance.apply_masks(data,
"application/octet-stream",
- :censor_rules => @censor_rules)
+ censor_rules: @censor_rules)
expect(result).to eq('xx mouse')
end
@@ -57,7 +57,7 @@
data = "There was a mouse called Stilton, he wished that he was blue."
result = class_instance.apply_masks(data,
'text/html',
- :censor_rules => @censor_rules)
+ censor_rules: @censor_rules)
expect(result).
to eq("There was a cat called Jarlsberg, he wished that he was yellow.")
end
@@ -206,20 +206,20 @@ def pdf_replacement_test(use_ghostscript_compression)
expected = "here is a cat"
censor_rule = FactoryBot.build(:censor_rule,
- :text => 'mouse',
- :replacement => 'cat')
+ text: 'mouse',
+ replacement: 'cat')
result = class_instance.apply_masks(data,
'text/html',
- :censor_rules => [censor_rule])
+ censor_rules: [censor_rule])
expect(result).to eq(expected)
end
it 'applies extra masks to text' do
data = "here is a mouse"
expected = "here is a cat"
- mask = { :to_replace => 'mouse', :replacement => 'cat'}
- result = class_instance.apply_masks(data, 'text/html', :masks => [mask])
+ mask = { to_replace: 'mouse', replacement: 'cat'}
+ result = class_instance.apply_masks(data, 'text/html', masks: [mask])
expect(result).to eq(expected)
end
diff --git a/spec/lib/attachment_to_html/adapters/google_docs_viewer_spec.rb b/spec/lib/attachment_to_html/adapters/google_docs_viewer_spec.rb
index c7400127c5..dab8a01d3d 100644
--- a/spec/lib/attachment_to_html/adapters/google_docs_viewer_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/google_docs_viewer_spec.rb
@@ -4,7 +4,7 @@
let(:attachment) { FactoryBot.build(:pdf_attachment) }
let(:adapter) do
- AttachmentToHTML::Adapters::GoogleDocsViewer.new(attachment, :attachment_url => 'http://example.com/test.pdf')
+ AttachmentToHTML::Adapters::GoogleDocsViewer.new(attachment, attachment_url: 'http://example.com/test.pdf')
end
describe :title do
diff --git a/spec/lib/attachment_to_html/adapters/pdf_spec.rb b/spec/lib/attachment_to_html/adapters/pdf_spec.rb
index 2b14e0d0ef..7f2ecc65cc 100644
--- a/spec/lib/attachment_to_html/adapters/pdf_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/pdf_spec.rb
@@ -12,7 +12,7 @@
end
it 'allows a tmpdir to be specified to store the converted document' do
- adapter = AttachmentToHTML::Adapters::PDF.new(attachment, :tmpdir => '/tmp')
+ adapter = AttachmentToHTML::Adapters::PDF.new(attachment, tmpdir: '/tmp')
expect(adapter.tmpdir).to eq('/tmp')
end
@@ -38,7 +38,7 @@
end
it 'operates in the context of the supplied tmpdir' do
- adapter = AttachmentToHTML::Adapters::PDF.new(attachment, :tmpdir => '/tmp')
+ adapter = AttachmentToHTML::Adapters::PDF.new(attachment, tmpdir: '/tmp')
expect(Dir).to receive(:chdir).with('/tmp').and_call_original
adapter.body
end
diff --git a/spec/lib/attachment_to_html/adapters/rtf_spec.rb b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
index 756f80f52f..88dc23cc5e 100644
--- a/spec/lib/attachment_to_html/adapters/rtf_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
@@ -12,7 +12,7 @@
end
it 'allows a tmpdir to be specified to store the converted document' do
- adapter = AttachmentToHTML::Adapters::RTF.new(attachment, :tmpdir => '/tmp')
+ adapter = AttachmentToHTML::Adapters::RTF.new(attachment, tmpdir: '/tmp')
expect(adapter.tmpdir).to eq('/tmp')
end
@@ -33,7 +33,7 @@
end
it 'operates in the context of the supplied tmpdir' do
- adapter = AttachmentToHTML::Adapters::RTF.new(attachment, :tmpdir => '/tmp')
+ adapter = AttachmentToHTML::Adapters::RTF.new(attachment, tmpdir: '/tmp')
expect(Dir).to receive(:chdir).with('/tmp').and_call_original
adapter.body
end
@@ -61,7 +61,7 @@
end
it 'converts empty files' do
- attachment = FactoryBot.build(:rtf_attachment, :body => load_file_fixture('empty.rtf'))
+ attachment = FactoryBot.build(:rtf_attachment, body: load_file_fixture('empty.rtf'))
adapter = AttachmentToHTML::Adapters::RTF.new(attachment)
expect(adapter.body).to eq('')
end
diff --git a/spec/lib/attachment_to_html/adapters/text_spec.rb b/spec/lib/attachment_to_html/adapters/text_spec.rb
index d4efd61f9f..6d90c2a89a 100644
--- a/spec/lib/attachment_to_html/adapters/text_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/text_spec.rb
@@ -20,41 +20,41 @@
end
it 'strips the body of trailing whitespace' do
- attachment = FactoryBot.build(:body_text, :body => ' Hello ')
+ attachment = FactoryBot.build(:body_text, body: ' Hello ')
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expect(adapter.body).to eq('Hello')
end
it 'escapes special characters' do
- attachment = FactoryBot.build(:body_text, :body => 'Usage: foo "bar" >baz<')
+ attachment = FactoryBot.build(:body_text, body: 'Usage: foo "bar" >baz<')
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expected = %Q(Usage: foo "bar" >baz<)
expect(adapter.body).to eq(expected)
end
it 'creates hyperlinks for text that looks like a url' do
- attachment = FactoryBot.build(:body_text, :body => 'http://www.whatdotheyknow.com')
+ attachment = FactoryBot.build(:body_text, body: 'http://www.whatdotheyknow.com')
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expected = %Q(http://www.whatdotheyknow.com)
expect(adapter.body).to eq(expected)
end
it 'substitutes newlines for br tags' do
- attachment = FactoryBot.build(:body_text, :body => "A\nNewline")
+ attachment = FactoryBot.build(:body_text, body: "A\nNewline")
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expected = %Q(A Newline)
expect(adapter.body).to eq(expected)
end
it 'returns the body encoded as UTF-8' do
- attachment = FactoryBot.build(:body_text, :body => "\xBF")
+ attachment = FactoryBot.build(:body_text, body: "\xBF")
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expect(adapter.body.encoding).to eq(Encoding.find('UTF-8'))
end
it 'returns the body as valid UTF-8 when the text is not
valid UTF-8' do
- attachment = FactoryBot.build(:body_text, :body => "\xBF")
+ attachment = FactoryBot.build(:body_text, body: "\xBF")
adapter = AttachmentToHTML::Adapters::Text.new(attachment)
expect(adapter.body).to be_valid_encoding
end
diff --git a/spec/lib/attachment_to_html/attachment_to_html_spec.rb b/spec/lib/attachment_to_html/attachment_to_html_spec.rb
index 2c7050ddc0..813c50297e 100644
--- a/spec/lib/attachment_to_html/attachment_to_html_spec.rb
+++ b/spec/lib/attachment_to_html/attachment_to_html_spec.rb
@@ -19,12 +19,12 @@
end
it 'passes content injections options when rendering the result' do
- html = to_html(attachment, :content_for => { :body_prefix => '
prefix
' })
+ html = to_html(attachment, content_for: { body_prefix: '
prefix
' })
expect(html).to include('
prefix
')
end
it 'accepts a hash of options to pass to the adapter' do
- options = { :wrapper => 'wrap' }
+ options = { wrapper: 'wrap' }
expect(AttachmentToHTML::Adapters::Text).to receive(:new).with(attachment, options).and_call_original
to_html(attachment, options)
end
@@ -38,13 +38,13 @@
end
it 'converts an attachment that doesnt have an adapter, but has a google viewer' do
- attachment = FactoryBot.build(:body_text, :content_type => 'application/vnd.ms-word')
+ attachment = FactoryBot.build(:body_text, content_type: 'application/vnd.ms-word')
expect(AttachmentToHTML::Adapters::GoogleDocsViewer).to receive(:new).with(attachment, {}).and_call_original
to_html(attachment)
end
it 'converts an attachment that has no adapter or google viewer' do
- attachment = FactoryBot.build(:body_text, :content_type => 'application/json')
+ attachment = FactoryBot.build(:body_text, content_type: 'application/json')
expect(AttachmentToHTML::Adapters::CouldNotConvert).to receive(:new).with(attachment, {}).and_call_original
to_html(attachment)
end
diff --git a/spec/lib/attachment_to_html/view_spec.rb b/spec/lib/attachment_to_html/view_spec.rb
index e86058d530..3255d3d2a4 100644
--- a/spec/lib/attachment_to_html/view_spec.rb
+++ b/spec/lib/attachment_to_html/view_spec.rb
@@ -4,9 +4,9 @@
let(:adapter) do
double(:adapter,
- :body => '
From 1d44961d8c0db2a94f0964eca321b52c413dce46 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Feb 2023 15:39:35 +0000
Subject: [PATCH 120/289] Add stub user messages limit check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We don’t currently record the sending of user messages, but want to be
able to fine-tune their use. This at least gives us a method to override
in the theme and key off to render a rate limit message.
---
app/models/user.rb | 6 ++++++
spec/models/user_spec.rb | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/app/models/user.rb b/app/models/user.rb
index 62d4f049f2..ccf4d66cc0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -457,6 +457,8 @@ def can_contact_other_users?
end
def exceeded_limit?(content)
+ return exceeded_user_message_limit? if content == :user_messages
+
return false if no_limit?
return false if can_make_batch_requests?
return false if content_limit(content).blank?
@@ -668,4 +670,8 @@ def update_pro_account
def content_limit(content)
CONTENT_LIMIT[content]
end
+
+ def exceeded_user_message_limit?
+ false
+ end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 9b0b7cb7f0..cb266419f7 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1982,5 +1982,13 @@ def create_user(options = {})
expect(subject).to eq(true)
end
end
+
+ context 'limiting user messages' do
+ let(:content) { :user_messages }
+
+ it 'always returns false' do
+ expect(subject).to eq(false)
+ end
+ end
end
end
From 8922bcded10ac76e77802baae7229f3819ea361d Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Feb 2023 15:50:13 +0000
Subject: [PATCH 121/289] Add basic user message rate limiting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Doesn’t do anything for now as we don’t have a rate monitor, but we can
hack that in to theme code by overriding
`User#exceeded_user_message_limit?`
---
app/controllers/users/messages_controller.rb | 10 +++++---
app/models/user.rb | 2 +-
.../users/messages/rate_limited.html.erb | 7 ++++++
.../users/messages_controller_spec.rb | 24 +++++++++++++++++++
4 files changed, 39 insertions(+), 4 deletions(-)
create mode 100644 app/views/users/messages/rate_limited.html.erb
diff --git a/app/controllers/users/messages_controller.rb b/app/controllers/users/messages_controller.rb
index 2877205c83..da4146e49d 100644
--- a/app/controllers/users/messages_controller.rb
+++ b/app/controllers/users/messages_controller.rb
@@ -33,11 +33,15 @@ def set_recipient
end
def check_can_send_messages
- # Banned from messaging users?
return unless authenticated? && !authenticated_user.can_contact_other_users?
- @details = authenticated_user.can_fail_html
- render template: 'user/banned'
+ if authenticated_user.exceeded_limit?(:user_messages)
+ render template: 'users/messages/rate_limited'
+ else
+ # Banned user
+ @details = authenticated_user.can_fail_html
+ render template: 'user/banned'
+ end
end
def check_logged_in
diff --git a/app/models/user.rb b/app/models/user.rb
index ccf4d66cc0..3687d971a9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -453,7 +453,7 @@ def can_make_comments?
end
def can_contact_other_users?
- active?
+ active? && !exceeded_limit?(:user_messages)
end
def exceeded_limit?(content)
diff --git a/app/views/users/messages/rate_limited.html.erb b/app/views/users/messages/rate_limited.html.erb
new file mode 100644
index 0000000000..70271df2d0
--- /dev/null
+++ b/app/views/users/messages/rate_limited.html.erb
@@ -0,0 +1,7 @@
+<% @title = _('Cannot send messages') %>
+
+
<%= @title %>
+
+
+ <%= _('User messages cannot be sent right now. Please try again later.') %>
+
diff --git a/spec/controllers/users/messages_controller_spec.rb b/spec/controllers/users/messages_controller_spec.rb
index ddcf15be05..fd0157f3c2 100644
--- a/spec/controllers/users/messages_controller_spec.rb
+++ b/spec/controllers/users/messages_controller_spec.rb
@@ -35,6 +35,14 @@
}.to raise_error ActiveRecord::RecordNotFound
end
+ it 'prevents messages from users who have reached their rate limit' do
+ allow_any_instance_of(User).
+ to receive(:exceeded_limit?).with(:user_messages).and_return(true)
+
+ get :contact, params: { url_name: recipient.url_name }
+
+ expect(response).to render_template('users/messages/rate_limited')
+ end
end
describe 'POST contact' do
@@ -51,6 +59,22 @@
expect(response).to render_template('contact')
end
+ it 'prevents messages from users who have reached their rate limit' do
+ allow_any_instance_of(User).
+ to receive(:exceeded_limit?).with(:user_messages).and_return(true)
+
+ post :contact, params: {
+ url_name: recipient.url_name,
+ contact: {
+ subject: 'Foo',
+ message: 'Bar'
+ },
+ submitted_contact_form: 1
+ }
+
+ expect(response).to render_template('users/messages/rate_limited')
+ end
+
context 'the site is configured to require a captcha' do
before do
allow(AlaveteliConfiguration).
From b341f133beef801c16f8673b92ae6bd2859d4006 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 15:53:18 +0000
Subject: [PATCH 122/289] Add UserMessage
A simple record associated with User to record when user messages are
sent.
---
app/models/user.rb | 5 +++++
app/models/user_message.rb | 14 ++++++++++++++
db/migrate/20230222154014_create_user_messages.rb | 8 ++++++++
spec/factories/user_messages.rb | 15 +++++++++++++++
spec/models/user_message_spec.rb | 14 ++++++++++++++
5 files changed, 56 insertions(+)
create mode 100644 app/models/user_message.rb
create mode 100644 db/migrate/20230222154014_create_user_messages.rb
create mode 100644 spec/factories/user_messages.rb
create mode 100644 spec/models/user_message_spec.rb
diff --git a/app/models/user.rb b/app/models/user.rb
index 3687d971a9..ceffc1b0a7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -144,6 +144,11 @@ class User < ApplicationRecord
inverse_of: :user,
dependent: :destroy
+ has_many :user_messages,
+ -> { order(created_at: :desc) },
+ inverse_of: :user,
+ dependent: :destroy
+
scope :active, -> { not_banned.not_closed }
scope :banned, -> { where.not(ban_text: '') }
scope :not_banned, -> { where(ban_text: '') }
diff --git a/app/models/user_message.rb b/app/models/user_message.rb
new file mode 100644
index 0000000000..828467b4e0
--- /dev/null
+++ b/app/models/user_message.rb
@@ -0,0 +1,14 @@
+# == Schema Information
+# Schema version: 20230222154014
+#
+# Table name: user_messages
+#
+# id :bigint not null, primary key
+# user_id :bigint
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+class UserMessage < ApplicationRecord
+ belongs_to :user,
+ inverse_of: :user_messages
+end
diff --git a/db/migrate/20230222154014_create_user_messages.rb b/db/migrate/20230222154014_create_user_messages.rb
new file mode 100644
index 0000000000..917d95e809
--- /dev/null
+++ b/db/migrate/20230222154014_create_user_messages.rb
@@ -0,0 +1,8 @@
+class CreateUserMessages < ActiveRecord::Migration[7.0]
+ def change
+ create_table :user_messages do |t|
+ t.references :user, foreign_key: true
+ t.timestamps
+ end
+ end
+end
diff --git a/spec/factories/user_messages.rb b/spec/factories/user_messages.rb
new file mode 100644
index 0000000000..b4536b5f62
--- /dev/null
+++ b/spec/factories/user_messages.rb
@@ -0,0 +1,15 @@
+# == Schema Information
+# Schema version: 20230222154014
+#
+# Table name: user_messages
+#
+# id :bigint not null, primary key
+# user_id :bigint
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+FactoryBot.define do
+ factory :user_message do
+ user
+ end
+end
diff --git a/spec/models/user_message_spec.rb b/spec/models/user_message_spec.rb
new file mode 100644
index 0000000000..658d635b68
--- /dev/null
+++ b/spec/models/user_message_spec.rb
@@ -0,0 +1,14 @@
+# == Schema Information
+# Schema version: 20230222154014
+#
+# Table name: user_messages
+#
+# id :bigint not null, primary key
+# user_id :bigint
+# created_at :datetime not null
+# updated_at :datetime not null
+#
+require 'spec_helper'
+
+RSpec.describe UserMessage, type: :model do
+end
From 7b99d0fd26f0fcbfa466534bc5adc96c97c45ef9 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 15:53:45 +0000
Subject: [PATCH 123/289] Record when a User sends a UserMessage
We can later use this to moderate use of the system.
---
app/controllers/users/messages_controller.rb | 2 ++
spec/controllers/users/messages_controller_spec.rb | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/app/controllers/users/messages_controller.rb b/app/controllers/users/messages_controller.rb
index da4146e49d..ac748f7bc1 100644
--- a/app/controllers/users/messages_controller.rb
+++ b/app/controllers/users/messages_controller.rb
@@ -18,6 +18,8 @@ def contact
end
send_message(@user, @recipient_user)
+ @user.user_messages.create
+
flash[:notice] = _('Your message to {{recipient_user_name}} has ' \
'been sent!',
recipient_user_name: @recipient_user.name.html_safe)
diff --git a/spec/controllers/users/messages_controller_spec.rb b/spec/controllers/users/messages_controller_spec.rb
index fd0157f3c2..efd3db2413 100644
--- a/spec/controllers/users/messages_controller_spec.rb
+++ b/spec/controllers/users/messages_controller_spec.rb
@@ -122,6 +122,18 @@
expect(mail.header['Reply-To'].to_s).to match(sender.email)
end
+ it 'records the message' do
+ post :contact, params: {
+ url_name: recipient.url_name,
+ contact: {
+ subject: 'Dearest you',
+ message: 'Just a test!'
+ },
+ submitted_contact_form: 1
+ }
+
+ expect(UserMessage.last.user).to eq(sender)
+ end
end
describe 'when sending a message that looks like spam' do
From e3a2070c0cd275f5194287d4bd93c2bc805e7757 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 16:20:34 +0000
Subject: [PATCH 124/289] Increase comment both_links truncate length
Adds a little more visibility of what a comment contains. Makes it less
likely you need to click in to _every_ comment to find an issue.
The default value is 30.
---
app/helpers/admin/link_helper.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/helpers/admin/link_helper.rb b/app/helpers/admin/link_helper.rb
index bd4480413d..02c8557ce2 100644
--- a/app/helpers/admin/link_helper.rb
+++ b/app/helpers/admin/link_helper.rb
@@ -81,7 +81,7 @@ def comment_both_links(comment)
icon = prominence_icon(comment)
link_to(icon, comment_path(comment), title: title) + ' ' +
- link_to(truncate(comment.body), edit_admin_comment_path(comment),
+ link_to(truncate(comment.body, length: 60), edit_admin_comment_path(comment),
title: admin_title)
end
From 8ad71126c3969d29d5c3c6be493a1c3183f7016a Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Thu, 23 Feb 2023 15:31:28 +0000
Subject: [PATCH 125/289] Add basic user message opt out
Adds initial handling of opting out of the user messaging system. All
users are opted in by default, as they are prior to this commit, but now
developers can at least switch this flag on request.
A basic version of https://github.com/mysociety/alaveteli/issues/1971.
---
app/controllers/users/messages_controller.rb | 14 ++++++++--
app/models/user.rb | 3 ++-
app/views/users/messages/opted_out.html.erb | 7 +++++
...45243_add_receive_user_messages_to_user.rb | 6 +++++
.../users/messages_controller_spec.rb | 27 +++++++++++++++++++
spec/factories/users.rb | 3 ++-
spec/fixtures/users.yml | 3 ++-
spec/models/user_spec.rb | 3 ++-
8 files changed, 60 insertions(+), 6 deletions(-)
create mode 100644 app/views/users/messages/opted_out.html.erb
create mode 100644 db/migrate/20230223145243_add_receive_user_messages_to_user.rb
diff --git a/app/controllers/users/messages_controller.rb b/app/controllers/users/messages_controller.rb
index ac748f7bc1..4a6af1c9c0 100644
--- a/app/controllers/users/messages_controller.rb
+++ b/app/controllers/users/messages_controller.rb
@@ -1,8 +1,12 @@
# Allowing users to send user-to-user messages
class Users::MessagesController < UserController
- before_action :set_recipient, :check_can_send_messages, :check_logged_in,
- :set_contact, :set_recaptcha_required
+ before_action :set_recipient,
+ :check_recipient_accepts_messages,
+ :check_can_send_messages,
+ :check_logged_in,
+ :set_contact,
+ :set_recaptcha_required
# Send a message to another user
def contact
@@ -34,6 +38,12 @@ def set_recipient
@recipient_user = User.find_by!(url_name: params[:url_name])
end
+ def check_recipient_accepts_messages
+ return if @recipient_user.receive_user_messages?
+
+ render template: 'users/messages/opted_out'
+ end
+
def check_can_send_messages
return unless authenticated? && !authenticated_user.can_contact_other_users?
diff --git a/app/models/user.rb b/app/models/user.rb
index ceffc1b0a7..190b86f538 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220210114052
+# Schema version: 20230223145243
#
# Table name: users
#
@@ -35,6 +35,7 @@
# daily_summary_minute :integer
# closed_at :datetime
# login_token :string
+# receive_user_messages :boolean default(TRUE), not null
#
class User < ApplicationRecord
diff --git a/app/views/users/messages/opted_out.html.erb b/app/views/users/messages/opted_out.html.erb
new file mode 100644
index 0000000000..e7c5a49cc8
--- /dev/null
+++ b/app/views/users/messages/opted_out.html.erb
@@ -0,0 +1,7 @@
+<% @title = _('Cannot send messages') %>
+
+
<%= @title %>
+
+
+ <%= _('This user does not accept user to user messages.') %>
+
diff --git a/db/migrate/20230223145243_add_receive_user_messages_to_user.rb b/db/migrate/20230223145243_add_receive_user_messages_to_user.rb
new file mode 100644
index 0000000000..6771349e4e
--- /dev/null
+++ b/db/migrate/20230223145243_add_receive_user_messages_to_user.rb
@@ -0,0 +1,6 @@
+class AddReceiveUserMessagesToUser < ActiveRecord::Migration[7.0]
+ def change
+ add_column :users, :receive_user_messages, :boolean,
+ default: true, null: false
+ end
+end
diff --git a/spec/controllers/users/messages_controller_spec.rb b/spec/controllers/users/messages_controller_spec.rb
index efd3db2413..999ca4a21a 100644
--- a/spec/controllers/users/messages_controller_spec.rb
+++ b/spec/controllers/users/messages_controller_spec.rb
@@ -35,6 +35,15 @@
}.to raise_error ActiveRecord::RecordNotFound
end
+ context 'when the recipient has opted out' do
+ before { recipient.update!(receive_user_messages: false) }
+
+ it 'prevents user messages' do
+ get :contact, params: { url_name: recipient.url_name }
+ expect(response).to render_template('users/messages/opted_out')
+ end
+ end
+
it 'prevents messages from users who have reached their rate limit' do
allow_any_instance_of(User).
to receive(:exceeded_limit?).with(:user_messages).and_return(true)
@@ -59,6 +68,24 @@
expect(response).to render_template('contact')
end
+ context 'when the recipient has opted out' do
+ before { recipient.update!(receive_user_messages: false) }
+
+ it 'prevents the submission' do
+ post :contact, params: {
+ url_name: recipient.url_name,
+ contact: {
+ subject: 'Hi',
+ message: 'Gah'
+ },
+ submitted_contact_form: 1
+ }
+
+ expect(ActionMailer::Base.deliveries).to be_empty
+ expect(response).to render_template('users/messages/opted_out')
+ end
+ end
+
it 'prevents messages from users who have reached their rate limit' do
allow_any_instance_of(User).
to receive(:exceeded_limit?).with(:user_messages).and_return(true)
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index 2be8ac0041..e1cc18af33 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220210114052
+# Schema version: 20230223145243
#
# Table name: users
#
@@ -35,6 +35,7 @@
# daily_summary_minute :integer
# closed_at :datetime
# login_token :string
+# receive_user_messages :boolean default(TRUE), not null
#
FactoryBot.define do
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index 5fb397fc70..5fab021194 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220210114052
+# Schema version: 20230223145243
#
# Table name: users
#
@@ -35,6 +35,7 @@
# daily_summary_minute :integer
# closed_at :datetime
# login_token :string
+# receive_user_messages :boolean default(TRUE), not null
#
# If sample data has been loaded you can log in as any of these users with their
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index cb266419f7..cf001bdfd4 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20220210114052
+# Schema version: 20230223145243
#
# Table name: users
#
@@ -35,6 +35,7 @@
# daily_summary_minute :integer
# closed_at :datetime
# login_token :string
+# receive_user_messages :boolean default(TRUE), not null
#
require 'spec_helper'
From 2e8c339c41ed03289a943ede65eff40ca298e652 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Feb 2023 13:54:21 +0000
Subject: [PATCH 126/289] Organise new request form sidebar
Group into clearer sections to aid comprehension. Pro new request
sidebar is different; this only applies to the regular user version.
---
app/views/request/new.html.erb | 73 +++++++++++++++++++++-------------
1 file changed, 45 insertions(+), 28 deletions(-)
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb
index e30eb74958..a288e381a9 100644
--- a/app/views/request/new.html.erb
+++ b/app/views/request/new.html.erb
@@ -187,39 +187,34 @@
- <% unless @batch %>
-
- <% if @info_request.public_body.info_requests.is_public.any? %>
- <%= _("Browse other requests to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %>
- <% else %>
- <%= _("Browse other requests for examples of how to word your request.", :url=>request_list_successful_url) %>
- <% end %>
-
- <% end %>
+
+
<%= _('Before you start') %>
-
- <%= raw(_('Everything that you enter on this page, including ' \
- 'your name, will be displayed ' \
- 'publicly on this website ' \
- 'forever',
- :url => help_privacy_path(:anchor => "public_request").html_safe)) %>.
-
<%= _('Make sure the information you are asking for is not ' \
+ 'already publicly available.') %>
-
- <%= raw(_("Can I request information about myself? " \
- "No!",
- :url => help_requesting_path(:anchor => "data_protection").html_safe)) %>
-
+ <% unless @batch %>
+
+ <% if @info_request.public_body.info_requests.is_public.any? %>
+ <%= _("Browse other requests to '{{public_body_name}}' for examples of how to word your request.", :public_body_name=>h(@info_request.public_body.name), :url=>public_body_path(@info_request.public_body)) %>
+ <% else %>
+ <%= _("Browse other requests for examples of how to word your request.", :url=>request_list_successful_url) %>
+ <% end %>
+
+ <% end %>
+
+
+
<%= _('Writing your request') %>
+
+
+ <%= raw(_("Can I request information about myself? " \
+ "No!",
+ :url => help_requesting_path(:anchor => "data_protection").html_safe)) %>
+
<%= _('Write your request in simple, precise language.') %>
<%= _('Ask for specific documents or ' \
'information, this site is not suitable for general ' \
@@ -231,6 +226,28 @@
'already publicly available.') %>
+
+
+
<%= _('Signing your request') %>
+
+
+
+ <%= raw(_('Everything that you enter on this page, including ' \
+ 'your name, will be displayed ' \
+ 'publicly on this website ' \
+ 'forever',
+ :url => help_privacy_path(:anchor => "public_request").html_safe)) %>.
+
From e43110fb38c82a4c7c7dac1033b1e54cc7d9a85e Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Feb 2023 14:07:55 +0000
Subject: [PATCH 128/289] Include name to be published in warning
Make it as obvious as possible that they're going to be making a
published request under their user name.
Fixes https://github.com/mysociety/alaveteli/issues/6154
---
app/views/request/new.html.erb | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb
index 83e61ec5bf..34fb9c3ea2 100644
--- a/app/views/request/new.html.erb
+++ b/app/views/request/new.html.erb
@@ -232,11 +232,20 @@
- <%= raw(_('Everything that you enter on this page, including ' \
- 'your name, will be displayed ' \
- 'publicly on this website ' \
- 'forever',
- :url => help_privacy_path(:anchor => "public_request").html_safe)) %>.
+ <% if @user %>
+ <%= raw(_('Everything that you enter on this page, including ' \
+ 'your name ({{user_name}}), will ' \
+ 'be displayed publicly on this ' \
+ 'website forever',
+ user_name: @user.name,
+ url: help_privacy_path(anchor: 'public_request').html_safe)) %>.
+ <% else %>
+ <%= raw(_('Everything that you enter on this page, including ' \
+ 'your name, will be displayed ' \
+ 'publicly on this website ' \
+ 'forever',
+ :url => help_privacy_path(:anchor => "public_request").html_safe)) %>.
+ <% end %>
From 9f8f5fbcf4c7b4a6e7e6db9947292b404e720656 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Feb 2023 16:04:25 +0000
Subject: [PATCH 129/289] Update changelog
---
doc/CHANGES.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 0ccaa37b19..6029c7b981 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,7 @@
## Highlighted Features
+* Make it clearer that usernames are published (Gareth Rees)
* Add spam term checking to user to user messages (Gareth Rees)
* Add support for Ruby 3.2 (Graeme Porteous)
* Add support for Ruby 3.1 (Graeme Porteous)
From 45e727a09c7cf48ee885637e35ce8c36b4392cb8 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 27 Feb 2023 04:59:49 +0000
Subject: [PATCH 130/289] Build(deps): Bump pg from 1.4.5 to 1.4.6
Bumps [pg](https://github.com/ged/ruby-pg) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/ged/ruby-pg/releases)
- [Changelog](https://github.com/ged/ruby-pg/blob/master/History.md)
- [Commits](https://github.com/ged/ruby-pg/compare/v1.4.5...v1.4.6)
---
updated-dependencies:
- dependency-name: pg
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 969146a9d3..9669f8e97a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -81,7 +81,7 @@ source 'https://rubygems.org'
gem 'rails', '~> 7.0.4'
-gem 'pg', '~> 1.4.5'
+gem 'pg', '~> 1.4.6'
# New gem releases aren't being done. master is newer and supports Rails > 3.0
gem 'acts_as_versioned', git: 'https://github.com/mysociety/acts_as_versioned.git',
diff --git a/Gemfile.lock b/Gemfile.lock
index 787c6f4d4b..3b4547bf61 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -350,7 +350,7 @@ GEM
parallel (1.22.1)
parser (3.2.1.0)
ast (~> 2.4.1)
- pg (1.4.5)
+ pg (1.4.6)
prime (0.1.2)
forwardable
singleton
@@ -591,7 +591,7 @@ DEPENDENCIES
nokogiri (~> 1.14.1)
oink (~> 0.10.1)
open4 (~> 1.3.0)
- pg (~> 1.4.5)
+ pg (~> 1.4.6)
pry (~> 0.14.2)
rack (~> 2.2.6)
rack-utf8_sanitizer (~> 1.8.0)
From a87987c31b903e89603b753f14080b9fb100f2ae Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 28 Feb 2023 09:49:58 +0000
Subject: [PATCH 131/289] Add git safe directory config to Docker image
When running the app via Docker errors are being raised due to how the
repository is mounted in the container which results in a mismatch in
file ownership.
Fixes #7612
---
docker/Dockerfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 5e82880071..e6a7aa6f17 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -22,7 +22,8 @@ RUN git clone https://github.com/vishnubob/wait-for-it.git /tmp/wait-for-it && \
chmod +x /tmp/wait-for-it/wait-for-it.sh && \
ln -s /tmp/wait-for-it/wait-for-it.sh /bin/wait-for-it
-WORKDIR /alaveteli/
+WORKDIR /alaveteli
+RUN git config --global --add safe.directory /alaveteli
RUN gem update --system
RUN gem install mailcatcher
From a9e7d42524b74cc5d4df06cd17567ade514e9448 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 28 Feb 2023 11:29:19 +0000
Subject: [PATCH 132/289] Update how we source docker/env
Works in `sh` as well as `bash`.
Fixes #7614
---
docker/reset | 2 +-
docker/server | 2 +-
docker/setup | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docker/reset b/docker/reset
index 2549a1db70..1d12dec910 100755
--- a/docker/reset
+++ b/docker/reset
@@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-source docker/env
+. docker/env
docker compose down
diff --git a/docker/server b/docker/server
index d4f8d0a05f..980fff0f6f 100755
--- a/docker/server
+++ b/docker/server
@@ -5,7 +5,7 @@ set -e
cd "$(dirname "$0")/.."
if [ -z "$DOCKER" ]; then
- source docker/env
+ . docker/env
docker compose up
exit
fi
diff --git a/docker/setup b/docker/setup
index 45cdf93ffd..a107e5032a 100755
--- a/docker/setup
+++ b/docker/setup
@@ -5,7 +5,7 @@ set -e
cd "$(dirname "$0")/.."
if [ -z "$DOCKER" ]; then
- source docker/env
+ . docker/env
./docker/bootstrap
docker compose run --rm app ./docker/setup "$@"
exit
From ed5c4b66b40599f2f450b45b87263b756adcc5e8 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 1 Mar 2023 11:19:00 +0000
Subject: [PATCH 133/289] Add User#user_messages counter cache
Precursor to showing the value in the admin UI for user records.
---
app/models/user.rb | 3 ++-
app/models/user_message.rb | 3 ++-
.../20230301110831_add_user_messages_count_to_users.rb | 5 +++++
spec/factories/users.rb | 3 ++-
spec/fixtures/users.yml | 3 ++-
spec/models/user_spec.rb | 3 ++-
6 files changed, 15 insertions(+), 5 deletions(-)
create mode 100644 db/migrate/20230301110831_add_user_messages_count_to_users.rb
diff --git a/app/models/user.rb b/app/models/user.rb
index 190b86f538..8a07d0bec9 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20230223145243
+# Schema version: 20230301110831
#
# Table name: users
#
@@ -36,6 +36,7 @@
# closed_at :datetime
# login_token :string
# receive_user_messages :boolean default(TRUE), not null
+# user_messages_count :integer default(0), not null
#
class User < ApplicationRecord
diff --git a/app/models/user_message.rb b/app/models/user_message.rb
index 828467b4e0..bb65c330c6 100644
--- a/app/models/user_message.rb
+++ b/app/models/user_message.rb
@@ -10,5 +10,6 @@
#
class UserMessage < ApplicationRecord
belongs_to :user,
- inverse_of: :user_messages
+ inverse_of: :user_messages,
+ counter_cache: true
end
diff --git a/db/migrate/20230301110831_add_user_messages_count_to_users.rb b/db/migrate/20230301110831_add_user_messages_count_to_users.rb
new file mode 100644
index 0000000000..8d5d014913
--- /dev/null
+++ b/db/migrate/20230301110831_add_user_messages_count_to_users.rb
@@ -0,0 +1,5 @@
+class AddUserMessagesCountToUsers < ActiveRecord::Migration[7.0]
+ def change
+ add_column :users, :user_messages_count, :integer, default: 0, null: false
+ end
+end
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index e1cc18af33..3b8c6ccdf2 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20230223145243
+# Schema version: 20230301110831
#
# Table name: users
#
@@ -36,6 +36,7 @@
# closed_at :datetime
# login_token :string
# receive_user_messages :boolean default(TRUE), not null
+# user_messages_count :integer default(0), not null
#
FactoryBot.define do
diff --git a/spec/fixtures/users.yml b/spec/fixtures/users.yml
index 5fab021194..a9eda3156c 100644
--- a/spec/fixtures/users.yml
+++ b/spec/fixtures/users.yml
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20230223145243
+# Schema version: 20230301110831
#
# Table name: users
#
@@ -36,6 +36,7 @@
# closed_at :datetime
# login_token :string
# receive_user_messages :boolean default(TRUE), not null
+# user_messages_count :integer default(0), not null
#
# If sample data has been loaded you can log in as any of these users with their
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index cf001bdfd4..a098be54a1 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 20230223145243
+# Schema version: 20230301110831
#
# Table name: users
#
@@ -36,6 +36,7 @@
# closed_at :datetime
# login_token :string
# receive_user_messages :boolean default(TRUE), not null
+# user_messages_count :integer default(0), not null
#
require 'spec_helper'
From 334ded6b198281e49e1c6ece0cafbe3db061e8ea Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 1 Mar 2023 11:24:45 +0000
Subject: [PATCH 134/289] Show User#user_messages_count in the Admin UI
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Gives us a quick way of seeing if a user has sent any user messages.
Needs to be explicitly added to `admin_columns` as counter caches are
not “content columns”, which automatically get presented.
---
app/models/user.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 8a07d0bec9..f4cb040c71 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -57,7 +57,8 @@ class User < ApplicationRecord
after_remove: :assign_role_features
strip_attributes allow_empty: true
- admin_columns exclude: [:otp_secret_key]
+ admin_columns include: [:user_messages_count],
+ exclude: [:otp_secret_key]
attr_accessor :no_xapian_reindex
From 9621e8efc4cb7344bfd6b9203b81afd69b63d1b6 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 27 Feb 2023 17:54:27 +0000
Subject: [PATCH 135/289] Add ProfilePhoto factory
For use in other specs.
Had to change `after_initialize` to `before_validation` so that records
built via FactoryBot were valid. This also affects normal records:
data = load_file_fixture('parrot.jpg')
a = ProfilePhoto.new(data: data, user: User.first)
a.valid?
# => true
data = load_file_fixture('parrot.jpg')
a = ProfilePhoto.new(user: User.first)
a.data = data
a.valid?
# => false
With this change, both examples now return `true`.
---
app/models/profile_photo.rb | 2 +-
spec/factories/profile_photos.rb | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 spec/factories/profile_photos.rb
diff --git a/app/models/profile_photo.rb b/app/models/profile_photo.rb
index 51a61e05f7..0f70ad2578 100644
--- a/app/models/profile_photo.rb
+++ b/app/models/profile_photo.rb
@@ -32,7 +32,7 @@ class ProfilePhoto < ApplicationRecord
attr_accessor :x, :y, :w, :h
attr_accessor :image
- after_initialize :convert_data_to_image
+ before_validation :convert_data_to_image
# make image valid format and size
def convert_image
diff --git a/spec/factories/profile_photos.rb b/spec/factories/profile_photos.rb
new file mode 100644
index 0000000000..b3973e7778
--- /dev/null
+++ b/spec/factories/profile_photos.rb
@@ -0,0 +1,23 @@
+# == Schema Information
+# Schema version: 20230223145243
+#
+# Table name: profile_photos
+#
+# id :integer not null, primary key
+# data :binary not null
+# user_id :integer
+# draft :boolean default(FALSE), not null
+# created_at :datetime
+# updated_at :datetime
+#
+FactoryBot.define do
+ factory :profile_photo do
+ user
+ data { load_file_fixture('parrot.jpg') }
+ draft { false }
+
+ trait :draft do
+ draft { true }
+ end
+ end
+end
From 78aec0f59af8650b6d6dc0436c28aaa4d138fde0 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 24 Feb 2023 13:23:17 +0000
Subject: [PATCH 136/289] Refactor User#close spec
Tweak the spec such that it'll be easier to add forthcoming examples.
---
spec/models/user_spec.rb | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index cf001bdfd4..c8525473a2 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1168,12 +1168,19 @@ def create_user(options = {})
end
describe '#close' do
+ subject { user.close }
+
let(:user) { FactoryBot.build(:user) }
- it 'closes the user account' do
- user.close
+ before { subject }
+
+ it 'closes the account' do
expect(user).to be_closed
end
+
+ it 'sets closed_at' do
+ expect(user.closed_at).to be_present
+ end
end
describe '#closed?' do
From 21dcc744463e696ac489ca4c0c255a2e0ac7ab51 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 1 Mar 2023 16:11:26 +0000
Subject: [PATCH 137/289] Update spec variable
Extracted requests will be in a classified state.
---
spec/models/project_spec.rb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 9f15598b18..e18522e2e2 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -47,7 +47,13 @@
described_state: 'successful'
)
end
- let(:extracted_request) { FactoryBot.build(:info_request) }
+ let(:extracted_request) do
+ FactoryBot.build(
+ :info_request,
+ awaiting_description: false,
+ described_state: 'successful'
+ )
+ end
before do
FactoryBot.create(
From 0b56049ae6d9d286107e838403ef23a26576a957 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 1 Mar 2023 14:10:24 +0000
Subject: [PATCH 138/289] Add failing specs
Prove `Project#extraction_progress` is returning the wrong number.
This is due to the `InfoRequest.extractable` and `InfoRequest.extracted`
scopes not taking into account requests which have been extracted as
part of a different project.
---
spec/models/project_spec.rb | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index e18522e2e2..d8b8180514 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -34,7 +34,15 @@
let(:project) do
FactoryBot.create(
:project, requests: [
- unclassified_request, classified_request, extracted_request
+ unclassified_request, classified_request, extracted_request,
+ other_project_extracted_request
+ ]
+ )
+ end
+ let(:other_project) do
+ FactoryBot.create(
+ :project, requests: [
+ other_project_extracted_request
]
)
end
@@ -54,6 +62,13 @@
described_state: 'successful'
)
end
+ let(:other_project_extracted_request) do
+ FactoryBot.build(
+ :info_request,
+ awaiting_description: false,
+ described_state: 'successful'
+ )
+ end
before do
FactoryBot.create(
@@ -64,6 +79,10 @@
:project_submission, :for_extraction,
project: project, info_request: extracted_request
)
+ FactoryBot.create(
+ :project_submission, :for_extraction,
+ project: other_project, info_request: other_project_extracted_request
+ )
end
end
@@ -341,6 +360,10 @@
it 'excludes extracted requests' do
is_expected.not_to include extracted_request
end
+
+ it 'includes requests extracted in other projects' do
+ is_expected.to include other_project_extracted_request
+ end
end
describe '#info_requests.extracted' do
@@ -363,6 +386,10 @@
it 'includes extracted requests' do
is_expected.to include extracted_request
end
+
+ it 'excludes requests extracted in different projects' do
+ is_expected.not_to include other_project_extracted_request
+ end
end
describe '#extraction_progress' do
From 2e9c40dd3be177fe562405a51822ea1715a837db Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 1 Mar 2023 15:58:48 +0000
Subject: [PATCH 139/289] Fix project request scopes
Check the project submissions belong to the current project when calling
`Project#extractable` or `Project#extracted`.
This fixes an issue where requests which have been added to more than
one project appears to be extracted due to being processed in the other
project.
Fixes #7618
---
app/models/project/info_request_extension.rb | 17 ++++++++++++++---
.../projects/extracts_controller_spec.rb | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/app/models/project/info_request_extension.rb b/app/models/project/info_request_extension.rb
index 42dba46a63..d749800067 100644
--- a/app/models/project/info_request_extension.rb
+++ b/app/models/project/info_request_extension.rb
@@ -15,14 +15,25 @@ def classified
end
def extractable
- where(described_state: EXTRACTABLE_STATES).
+ scope = where(described_state: EXTRACTABLE_STATES).
left_joins(:extraction_project_submissions).
- where(project_submissions: { id: nil }).
classified
+
+ scope.where(project_submissions: { id: nil }).or(
+ scope.where.not(project_submissions: { project: project })
+ )
end
def extracted
- joins(:extraction_project_submissions).distinct
+ joins(:extraction_project_submissions).
+ where(project_submissions: { project: project }).
+ distinct
+ end
+
+ private
+
+ def project
+ proxy_association.owner
end
end
end
diff --git a/spec/controllers/projects/extracts_controller_spec.rb b/spec/controllers/projects/extracts_controller_spec.rb
index 49eed8cc26..e976cff679 100644
--- a/spec/controllers/projects/extracts_controller_spec.rb
+++ b/spec/controllers/projects/extracts_controller_spec.rb
@@ -79,6 +79,7 @@
project.info_requests.each do |info_request|
FactoryBot.create(:project_submission,
:for_extraction,
+ project: project,
info_request: info_request)
end
From 09debe28bc72aef82fea2c8135ae4edb72668a4a Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 2 Mar 2023 09:44:53 +0000
Subject: [PATCH 140/289] Add MailHog Docker container
Replace MailCatcher gem as it isn't compatible with Ruby 3.2 yet. Uses a
separate container instead of running multiple processes in the app
container.
Maps the web UI port to the same used by MailCatcher.
---
config/environments/development.rb | 3 ++-
docker-compose.yml | 8 +++++++-
docker/Dockerfile | 2 --
docker/entrypoint.sh | 2 --
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index a987b201e9..636e5e4909 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -92,7 +92,8 @@
if AlaveteliConfiguration.use_mailcatcher_in_development
# So is queued, rather than giving immediate errors
config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
+ smtp = URI.parse(ENV.fetch('SMTP_URL', 'smtp://localhost:1025'))
+ config.action_mailer.smtp_settings = { address: smtp.host, port: smtp.port }
else
config.action_mailer.delivery_method = :sendmail
end
diff --git a/docker-compose.yml b/docker-compose.yml
index a1a3f3a515..52e4fe69ef 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,15 +10,16 @@ services:
environment:
- BUNDLE_PATH=/bundle/vendor
- DATABASE_URL=postgres://postgres:password@db/
+ - SMTP_URL=smtp://smtp:1025
ports:
- 3000:3000
- - 1080:1080
volumes:
- ./:/alaveteli
- ../alaveteli-themes:/alaveteli-themes
- bundle:/bundle
depends_on:
- db
+ - smtp
db:
build:
@@ -31,6 +32,11 @@ services:
volumes:
- postgres:/var/lib/postgresql/data
+ smtp:
+ image: mailhog/mailhog
+ ports:
+ - 1080:8025
+
volumes:
bundle: {}
postgres: {}
diff --git a/docker/Dockerfile b/docker/Dockerfile
index e6a7aa6f17..c2b7f245e0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -26,8 +26,6 @@ WORKDIR /alaveteli
RUN git config --global --add safe.directory /alaveteli
RUN gem update --system
-RUN gem install mailcatcher
EXPOSE 3000
-EXPOSE 1080
CMD wait-for-it db:5432 --strict -- ./docker/entrypoint.sh
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 21da58236e..a947e94b7d 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -1,6 +1,4 @@
#!/bin/sh
-mailcatcher --ip=0.0.0.0
-
rm -f tmp/pids/server.pid
bin/rails server -b 0.0.0.0
From f3dcb792101a627d3ad7fa916b97dd162c47a6ad Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Thu, 8 Dec 2022 11:45:02 +0000
Subject: [PATCH 141/289] Allow ex-pro users to followup to private requests
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ex-pro users should still be able to manage requests even if they're
still private; they just can't extend privacy periods or create new
ones.
We don't need to check that the `current_user` is a Pro here; we first
search the user's requests, irrespective of privacy state, and assign to
the instance variable. If that isn't found – which means the user is
trying to follow up to someone else's request – we only search public
requests in order to display the notice to sign in to the request
author's account.
Fixes https://github.com/mysociety/alaveteli/issues/7456.
---
app/controllers/followups_controller.rb | 3 ++-
doc/CHANGES.md | 2 ++
spec/controllers/followups_controller_spec.rb | 9 +++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/app/controllers/followups_controller.rb b/app/controllers/followups_controller.rb
index ae5b7bbd48..dd1135d3b6 100644
--- a/app/controllers/followups_controller.rb
+++ b/app/controllers/followups_controller.rb
@@ -188,10 +188,11 @@ def set_incoming_message
end
def set_info_request
- if current_user && current_user.is_pro?
+ if current_user
@info_request =
current_user.info_requests.find_by(id: params[:request_id].to_i)
end
+
@info_request ||= InfoRequest.not_embargoed.find(params[:request_id].to_i)
end
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 6029c7b981..a5c0572fec 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,8 @@
## Highlighted Features
+* Fix bug preventing ex-pro users follow up to still-private requests (Gareth
+ Rees, Graeme Porteous)
* Make it clearer that usernames are published (Gareth Rees)
* Add spam term checking to user to user messages (Gareth Rees)
* Add support for Ruby 3.2 (Graeme Porteous)
diff --git a/spec/controllers/followups_controller_spec.rb b/spec/controllers/followups_controller_spec.rb
index d29168a41d..50b429302a 100644
--- a/spec/controllers/followups_controller_spec.rb
+++ b/spec/controllers/followups_controller_spec.rb
@@ -100,6 +100,15 @@
expect(response).to render_template('new')
end
+ context 'the request is still embargoed but the user is no longer pro' do
+ before { request.create_embargo!(embargo_duration: '3_months') }
+
+ it 'shows the followup form' do
+ get :new, params: { request_id: request.id }
+ expect(response).to render_template('new')
+ end
+ end
+
context 'the request has responses' do
let(:message_id) { request.incoming_messages[0].id }
From 5d5945fff3c2052d008cd3e6e2dcf833cce9a7b9 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 14:15:58 +0000
Subject: [PATCH 142/289] Admins should always be allowed to make comments
---
app/models/user.rb | 5 ++++-
spec/models/user_spec.rb | 24 ++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 190b86f538..8a653ae5ab 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -455,7 +455,10 @@ def can_make_followup?
end
def can_make_comments?
- active? && !exceeded_limit?(:comments)
+ return false unless active?
+ return true if is_admin? || is_pro_admin?
+
+ !exceeded_limit?(:comments)
end
def can_contact_other_users?
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index cf001bdfd4..ba870e8ed8 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1910,6 +1910,30 @@ def create_user(options = {})
it { is_expected.to eq(false) }
end
+ context 'when the user is an admin' do
+ let(:user) { FactoryBot.create(:user, :admin) }
+
+ # Irrespective of how many comments they've made
+ before do
+ allow(user).
+ to receive(:exceeded_limit?).with(:comments).and_return(true)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the user is a pro_admin' do
+ let(:user) { FactoryBot.create(:user, :pro_admin) }
+
+ # Irrespective of how many comments they've made
+ before do
+ allow(user).
+ to receive(:exceeded_limit?).with(:comments).and_return(true)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
context 'when the user has reached their rate limit' do
let(:user) { FactoryBot.build(:user) }
From 15c39d0f0cac448d157175479fc26f9b028d0f35 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 14:19:02 +0000
Subject: [PATCH 143/289] Clarify spec phrasing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This spec is testing against a daily cap rather than a creation
interval. We’ll add the latter soon, so this just clarifies the existing
spec description.
---
spec/models/user_spec.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index ba870e8ed8..b75161db75 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1934,7 +1934,7 @@ def create_user(options = {})
it { is_expected.to eq(true) }
end
- context 'when the user has reached their rate limit' do
+ context 'when the user has reached their daily limit' do
let(:user) { FactoryBot.build(:user) }
before do
From 19eac20fa18c22bcf01b76065e9834e682255933 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 18:25:55 +0000
Subject: [PATCH 144/289] Clarify logic checking whether user can comment
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A previous version [1] of this check was defined as:
if authenticated? && !authenticated_user.can_make_comments?
# render the correct view for not being able to comment
The condition was moved to a guard clause [2] to improve code style, but
the move to using `unless` makes it less human readable.
The way I’d describe the clause naturally is:
> Skip the check if there isn’t a signed in user, or if the signed in
user can make comments.
This commit tweaks the implementation to match this more natural
phrasing.
[1] 9c28c412
[2] e895b773
---
app/controllers/comment_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index dd337ec6af..b889545824 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -117,7 +117,7 @@ def reject_unless_comments_allowed
# Banned from adding comments?
def reject_if_user_banned
- return unless authenticated? && !authenticated_user.can_make_comments?
+ return if !authenticated? || authenticated_user.can_make_comments?
if authenticated_user.exceeded_limit?(:comments)
render template: 'comment/rate_limited'
From 2afcca9bdd27939adcba4f50daaa41f69eb6442a Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 22 Feb 2023 13:53:34 +0000
Subject: [PATCH 145/289] Add comment creation interval rate limit
Calculates whether too many comments are being created too quickly.
We don't want to allow a user to sign up and smash through their daily
limit in 5 minutes, then create a new account to do the same, and so on.
This ensures that the allocation is used sensibly. It hopefully won't
affect the majority of genuine users.
Inverts the logic of `CommentController#reject_if_user_banned` now that
the daily limit and rate limit are checked in `User#can_make_comments?`.
Now, the user being banned is the edge case. This doesn't quite make
sense for inactive users, but that wasn't handled in
`User#can_fail_html` either.
---
app/controllers/comment_controller.rb | 6 +-
app/models/comment.rb | 21 ++++
app/models/user.rb | 3 +-
app/views/comment/rate_limited.html.erb | 6 ++
doc/CHANGES.md | 1 +
spec/controllers/comment_controller_spec.rb | 4 +
spec/models/comment_spec.rb | 101 ++++++++++++++++++++
spec/models/user_spec.rb | 36 +++++++
8 files changed, 174 insertions(+), 4 deletions(-)
diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb
index b889545824..1d96061325 100644
--- a/app/controllers/comment_controller.rb
+++ b/app/controllers/comment_controller.rb
@@ -119,11 +119,11 @@ def reject_unless_comments_allowed
def reject_if_user_banned
return if !authenticated? || authenticated_user.can_make_comments?
- if authenticated_user.exceeded_limit?(:comments)
- render template: 'comment/rate_limited'
- else
+ if authenticated_user.banned?
@details = authenticated_user.can_fail_html
render template: 'user/banned'
+ else
+ render template: 'comment/rate_limited'
end
end
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 256c56c520..4b4c540d1f 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -24,6 +24,19 @@ class Comment < ApplicationRecord
include Rails.application.routes.url_helpers
include LinkToHelper
+ DEFAULT_CREATION_RATE_LIMITS = {
+ 1 => 2.seconds,
+ 2 => 5.minutes,
+ 4 => 30.minutes,
+ 6 => 1.hour
+ }.freeze
+
+ cattr_accessor :creation_rate_limits,
+ instance_reader: false,
+ instance_writer: false,
+ instance_accessor: false,
+ default: DEFAULT_CREATION_RATE_LIMITS
+
strip_attributes allow_empty: true
belongs_to :user,
@@ -87,6 +100,14 @@ def self.find_existing(info_request_id, body)
end
end
+ def self.exceeded_creation_rate?(comments)
+ comments = comments.reorder(created_at: :desc)
+
+ creation_rate_limits.any? do |limit, duration|
+ comments.where(created_at: duration.ago..).size >= limit
+ end
+ end
+
def body
ret = read_attribute(:body)
return ret if ret.nil?
diff --git a/app/models/user.rb b/app/models/user.rb
index 8a653ae5ab..98d78c1ea8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -458,7 +458,8 @@ def can_make_comments?
return false unless active?
return true if is_admin? || is_pro_admin?
- !exceeded_limit?(:comments)
+ !exceeded_limit?(:comments) &&
+ !Comment.exceeded_creation_rate?(comments)
end
def can_contact_other_users?
diff --git a/app/views/comment/rate_limited.html.erb b/app/views/comment/rate_limited.html.erb
index 9e9291ec47..d9cbf08470 100644
--- a/app/views/comment/rate_limited.html.erb
+++ b/app/views/comment/rate_limited.html.erb
@@ -17,6 +17,12 @@
help_contact_path: help_contact_path) %>
+
+ <%= _('There is also a limit on the speed at which you are able to create ' \
+ 'annotations. Please try again later if you have not hit your daily ' \
+ 'limit.') %>
+
+
<% if @comment %>
<%= _('Here is the message you wrote, in case you would like to copy ' \
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index a5c0572fec..bb38ad1d5e 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,7 @@
## Highlighted Features
+* Add rate limiting to comment creation (Gareth Rees)
* Fix bug preventing ex-pro users follow up to still-private requests (Gareth
Rees, Graeme Porteous)
* Make it clearer that usernames are published (Gareth Rees)
diff --git a/spec/controllers/comment_controller_spec.rb b/spec/controllers/comment_controller_spec.rb
index c61a5335d9..77624b40a5 100644
--- a/spec/controllers/comment_controller_spec.rb
+++ b/spec/controllers/comment_controller_spec.rb
@@ -125,6 +125,10 @@
it 'errors if the same comment is submitted twice' do
user = FactoryBot.build(:user)
+
+ # Ignore rate limiting
+ allow_any_instance_of(User).to receive(:can_make_comments?).and_return(true)
+
info_request = FactoryBot.build(:info_request, user: user)
comment =
FactoryBot.create(:comment, info_request: info_request, user: user)
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
index 5d2b4f231c..608793c437 100644
--- a/spec/models/comment_spec.rb
+++ b/spec/models/comment_spec.rb
@@ -87,6 +87,107 @@
end
+ # rubocop:disable Layout/FirstArrayElementIndentation
+ describe '.exceeded_creation_rate?' do
+ subject { described_class.exceeded_creation_rate?(comments) }
+
+ context 'when there are no comments' do
+ let(:comments) { described_class.where(id: nil) }
+ it { is_expected.to eq(false) }
+ end
+
+ context 'when the last comment was created in the last 2 seconds' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 1.second.ago)
+ ])
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the last comment was created a few seconds ago' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 3.seconds.ago)
+ ])
+ end
+
+ it { is_expected.to eq(false) }
+ end
+
+ context 'when the last 2 comments were created in the last 5 minutes' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 1.second.ago),
+ FactoryBot.create(:comment, created_at: 2.minutes.ago),
+ FactoryBot.create(:comment, created_at: 3.days.ago)
+ ])
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the last 4 comments were created in the last 30 minutes' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 1.second.ago),
+ FactoryBot.create(:comment, created_at: 2.minutes.ago),
+ FactoryBot.create(:comment, created_at: 5.minutes.ago),
+ FactoryBot.create(:comment, created_at: 10.minutes.ago),
+ FactoryBot.create(:comment, created_at: 3.days.ago)
+ ])
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the last 6 comments were created in the last hour' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 1.second.ago),
+ FactoryBot.create(:comment, created_at: 2.minutes.ago),
+ FactoryBot.create(:comment, created_at: 5.minutes.ago),
+ FactoryBot.create(:comment, created_at: 10.minutes.ago),
+ FactoryBot.create(:comment, created_at: 40.minutes.ago),
+ FactoryBot.create(:comment, created_at: 50.minutes.ago),
+ FactoryBot.create(:comment, created_at: 3.days.ago)
+ ])
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the comments are reasonably spaced' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 15.minutes.ago),
+ FactoryBot.create(:comment, created_at: 12.minutes.ago),
+ FactoryBot.create(:comment, created_at: 40.minutes.ago),
+ FactoryBot.create(:comment, created_at: 3.hours.ago),
+ FactoryBot.create(:comment, created_at: 8.hours.ago),
+ FactoryBot.create(:comment, created_at: 1.day.ago),
+ FactoryBot.create(:comment, created_at: 3.days.ago)
+ ])
+ end
+
+ it { is_expected.to eq(false) }
+ end
+
+ context 'when the comments are provided out of order' do
+ let(:comments) do
+ described_class.where(id: [
+ FactoryBot.create(:comment, created_at: 3.days.ago),
+ FactoryBot.create(:comment, created_at: 2.minutes.ago),
+ FactoryBot.create(:comment, created_at: 1.second.ago)
+ ]).order(created_at: :asc)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+ end
+ # rubocop:enable Layout/FirstArrayElementIndentation
+
describe '#prominence' do
subject { comment.prominence }
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index b75161db75..e05bf5b41c 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1917,6 +1917,11 @@ def create_user(options = {})
before do
allow(user).
to receive(:exceeded_limit?).with(:comments).and_return(true)
+
+ allow(Comment).
+ to receive(:exceeded_creation_rate?).
+ with(user.comments).
+ and_return(true)
end
it { is_expected.to eq(true) }
@@ -1929,6 +1934,11 @@ def create_user(options = {})
before do
allow(user).
to receive(:exceeded_limit?).with(:comments).and_return(true)
+
+ allow(Comment).
+ to receive(:exceeded_creation_rate?).
+ with(user.comments).
+ and_return(true)
end
it { is_expected.to eq(true) }
@@ -1944,6 +1954,32 @@ def create_user(options = {})
it { is_expected.to eq(false) }
end
+
+ context 'when the user has not reached their rate limit' do
+ let(:user) { FactoryBot.build(:user) }
+
+ before do
+ allow(Comment).
+ to receive(:exceeded_creation_rate?).
+ with(user.comments).
+ and_return(false)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when the user has reached their rate limit' do
+ let(:user) { FactoryBot.build(:user) }
+
+ before do
+ allow(Comment).
+ to receive(:exceeded_creation_rate?).
+ with(user.comments).
+ and_return(true)
+ end
+
+ it { is_expected.to eq(false) }
+ end
end
describe '#exceeded_limit?' do
From ba42eac9c7492b095c4f47dcf61c7394aa34a9f1 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 14 Feb 2023 11:15:01 +0000
Subject: [PATCH 146/289] Update setting RAILS_ENV in install scripts
When re/running the installer:
1. update `RAILS_ENV` file based on the `STAGING_SITE` configuration
2. don't nuke customised settings in `config/rails_env.rb`.
---
script/rails-deploy-before-down | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/script/rails-deploy-before-down b/script/rails-deploy-before-down
index d7a68a21f7..97c7d8517a 100755
--- a/script/rails-deploy-before-down
+++ b/script/rails-deploy-before-down
@@ -77,9 +77,8 @@ OPTION_STAGING_SITE=$(bin/config STAGING_SITE)
STAGING_SITE="${OPTION_STAGING_SITE:-1}"
# Force appropriate environment in production
-if [ "$STAGING_SITE" = "0" ]
-then
- cat <<-END
+if [ ! -f config/rails_env.rb ]; then
+ [ "$STAGING_SITE" = "0" ] && cat <<-END
*****************************************************************
WARNING: About to make config/rails_env.rb which, via special
@@ -92,7 +91,19 @@ then
*****************************************************************
END
- echo "ENV['RAILS_ENV'] ||= 'production'" > config/rails_env.rb
+
+else
+ RAILS_ENV=$(ruby -r ./config/rails_env.rb -e "puts ENV['RAILS_ENV']")
+ if ([ "$STAGING_SITE" = "0" ] && [ "$RAILS_ENV" != "production" ]) ||
+ ([ "$STAGING_SITE" = "1" ] && [ "$RAILS_ENV" = "production" ]); then
+ # STAGING_SITE and RAILS_ENV mismatch - remove line
+ sed -i "/^ENV\['RAILS_ENV'\]/d" config/rails_env.rb
+ fi
+fi
+
+if [ "$STAGING_SITE" = "0" ] && [ "$RAILS_ENV" != "production" ]; then
+ # Set RAILS_ENV to production
+ echo "ENV['RAILS_ENV'] ||= 'production'" >> config/rails_env.rb
fi
OPTION_BUNDLE_PATH=$(bin/config BUNDLE_PATH)
From 26a58e3c6a4a74618bf218be86b1d34f02e524f4 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 09:56:04 +0000
Subject: [PATCH 147/289] Fix example usage
---
lib/tasks/config_files.rake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 08a3b0f566..d01f9b2222 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -122,7 +122,7 @@ namespace :config_files do
'VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli ' \
'SITE=alaveteli CRONTAB=config/crontab-example ' \
'MAILTO=cron-alaveteli@example.org ' \
- 'RUBY_VERSION=3.0.4 '
+ 'RUBY_VERSION=3.0.4 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR VCSPATH SITE CRONTAB], example)
replacements = {
@@ -199,7 +199,7 @@ namespace :config_files do
desc 'Set reject_incoming_at_mta on a list of requests identified by ' \
'request address'
task set_reject_incoming_at_mta_from_list: :environment do
- example = 'rake temp:set_reject_incoming_at_mta_from_list ' \
+ example = 'rake config_files:set_reject_incoming_at_mta_from_list ' \
'FILE=/tmp/rejection_list.txt'
check_for_env_vars(['FILE'], example)
From 002c0af1c7a701789963ad58f19224b7194fd2cb Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 11:53:06 +0000
Subject: [PATCH 148/289] Remove config_files:get_config_value task
This can be replaced with a call to our `bin/config` command.
---
lib/tasks/config_files.rake | 12 ------------
script/site-specific-install.sh | 2 +-
2 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index d01f9b2222..56813f729d 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -44,18 +44,6 @@ namespace :config_files do
puts daemons
end
- desc 'Return the value of a config param'
- task get_config_value: :environment do
- example = 'rake config_files:get_config_value ' \
- 'KEY=PRODUCTION_MAILER_RETRIEVER_METHOD'
- check_for_env_vars(['KEY'], example)
- key = ENV['KEY']
- if AlaveteliConfiguration::DEFAULTS.key?(key.to_sym)
- puts MySociety::Config.
- get(key, AlaveteliConfiguration::DEFAULTS[key.to_sym])
- end
- end
-
desc 'Convert wrapper example in config to a form suitable for running mail handling scripts with rbenv'
task convert_wrapper: :environment do
example = 'rake config_files:convert_wrapper DEPLOY_USER=deploy SCRIPT_FILE=config/run-with-rbenv-path.example'
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index 9a45617090..3b7bc49f19 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -213,7 +213,7 @@ su -l -c "$BIN_DIRECTORY/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY' '$RUB
echo "ALTER USER \"$UNIX_USER\" WITH NOSUPERUSER;" | su -l -c 'psql' postgres
-RETRIEVER_METHOD=$(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:get_config_value KEY=PRODUCTION_MAILER_RETRIEVER_METHOD" "$UNIX_USER")
+RETRIEVER_METHOD=$(su -l -c "cd '$REPOSITORY' && bin/config PRODUCTION_MAILER_RETRIEVER_METHOD" "$UNIX_USER")
if [ x"$RETRIEVER_METHOD" = x"pop" ] && [ "$DEVELOPMENT_INSTALL" = true ]; then
# Install dovecot
From 7487f36c760020802ef33ddb38b2d3cd0949f329 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 13:09:44 +0000
Subject: [PATCH 149/289] Extract config file replacements
Use a single line with all the variables with sensible defaults.
---
lib/tasks/config_files.rake | 60 +++++++++++++------------------------
1 file changed, 20 insertions(+), 40 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 56813f729d..2909a8d782 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -24,6 +24,20 @@ namespace :config_files do
ExampleERBRenderer.new(file, **replacements).lines
end
+ def default_replacements
+ {
+ cpus: ENV.fetch('CPUS') { '1' },
+ mailto: ENV.fetch('MAILTO') { "#{ ENV['DEPLOY_USER'] }@localhost" },
+ rails_env: ENV.fetch('RAILS_ENV') { 'development' },
+ ruby_version: ENV.fetch('RUBY_VERSION') { '3.0.4' },
+ site: ENV.fetch('SITE') { 'foi' },
+ user: ENV.fetch('DEPLOY_USER') { 'alaveteli' },
+ vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
+ vhost_dir: ENV.fetch('VHOST_DIR') { '/var/www/alaveteli' },
+ use_rbenv?: ENV.fetch('USE_RBENV', 'false') == 'true'
+ }
+ end
+
def daemons(only_active = false)
daemons = %w[alert-tracks send-notifications]
if AlaveteliConfiguration.production_mailer_retriever_method == 'pop' ||
@@ -49,12 +63,7 @@ namespace :config_files do
example = 'rake config_files:convert_wrapper DEPLOY_USER=deploy SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(%w[DEPLOY_USER SCRIPT_FILE], example)
- replacements = {
- user: ENV['DEPLOY_USER']
- }
-
- # Generate the template for potential further processing
- convert_erb(ENV['SCRIPT_FILE'], **replacements).each do |line|
+ convert_erb(ENV['SCRIPT_FILE'], **default_replacements).each do |line|
puts line
end
end
@@ -71,22 +80,12 @@ namespace :config_files do
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR SCRIPT_FILE], example)
- replacements = {
- user: ENV['DEPLOY_USER'],
- vhost_dir: ENV['VHOST_DIR'],
- vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
- site: ENV.fetch('SITE') { 'foi' },
- cpus: ENV.fetch('CPUS') { '1' },
- rails_env: ENV.fetch('RAILS_ENV') { 'development' },
- ruby_version: ENV.fetch('RUBY_VERSION') { '' },
- use_rbenv?: ENV['USE_RBENV'] == 'true'
- }
-
# Use the filename for the $daemon_name ugly variable
daemon_name = File.basename(ENV['SCRIPT_FILE'], '-debian.example')
- replacements.update(daemon_name: "#{ replacements[:site] }-#{ daemon_name }")
+ replacements = default_replacements.merge(
+ daemon_name: "#{default_replacements[:site]}-#{daemon_name}"
+ )
- # Generate the template for potential further processing
converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
# uncomment RAILS_ENV in to the generated template if its not set by the
@@ -113,18 +112,9 @@ namespace :config_files do
'RUBY_VERSION=3.0.4 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR VCSPATH SITE CRONTAB], example)
- replacements = {
- user: ENV['DEPLOY_USER'],
- vhost_dir: ENV['VHOST_DIR'],
- vcspath: ENV['VCSPATH'],
- site: ENV['SITE'],
- mailto: ENV.fetch('MAILTO') { "#{ ENV['DEPLOY_USER'] }@localhost" },
- ruby_version: ENV.fetch('RUBY_VERSION') { '' },
- use_rbenv?: ENV['USE_RBENV'] == 'true'
- }
lines = []
- convert_erb(ENV['CRONTAB'], **replacements).each do |line|
+ convert_erb(ENV['CRONTAB'], **default_replacements).each do |line|
lines << line
end
@@ -138,17 +128,7 @@ namespace :config_files do
example = 'rake config_files:convert_script SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(['SCRIPT_FILE'], example)
- replacements = {
- user: ENV.fetch('DEPLOY_USER') { 'alaveteli' },
- vhost_dir: ENV.fetch('VHOST_DIR') { '/var/www/alaveteli' },
- vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
- site: ENV.fetch('SITE') { 'foi' },
- cpus: ENV.fetch('CPUS') { '1' },
- rails_env: ENV.fetch('RAILS_ENV') { 'development' }
- }
-
- # Generate the template for potential further processing
- converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
+ converted = convert_erb(ENV['SCRIPT_FILE'], **default_replacements)
# uncomment RAILS_ENV in to the generated template if its not set by the
# hard coded config file
From 0087495d996afd3bfc135e183e0f38a6062dc5c6 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 12:21:03 +0000
Subject: [PATCH 150/289] Remove comments from debian scripts examples
These comments we're dynamically uncommented when `config/rails_env.rb`
doesn't exist. Instead add a variable `rails_env_defined?` variable and
use ERB templating.
---
config/alert-tracks-debian.example | 8 +++++---
config/poll-for-incoming-debian.example | 8 +++++---
config/send-notifications-debian.example | 8 +++++---
config/sysvinit-thin.example | 8 +++++---
lib/tasks/config_files.rake | 21 ++-------------------
script/site-specific-install.sh | 10 ++++++++--
6 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/config/alert-tracks-debian.example b/config/alert-tracks-debian.example
index eb9886147c..81ef1147f1 100755
--- a/config/alert-tracks-debian.example
+++ b/config/alert-tracks-debian.example
@@ -22,9 +22,11 @@ LOGDIR=<%= vhost_dir %>/<%= vcspath %>/log
LOGFILE=$LOGDIR/<%= daemon_name %>.log
DUSER=<%= user %>
SITE_HOME=<%= vhost_dir %>/<%= vcspath %>
-# Set RAILS_ENV - not needed if using config/rails_env.rb
-# RAILS_ENV=<%= rails_env %>
-# export RAILS_ENV
+
+<% unless rails_env_defined? %>
+RAILS_ENV=<%= rails_env %>
+export RAILS_ENV
+<% end %>
<% if use_rbenv? %>
RBENV_ROOT="/home/<%= user %>/.rbenv"
diff --git a/config/poll-for-incoming-debian.example b/config/poll-for-incoming-debian.example
index 01403e3955..45922c2d06 100755
--- a/config/poll-for-incoming-debian.example
+++ b/config/poll-for-incoming-debian.example
@@ -22,9 +22,11 @@ LOGDIR=<%= vhost_dir %>/<%= vcspath %>/log
LOGFILE=$LOGDIR/<%= daemon_name %>.log
DUSER=<%= user %>
SITE_HOME=<%= vhost_dir %>/<%= vcspath %>
-# Set RAILS_ENV - not needed if using config/rails_env.rb
-# RAILS_ENV=<%= rails_env %>
-# export RAILS_ENV
+
+<% unless rails_env_defined? %>
+RAILS_ENV=<%= rails_env %>
+export RAILS_ENV
+<% end %>
<% if use_rbenv? %>
RBENV_ROOT="/home/<%= user %>/.rbenv"
diff --git a/config/send-notifications-debian.example b/config/send-notifications-debian.example
index 08fe801ef0..a62b11c003 100755
--- a/config/send-notifications-debian.example
+++ b/config/send-notifications-debian.example
@@ -22,9 +22,11 @@ LOGDIR=<%= vhost_dir %>/<%= vcspath %>/log
LOGFILE=$LOGDIR/<%= daemon_name %>.log
DUSER=<%= user %>
SITE_HOME=<%= vhost_dir %>/<%= vcspath %>
-# Set RAILS_ENV - not needed if using config/rails_env.rb
-# RAILS_ENV=<%= rails_env %>
-# export RAILS_ENV
+
+<% unless rails_env_defined? %>
+RAILS_ENV=<%= rails_env %>
+export RAILS_ENV
+<% end %>
<% if use_rbenv? %>
RBENV_ROOT="/home/<%= user %>/.rbenv"
diff --git a/config/sysvinit-thin.example b/config/sysvinit-thin.example
index 987f3ac233..f42ba66152 100755
--- a/config/sysvinit-thin.example
+++ b/config/sysvinit-thin.example
@@ -19,9 +19,11 @@ SITE_HOME=<%= vhost_dir %>/<%= vcspath %>
DESC="Alaveteli app server"
USER=<%= user %>
CPUS=<%= cpus %>
-# Set RAILS_ENV - not needed if using config/rails_env.rb
-# RAILS_ENV=<%= rails_env %>
-# export RAILS_ENV
+
+<% unless rails_env_defined? %>
+RAILS_ENV=<%= rails_env %>
+export RAILS_ENV
+<% end %>
CMD="bundle exec thin"
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 2909a8d782..2105eb08ab 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -34,7 +34,8 @@ namespace :config_files do
user: ENV.fetch('DEPLOY_USER') { 'alaveteli' },
vcspath: ENV.fetch('VCSPATH') { 'alaveteli' },
vhost_dir: ENV.fetch('VHOST_DIR') { '/var/www/alaveteli' },
- use_rbenv?: ENV.fetch('USE_RBENV', 'false') == 'true'
+ use_rbenv?: ENV.fetch('USE_RBENV', 'false') == 'true',
+ rails_env_defined?: ENV['RAILS_ENV_DEFINED'] == 'true'
}
end
@@ -88,15 +89,6 @@ namespace :config_files do
converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
- # uncomment RAILS_ENV in to the generated template if its not set by the
- # hard coded config file
- unless File.exist?("#{ Rails.root }/config/rails_env.rb")
- converted.each do |line|
- line.gsub!(/^#\s*RAILS_ENV=/, "RAILS_ENV=")
- line.gsub!(/^#\s*export RAILS_ENV/, "export RAILS_ENV")
- end
- end
-
converted.each do |line|
puts line
end
@@ -130,15 +122,6 @@ namespace :config_files do
converted = convert_erb(ENV['SCRIPT_FILE'], **default_replacements)
- # uncomment RAILS_ENV in to the generated template if its not set by the
- # hard coded config file
- unless File.exist?("#{ Rails.root }/config/rails_env.rb")
- converted.each do |line|
- line.gsub!(/^#\s*RAILS_ENV=/, "RAILS_ENV=")
- line.gsub!(/^#\s*export RAILS_ENV/, "export RAILS_ENV")
- end
- end
-
converted.each do |line|
puts line
end
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index 3b7bc49f19..f6a18aa379 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -34,7 +34,7 @@ clear_daemon() {
install_daemon() {
echo -n "Creating /etc/init.d/$SITE-$1... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' SCRIPT_FILE=config/$1-debian.example" "$UNIX_USER") > /etc/init.d/"$SITE-$1"
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' SCRIPT_FILE=config/$1-debian.example" "$UNIX_USER") > /etc/init.d/"$SITE-$1"
chgrp "$UNIX_USER" /etc/init.d/"$SITE-$1"
chmod 754 /etc/init.d/"$SITE-$1"
@@ -250,6 +250,12 @@ fi
cd "$REPOSITORY"
+if [ -f config/rails_env.rb ]; then
+ RAILS_ENV_DEFINED=$(ruby -r ./config/rails_env.rb -e "puts ENV.keys.include?('RAILS_ENV')")
+else
+ RAILS_ENV_DEFINED=false
+fi
+
if [ "$DEVELOPMENT_INSTALL" = true ]; then
RAILS_ENV=development
else
@@ -287,7 +293,7 @@ echo $DONE_MSG
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
echo -n "Creating /etc/init.d/$SITE... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' SCRIPT_FILE=config/sysvinit-thin.example" "$UNIX_USER") > /etc/init.d/"$SITE"
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' SCRIPT_FILE=config/sysvinit-thin.example" "$UNIX_USER") > /etc/init.d/"$SITE"
chgrp "$UNIX_USER" /etc/init.d/"$SITE"
chmod 754 /etc/init.d/"$SITE"
echo $DONE_MSG
From 0f3c209ce72e989419115b04a838066d4861c92c Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 13:38:42 +0000
Subject: [PATCH 151/289] Refactor config file output
Use a single `puts` statement instead of looping over each line.
---
lib/tasks/config_files.rake | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 2105eb08ab..1835f81999 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -21,7 +21,7 @@ namespace :config_files do
end
def convert_erb(file, **replacements)
- ExampleERBRenderer.new(file, **replacements).lines
+ puts ExampleERBRenderer.new(file, **replacements).lines
end
def default_replacements
@@ -64,9 +64,7 @@ namespace :config_files do
example = 'rake config_files:convert_wrapper DEPLOY_USER=deploy SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(%w[DEPLOY_USER SCRIPT_FILE], example)
- convert_erb(ENV['SCRIPT_FILE'], **default_replacements).each do |line|
- puts line
- end
+ convert_erb(ENV['SCRIPT_FILE'], **default_replacements)
end
desc 'Convert Debian example init script in config to a form suitable for installing in /etc/init.d'
@@ -87,11 +85,7 @@ namespace :config_files do
daemon_name: "#{default_replacements[:site]}-#{daemon_name}"
)
- converted = convert_erb(ENV['SCRIPT_FILE'], **replacements)
-
- converted.each do |line|
- puts line
- end
+ convert_erb(ENV['SCRIPT_FILE'], **replacements)
end
desc 'Convert Debian example crontab file in config to a form suitable for installing in /etc/cron.d'
@@ -104,27 +98,14 @@ namespace :config_files do
'RUBY_VERSION=3.0.4 ' \
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR VCSPATH SITE CRONTAB], example)
-
- lines = []
- convert_erb(ENV['CRONTAB'], **default_replacements).each do |line|
- lines << line
- end
-
- lines.each do |line|
- puts line
- end
+ convert_erb(ENV['CRONTAB'], **default_replacements)
end
desc 'Convert miscellaneous example scripts. This does not check for required environment variables for the script, so please check the script file itself.'
task convert_script: :environment do
example = 'rake config_files:convert_script SCRIPT_FILE=config/run-with-rbenv-path.example'
check_for_env_vars(['SCRIPT_FILE'], example)
-
- converted = convert_erb(ENV['SCRIPT_FILE'], **default_replacements)
-
- converted.each do |line|
- puts line
- end
+ convert_erb(ENV['SCRIPT_FILE'], **default_replacements)
end
desc 'Set reject_incoming_at_mta on old requests that are rejecting incoming mail'
From 7cd9ab1b3469681fa7d723eaf90ec75f1b897014 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 11:55:33 +0000
Subject: [PATCH 152/289] Refactor daemon definitions
---
lib/tasks/config_files.rake | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 1835f81999..a2e291ffd9 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -39,24 +39,38 @@ namespace :config_files do
}
end
- def daemons(only_active = false)
- daemons = %w[alert-tracks send-notifications]
- if AlaveteliConfiguration.production_mailer_retriever_method == 'pop' ||
- !only_active
- daemons << 'poll-for-incoming'
- end
- daemons
+ def daemons
+ [
+ {
+ name: 'alert-tracks',
+ template: 'config/alert-tracks-debian.example'
+ },
+ {
+ name: 'send-notifications',
+ template: 'config/send-notifications-debian.example'
+ },
+ {
+ name: 'poll-for-incoming',
+ template: 'config/poll-for-incoming-debian.example',
+ condition: -> do
+ AlaveteliConfiguration.production_mailer_retriever_method == 'pop'
+ end
+ }
+ ]
end
desc 'Return list of daemons to install based on the settings defined
in general.yml'
task active_daemons: :environment do
- puts daemons(true)
+ puts daemons.
+ select { |d| d.fetch(:condition, -> { true }).call }.
+ map { |d| d[:name] }
end
desc 'Return list of all daemons the application defines'
task all_daemons: :environment do
- puts daemons
+ puts daemons.
+ map { |d| d[:name] }
end
desc 'Convert wrapper example in config to a form suitable for running mail handling scripts with rbenv'
From 82e7961c9821532b2ddb2ac3e8d161a42caa09d2 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 12:59:28 +0000
Subject: [PATCH 153/289] Add config_files:convert_daemon task
Delegates to the existing `convert_init_script` which was previously
used.
The `convert_init_script` has been kept so it can be used for other
scripts, such as `config/sysvinit-passenger.example`.
---
lib/tasks/config_files.rake | 28 ++++++++++++++++++++++++++--
script/site-specific-install.sh | 2 +-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index a2e291ffd9..415cf23361 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -93,8 +93,10 @@ namespace :config_files do
'USE_RBENV=false '
check_for_env_vars(%w[DEPLOY_USER VHOST_DIR SCRIPT_FILE], example)
- # Use the filename for the $daemon_name ugly variable
- daemon_name = File.basename(ENV['SCRIPT_FILE'], '-debian.example')
+ daemon_name = ENV.fetch('DAEMON_NAME') do
+ File.basename(ENV['SCRIPT_FILE'], '-debian.example')
+ end
+
replacements = default_replacements.merge(
daemon_name: "#{default_replacements[:site]}-#{daemon_name}"
)
@@ -102,6 +104,28 @@ namespace :config_files do
convert_erb(ENV['SCRIPT_FILE'], **replacements)
end
+ desc 'Convert example daemon in config to a form suitable for installing ' \
+ 'on a server'
+ task convert_daemon: :environment do
+ example = 'rake config_files:convert_daemon ' \
+ 'DEPLOY_USER=deploy ' \
+ 'VHOST_DIR=/dir/above/alaveteli ' \
+ 'VCSPATH=alaveteli ' \
+ 'SITE=alaveteli ' \
+ 'DAEMON=alert-tracks ' \
+ 'RUBY_VERSION=3.0.4 ' \
+ 'USE_RBENV=false '
+ check_for_env_vars(%w[DEPLOY_USER VHOST_DIR DAEMON], example)
+
+ daemon = daemons.find { |d| d[:name] == ENV['DAEMON'] }
+ raise 'Unknown daemon' unless daemon
+
+ ENV['SCRIPT_FILE'] = daemon[:template]
+ ENV['DAEMON_NAME'] = daemon[:name]
+
+ Rake::Task['config_files:convert_init_script'].invoke
+ end
+
desc 'Convert Debian example crontab file in config to a form suitable for installing in /etc/cron.d'
task convert_crontab: :environment do
example = 'rake config_files:convert_crontab ' \
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index f6a18aa379..a97897dc8d 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -34,7 +34,7 @@ clear_daemon() {
install_daemon() {
echo -n "Creating /etc/init.d/$SITE-$1... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' SCRIPT_FILE=config/$1-debian.example" "$UNIX_USER") > /etc/init.d/"$SITE-$1"
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_daemon DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' DAEMON=$1" "$UNIX_USER") > /etc/init.d/"$SITE-$1"
chgrp "$UNIX_USER" /etc/init.d/"$SITE-$1"
chmod 754 /etc/init.d/"$SITE-$1"
From 0ee0a44a025998cae0830f704c29e758ef8fdb32 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 2 Mar 2023 17:32:31 +0000
Subject: [PATCH 154/289] Update generation of main application service
Combine generation of main application init.d services with the other
daemons.
---
lib/tasks/config_files.rake | 5 +++++
script/site-specific-install.sh | 11 ++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 415cf23361..3a2452a9b6 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -41,6 +41,11 @@ namespace :config_files do
def daemons
[
+ {
+ name: 'thin',
+ template: 'config/sysvinit-thin.example',
+ condition: -> { ENV['RAILS_ENV'] == 'production' }
+ },
{
name: 'alert-tracks',
template: 'config/alert-tracks-debian.example'
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index a97897dc8d..948349f1e7 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -291,11 +291,12 @@ sed -r \
-i /etc/cron.d/alaveteli
echo $DONE_MSG
-if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
- echo -n "Creating /etc/init.d/$SITE... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' SCRIPT_FILE=config/sysvinit-thin.example" "$UNIX_USER") > /etc/init.d/"$SITE"
- chgrp "$UNIX_USER" /etc/init.d/"$SITE"
- chmod 754 /etc/init.d/"$SITE"
+# Clear existing legacy daemons if present
+if [ -f /etc/init.d/$SITE ]
+then
+ echo "Clearing any legacy daemons"
+ echo -n "Removing /etc/init.d/$SITE... "
+ rm -f "/etc/init.d/$SITE"
echo $DONE_MSG
fi
From b960ff93f50703fbf9269f3b04206a764612188d Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 16 Feb 2023 14:06:41 +0000
Subject: [PATCH 155/289] Add support for systemd services
This will be needed to add services for Puma and Sidekiq.
---
lib/tasks/config_files.rake | 16 ++++++++--
script/site-specific-install.sh | 52 ++++++++++++++++++++-------------
2 files changed, 45 insertions(+), 23 deletions(-)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 3a2452a9b6..3619bd0f66 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -42,19 +42,23 @@ namespace :config_files do
def daemons
[
{
+ path: '/etc/init.d',
name: 'thin',
template: 'config/sysvinit-thin.example',
condition: -> { ENV['RAILS_ENV'] == 'production' }
},
{
+ path: '/etc/init.d',
name: 'alert-tracks',
template: 'config/alert-tracks-debian.example'
},
{
+ path: '/etc/init.d',
name: 'send-notifications',
template: 'config/send-notifications-debian.example'
},
{
+ path: '/etc/init.d',
name: 'poll-for-incoming',
template: 'config/poll-for-incoming-debian.example',
condition: -> do
@@ -65,16 +69,24 @@ namespace :config_files do
end
desc 'Return list of daemons to install based on the settings defined
- in general.yml'
+ in general.yml for a given path'
task active_daemons: :environment do
+ example = 'rake config_files:active_daemons PATH=/etc/init.d'
+ check_for_env_vars(['PATH'], example)
+
puts daemons.
+ select { |d| d[:path] == ENV['PATH'] }.
select { |d| d.fetch(:condition, -> { true }).call }.
map { |d| d[:name] }
end
- desc 'Return list of all daemons the application defines'
+ desc 'Return list of all daemons the application defines for a given path'
task all_daemons: :environment do
+ example = 'rake config_files:all_daemons PATH=/etc/init.d'
+ check_for_env_vars(['PATH'], example)
+
puts daemons.
+ select { |d| d[:path] == ENV['PATH'] }.
map { |d| d[:name] }
end
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index 948349f1e7..6302e962c6 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -27,20 +27,28 @@ install_mailutils() {
}
clear_daemon() {
- echo -n "Removing /etc/init.d/$SITE-$1... "
- rm -f "/etc/init.d/$SITE-$1"
+ path=$1
+ if [ $path = "/etc/init.d" ]; then name="$SITE-$2"; fi
+ if [ $path = "/etc/systemd/system" ]; then name="$SITE.$2"; fi
+
+ echo -n "Removing $path/$name... "
+ rm -f "$path/$name"
echo $DONE_MSG
}
install_daemon() {
- echo -n "Creating /etc/init.d/$SITE-$1... "
- (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_daemon DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' DAEMON=$1" "$UNIX_USER") > /etc/init.d/"$SITE-$1"
- chgrp "$UNIX_USER" /etc/init.d/"$SITE-$1"
- chmod 754 /etc/init.d/"$SITE-$1"
+ path=$1
+ if [ $path = "/etc/init.d" ]; then name="$SITE-$2"; fi
+ if [ $path = "/etc/systemd/system" ]; then name="$SITE.$2"; fi
+
+ echo -n "Creating $path/$name... "
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_daemon DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' RUBY_VERSION='$RUBY_VERSION' USE_RBENV=$USE_RBENV RAILS_ENV='$RAILS_ENV' RAILS_ENV_DEFINED='$RAILS_ENV_DEFINED' DAEMON=$2" "$UNIX_USER") > $path/$name
+ chgrp "$UNIX_USER" $path/$name
+ chmod 754 $path/$name
if which systemctl > /dev/null
then
- systemctl enable "$SITE-$1"
+ systemctl enable "$name"
fi
echo $DONE_MSG
@@ -300,20 +308,22 @@ then
echo $DONE_MSG
fi
-# Clear existing daemons
-all_daemons=$(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:all_daemons" "$UNIX_USER")
-echo "Clearing any existing daemons"
-for daemon in $all_daemons
-do
- clear_daemon $daemon
-done
-
-# Install required daemons
-active_daemons=$(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:active_daemons" "$UNIX_USER")
-echo "Creating daemons for active daemons"
-for daemon in $active_daemons
-do
- install_daemon $daemon
+for path in "/etc/init.d" "/etc/systemd/system"; do
+ # Clear existing daemons
+ all_daemons=$(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:all_daemons PATH='$path'" "$UNIX_USER")
+ echo "Clearing any existing $path daemons"
+ for daemon in $all_daemons
+ do
+ clear_daemon $path $daemon
+ done
+
+ # Install required daemons
+ active_daemons=$(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:active_daemons PATH='$path'" "$UNIX_USER")
+ echo "Creating daemons for active $path daemons"
+ for daemon in $active_daemons
+ do
+ install_daemon $path $daemon
+ done
done
if which systemctl > /dev/null
From 502945cc9437e3969caf62d2c9fc729b39a5d1af Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 3 Mar 2023 11:16:12 +0000
Subject: [PATCH 156/289] Add STAGING_SITE and DEVELOPMENT_INSTALL check
If these values aren't compatible with each other then error, ask the
user to make a change and exit early.
---
script/site-specific-install.sh | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index 6302e962c6..db02316e16 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -71,6 +71,28 @@ install_daemon() {
[ -z "$DEVELOPMENT_INSTALL" ] && misuse DEVELOPMENT_INSTALL
[ -z "$BIN_DIRECTORY" ] && misuse BIN_DIRECTORY
+if [ -f $REPOSITORY/config/general.yml ]; then
+ STAGING_SITE=$(su -l -c "cd '$REPOSITORY' && bin/config STAGING_SITE" "$UNIX_USER")
+ if ([ "$STAGING_SITE" = "0" ] && [ "$DEVELOPMENT_INSTALL" = "true" ]) ||
+ ([ "$STAGING_SITE" = "1" ] && [ "$DEVELOPMENT_INSTALL" != "true" ]); then
+ cat <<-END
+
+ *****************************************************************
+ ERROR: Configuration mismatch
+
+ In config/general.yml you have STAGING_SITE set to $STAGING_SITE but you're
+ running the install script with DEVELOPMENT_INSTALL set to $DEVELOPMENT_INSTALL
+
+ Please either update config/general.yml or change the flags used
+ when invoking the install script
+ *****************************************************************
+
+END
+
+ exit 1
+ fi
+fi
+
update_mysociety_apt_sources
apt-get -y update
From 9a2982aedd35c304966cdbaa31bec2a3551aabfe Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 3 Mar 2023 13:18:17 +0000
Subject: [PATCH 157/289] Extract conditional loading of config/rails_env.rb
This will mean we can just require `config/load_env.rb` when loading
Rails, Sidekiq or Puma.
---
config/boot.rb | 7 +------
config/load_env.rb | 7 +++++++
2 files changed, 8 insertions(+), 6 deletions(-)
create mode 100644 config/load_env.rb
diff --git a/config/boot.rb b/config/boot.rb
index e6a5f1c48d..662856d3b3 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -2,9 +2,4 @@
require "bundler/setup" # Set up gems listed in the Gemfile.
-# TODO: Remove this. This is a hacky system for having a default environment.
-# It looks for a config/rails_env.rb file, and reads stuff from there if
-# it exists. Put just a line like this in there:
-# ENV['RAILS_ENV'] = 'production'
-rails_env_file = File.expand_path(File.join(File.dirname(__FILE__), 'rails_env.rb'))
-require rails_env_file if File.exist?(rails_env_file)
+require File.expand_path('load_env.rb', __dir__)
diff --git a/config/load_env.rb b/config/load_env.rb
new file mode 100644
index 0000000000..3b257efd3a
--- /dev/null
+++ b/config/load_env.rb
@@ -0,0 +1,7 @@
+# TODO: Remove this. This is a hacky system for having a default environment.
+# It looks for a config/rails_env.rb file, and reads stuff from there if
+# it exists. Put just a line like this in there:
+# ENV['RAILS_ENV'] = 'production'
+
+rails_env_file = File.expand_path('rails_env.rb', __dir__)
+require rails_env_file if File.exist?(rails_env_file)
From 9d64507bf70d57c4366866df1fbc81c90aa4fe0a Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Mar 2023 05:03:42 +0000
Subject: [PATCH 158/289] Build(deps): Bump cancancan from 3.4.0 to 3.5.0
Bumps [cancancan](https://github.com/CanCanCommunity/cancancan) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/CanCanCommunity/cancancan/releases)
- [Changelog](https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/CanCanCommunity/cancancan/compare/3.4.0...3.5.0)
---
updated-dependencies:
- dependency-name: cancancan
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 969146a9d3..2d88ebf622 100644
--- a/Gemfile
+++ b/Gemfile
@@ -88,7 +88,7 @@ gem 'acts_as_versioned', git: 'https://github.com/mysociety/acts_as_versioned.gi
ref: '13e928b'
gem 'active_model_otp'
gem 'bcrypt', '~> 3.1.18'
-gem 'cancancan', '~> 3.4.0'
+gem 'cancancan', '~> 3.5.0'
gem 'charlock_holmes', '~> 0.7.7'
gem 'dalli', '~> 3.2.3'
gem 'exception_notification', '~> 4.5.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 787c6f4d4b..23518da528 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -152,7 +152,7 @@ GEM
bullet (7.0.7)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
- cancancan (3.4.0)
+ cancancan (3.5.0)
capistrano (2.15.9)
highline
net-scp (>= 1.0.0)
@@ -551,7 +551,7 @@ DEPENDENCIES
bcrypt (~> 3.1.18)
bootstrap-sass (~> 2.3.2.2)
bullet (~> 7.0.7)
- cancancan (~> 3.4.0)
+ cancancan (~> 3.5.0)
capistrano (~> 2.15.0, < 3.0.0)
capybara (~> 3.38.0)
charlock_holmes (~> 0.7.7)
From 282d115953f74111e9518ca91c26fc5d43643927 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 3 Feb 2023 10:43:30 +0000
Subject: [PATCH 159/289] Add background job processing
Use Redis/Sidekiq job queue via ActiveJob.
Adds configuration option to allow jobs to be performed either, inline,
embedded in the web process, or by the Sidekiq server daemon.
---
.ruby-style.yml | 2 ++
Gemfile | 2 ++
Gemfile.lock | 12 ++++++++++--
app/jobs/application_job.rb | 13 +++++++++++++
bin/sidekiq | 27 +++++++++++++++++++++++++++
bin/sidekiqmon | 27 +++++++++++++++++++++++++++
config/application.rb | 5 ++++-
config/environments/test.rb | 3 +++
config/general.yml-example | 16 ++++++++++++++++
config/initializers/sidekiq.rb | 26 ++++++++++++++++++++++++++
config/packages | 1 +
config/packages.generic | 1 +
config/packages.ubuntu-focal | 1 +
config/rails_env.rb-example | 1 +
config/routes.rb | 14 +++++++++++++-
config/sidekiq.service.example | 22 ++++++++++++++++++++++
config/sidekiq.yml | 6 ++++++
config/test.yml | 2 ++
docker-compose.yml | 28 ++++++++++++++++++++++++++++
lib/configuration.rb | 7 +++++++
lib/tasks/config_files.rake | 6 ++++++
21 files changed, 218 insertions(+), 4 deletions(-)
create mode 100644 app/jobs/application_job.rb
create mode 100755 bin/sidekiq
create mode 100755 bin/sidekiqmon
create mode 100644 config/initializers/sidekiq.rb
create mode 100644 config/rails_env.rb-example
create mode 100644 config/sidekiq.service.example
create mode 100644 config/sidekiq.yml
diff --git a/.ruby-style.yml b/.ruby-style.yml
index fdb65ea814..34b5c4d9f4 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -26,6 +26,8 @@ AllCops:
- ".git/**/*"
- bin/bundle
- bin/rubocop
+ - bin/sidekiq
+ - bin/sidekiqmon
DisplayCopNames: false
StyleGuideCopsOnly: false
DisabledByDefault: true
diff --git a/Gemfile b/Gemfile
index 969146a9d3..8238652c8e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -111,10 +111,12 @@ gem 'rack-utf8_sanitizer', '~> 1.8.0'
gem 'recaptcha', '~> 5.12.3', require: 'recaptcha/rails'
gem 'matrix', '~> 0.4.2'
gem 'mini_magick', '~> 4.12.0'
+gem 'redis', '~> 4.8.1'
gem 'rolify', '~> 6.0.1'
gem 'ruby-msg', '~> 1.5.0', git: 'https://github.com/mysociety/ruby-msg.git', branch: 'ascii-encoding'
gem 'rubyzip', '~> 2.3.2'
gem 'secure_headers', '~> 6.5.0'
+gem 'sidekiq', '~> 6.5.8'
gem 'statistics2', '~> 0.54'
gem 'strip_attributes', git: 'https://github.com/mysociety/strip_attributes.git', branch: 'globalize3-rails7'
gem 'stripe', '~> 5.55.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 787c6f4d4b..de71292f8c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -170,7 +170,8 @@ GEM
xpath (~> 3.2)
charlock_holmes (0.7.7)
coderay (1.1.3)
- concurrent-ruby (1.2.0)
+ concurrent-ruby (1.2.2)
+ connection_pool (2.3.0)
crack (0.4.5)
rexml
crass (1.0.6)
@@ -207,7 +208,7 @@ GEM
flipper-active_record (0.24.1)
activerecord (>= 4.2, < 8)
flipper (~> 0.24.1)
- forwardable (1.3.2)
+ forwardable (1.3.3)
gender_detector (2.0.0)
gettext (3.4.3)
erubi
@@ -404,6 +405,7 @@ GEM
ffi (~> 1.0)
recaptcha (5.12.3)
json
+ redis (4.8.1)
regexp_parser (2.7.0)
representable (3.2.0)
declarative (< 0.1.0)
@@ -469,6 +471,10 @@ GEM
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
secure_headers (6.5.0)
+ sidekiq (6.5.8)
+ connection_pool (>= 2.2.5, < 3)
+ rack (~> 2.0)
+ redis (>= 4.5.0, < 5)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
@@ -599,6 +605,7 @@ DEPENDENCIES
rails-controller-testing
rails-i18n (~> 7.0.5)
recaptcha (~> 5.12.3)
+ redis (~> 4.8.1)
rolify (~> 6.0.1)
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
@@ -610,6 +617,7 @@ DEPENDENCIES
rubyzip (~> 2.3.2)
sass-rails (~> 5.0.8)
secure_headers (~> 6.5.0)
+ sidekiq (~> 6.5.8)
simplecov (~> 0.22.0)
simplecov-lcov (~> 0.7.0)
statistics2 (~> 0.54)
diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb
new file mode 100644
index 0000000000..7a81d6b20f
--- /dev/null
+++ b/app/jobs/application_job.rb
@@ -0,0 +1,13 @@
+class ApplicationJob < ActiveJob::Base # :nodoc:
+ # Automatically retry jobs that encountered a deadlock
+ retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer
+ # available
+ discard_on ActiveJob::DeserializationError
+
+ def self.perform_later(*args)
+ return super unless AlaveteliConfiguration.background_jobs == 'inline'
+ perform_now(*args)
+ end
+end
diff --git a/bin/sidekiq b/bin/sidekiq
new file mode 100755
index 0000000000..e7af7e7eb5
--- /dev/null
+++ b/bin/sidekiq
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'sidekiq' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("sidekiq", "sidekiq")
diff --git a/bin/sidekiqmon b/bin/sidekiqmon
new file mode 100755
index 0000000000..0c907984ee
--- /dev/null
+++ b/bin/sidekiqmon
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'sidekiqmon' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+bundle_binstub = File.expand_path("bundle", __dir__)
+
+if File.file?(bundle_binstub)
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
+ load(bundle_binstub)
+ else
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
+Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
+ end
+end
+
+require "rubygems"
+require "bundler/setup"
+
+load Gem.bin_path("sidekiq", "sidekiqmon")
diff --git a/config/application.rb b/config/application.rb
index bebb8ac6f1..b878c700ce 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -3,7 +3,7 @@
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
-# require "active_job/railtie"
+require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
@@ -70,6 +70,9 @@ class Application < Rails::Application
{ namespace: "#{AlaveteliConfiguration.domain}_#{RUBY_VERSION}" }
config.action_dispatch.rack_cache = nil
+ # Use a real queuing backend for Active Job
+ config.active_job.queue_adapter = :sidekiq
+
config.after_initialize do |app|
# Add a catch-all route to force routing errors to be handled by the application,
# rather than by middleware.
diff --git a/config/environments/test.rb b/config/environments/test.rb
index fb51a02272..b8109c174c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -26,6 +26,9 @@
config.action_controller.perform_caching = false
config.cache_store = :null_store
+ # Use inline processing for Active Job
+ config.active_job.queue_adapter = :test
+
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
diff --git a/config/general.yml-example b/config/general.yml-example
index 30dbf84cb7..5f3811de7e 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -1289,3 +1289,19 @@ SURVEY_URL: ''
#
# ---
USER_SIGN_IN_ACTIVITY_RETENTION_DAYS: 0
+
+# Background jobs are processed by Rails' ActiveJob using Sidekiq. There are
+# various ways to run Sidekiq depending to server resources and technical
+# knowledge in order to run and maintain a Redis server.
+#
+# Can either be set to:
+# - 'inline' to process jobs within the web application process, this was the
+# default option up until Alaveteli 0.42 and doesn't require Redis to be.
+# installed. Due to issues with requests with web requests timing out this has
+# been superseded by the other options.
+# - 'server' to process job by a server running as a system daemon.
+#
+# BACKGROUND_JOBS – String (default: 'server')
+#
+# ---
+BACKGROUND_JOBS: 'server'
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
new file mode 100644
index 0000000000..171e7d8c8e
--- /dev/null
+++ b/config/initializers/sidekiq.rb
@@ -0,0 +1,26 @@
+require File.expand_path('../load_env.rb', __dir__)
+
+def redis_config
+ { url: ENV['REDIS_URL'], password: ENV['REDIS_PASSWORD'] }.
+ merge(redis_sentinel_config)
+end
+
+def redis_sentinel_config
+ return {} unless ENV['REDIS_SENTINELS']
+
+ sentinels = ENV['REDIS_SENTINELS'].split(',').map do |ip_and_port|
+ ip, port = ip_and_port.split(/:(\d+)$/)
+ ip = Regexp.last_match[1] if ip =~ /\[(.*?)\]/
+ { host: ip, port: port&.to_i || 26_379 }
+ end
+
+ { sentinels: sentinels, role: :master }
+end
+
+Sidekiq.configure_client do |config|
+ config.redis = redis_config
+end
+
+Sidekiq.configure_server do |config|
+ config.redis = redis_config
+end
diff --git a/config/packages b/config/packages
index cc263a015f..fbccd7733a 100644
--- a/config/packages
+++ b/config/packages
@@ -26,6 +26,7 @@ pdftk (>> 1.41+dfsg-1) | pdftk (<< 1.41+dfsg-1) # that version has a non-functio
poppler-utils
rake (>= 0.9.2.2)
rdoc
+redis
ruby
ruby-dev
sqlite3
diff --git a/config/packages.generic b/config/packages.generic
index 8fc93212d4..c57c7f05a0 100644
--- a/config/packages.generic
+++ b/config/packages.generic
@@ -22,6 +22,7 @@ poppler-utils
postgresql
postgresql-client
rake
+redis
ruby
ruby-dev
sqlite3
diff --git a/config/packages.ubuntu-focal b/config/packages.ubuntu-focal
index 3d110d05da..cdf44a01b9 100644
--- a/config/packages.ubuntu-focal
+++ b/config/packages.ubuntu-focal
@@ -22,6 +22,7 @@ poppler-utils
postgresql
postgresql-client
rake
+redis
ruby
ruby-dev
sqlite3
diff --git a/config/rails_env.rb-example b/config/rails_env.rb-example
new file mode 100644
index 0000000000..98950617ae
--- /dev/null
+++ b/config/rails_env.rb-example
@@ -0,0 +1 @@
+# This file is needed for the mySociety deployment system
diff --git a/config/routes.rb b/config/routes.rb
index 2c3ac6875f..c7c4ef7db5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,6 +4,8 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
+require 'sidekiq/web'
+
include AlaveteliFeatures::Constraints
# Allow easy extension from themes. Note these will have the highest priority.
@@ -11,8 +13,18 @@
load File.join('config', f)
end
+class AdminConstraint # :nodoc:
+ def matches?(request)
+ user = User.find_by(
+ id: request.session[:user_id],
+ login_token: request.session[:user_login_token]
+ )
+ user && user.is_admin?
+ end
+end
+
Rails.application.routes.draw do
- admin_constraint = lambda { |request| request.session[:using_admin] }
+ mount Sidekiq::Web => '/sidekiq', constraints: AdminConstraint.new
root to: 'general#frontpage'
diff --git a/config/sidekiq.service.example b/config/sidekiq.service.example
new file mode 100644
index 0000000000..167d7c8200
--- /dev/null
+++ b/config/sidekiq.service.example
@@ -0,0 +1,22 @@
+[Unit]
+Description=<%= daemon_name %>
+After=syslog.target network.target
+
+[Service]
+Type=notify
+
+WatchdogSec=10
+
+User=<%= user %>
+Group=<%= user %>
+UMask=0002
+
+WorkingDirectory=<%= vhost_dir %>/<%= vcspath %>
+
+ExecStart=/bin/bash -lc 'bundle exec sidekiq -e <%= rails_env %>'
+
+RestartSec=1
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/config/sidekiq.yml b/config/sidekiq.yml
new file mode 100644
index 0000000000..8c67045671
--- /dev/null
+++ b/config/sidekiq.yml
@@ -0,0 +1,6 @@
+development:
+ :concurrency: 1
+production:
+ :concurrency: 1
+:queues:
+ - default
diff --git a/config/test.yml b/config/test.yml
index ff5c415084..1f596a1600 100644
--- a/config/test.yml
+++ b/config/test.yml
@@ -120,3 +120,5 @@ MAX_REQUESTS_PER_USER_PER_DAY: 2
SKIP_ADMIN_AUTH: true
UTILITY_SEARCH_PATH: []
+
+BACKGROUND_JOBS: 'server'
diff --git a/docker-compose.yml b/docker-compose.yml
index a1a3f3a515..ff32e651a1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,6 +10,7 @@ services:
environment:
- BUNDLE_PATH=/bundle/vendor
- DATABASE_URL=postgres://postgres:password@db/
+ - REDIS_URL=redis://redis:6379
ports:
- 3000:3000
- 1080:1080
@@ -19,6 +20,26 @@ services:
- bundle:/bundle
depends_on:
- db
+ - redis
+
+ sidekiq:
+ build:
+ context: .
+ dockerfile: docker/Dockerfile
+ args:
+ RUBY_VERSION: '${RUBY_VERSION:-3.0}'
+ command: bundle exec sidekiq
+ volumes:
+ - ./:/alaveteli
+ - ../alaveteli-themes:/alaveteli-themes
+ - bundle:/bundle
+ environment:
+ - BUNDLE_PATH=/bundle/vendor
+ - DATABASE_URL=postgres://postgres:password@db/
+ - REDIS_URL=redis://redis:6379
+ depends_on:
+ - 'db'
+ - 'redis'
db:
build:
@@ -31,6 +52,13 @@ services:
volumes:
- postgres:/var/lib/postgresql/data
+ redis:
+ image: library/redis
+ command: redis-server
+ volumes:
+ - redis:/data
+
volumes:
bundle: {}
postgres: {}
+ redis: {}
diff --git a/lib/configuration.rb b/lib/configuration.rb
index 554b680493..84b57c13fb 100644
--- a/lib/configuration.rb
+++ b/lib/configuration.rb
@@ -21,6 +21,7 @@ module AlaveteliConfiguration
ADMIN_USERNAME: '',
AUTHORITY_MUST_RESPOND: true,
AVAILABLE_LOCALES: 'en',
+ BACKGROUND_JOBS: 'server',
BLACKHOLE_PREFIX: 'do-not-reply-to-this-address',
BLOCK_RATE_LIMITED_IPS: false,
BLOCK_RESTRICTED_COUNTRY_IPS: false,
@@ -135,6 +136,12 @@ module AlaveteliConfiguration
# rubocop:enable Layout/LineLength
end
+ def self.background_jobs
+ value = MySociety::Config.get('BACKGROUND_JOBS', DEFAULTS[:BACKGROUND_JOBS])
+ return value if %w[inline server].include?(value)
+ raise 'Unknown value for BACKGROUND_JOBS. Please check config/general.yml'
+ end
+
def self.method_missing(name)
key = name.to_s.upcase
if DEFAULTS.has_key?(key.to_sym)
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 3619bd0f66..5dfa0cbb99 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -64,6 +64,12 @@ namespace :config_files do
condition: -> do
AlaveteliConfiguration.production_mailer_retriever_method == 'pop'
end
+ },
+ {
+ path: '/etc/systemd/system',
+ name: 'sidekiq.service',
+ template: 'config/sidekiq.service.example',
+ condition: -> { AlaveteliConfiguration.background_jobs == 'server' }
}
]
end
From eb4a5cca7e37a442072eb738a8682cbcc52e039e Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 15 Feb 2023 17:32:53 +0000
Subject: [PATCH 160/289] Add background job for expiring requests
Job to expire requests when censor rules are created/updated and when
requester/public body URL name has changed.
---
app/jobs/info_request_expire_job.rb | 25 +++++++++++
app/models/censor_rule.rb | 10 ++---
app/models/public_body.rb | 2 +-
app/models/user.rb | 2 +-
spec/integration/admin_censor_rule_spec.rb | 26 +++++++++++
spec/jobs/info_request_expire_job_spec.rb | 51 ++++++++++++++++++++++
spec/models/censor_rule_spec.rb | 25 +++++------
spec/models/public_body_spec.rb | 17 +++-----
spec/models/user_spec.rb | 14 ++----
spec/models/xapian_spec.rb | 7 +++
10 files changed, 135 insertions(+), 44 deletions(-)
create mode 100644 app/jobs/info_request_expire_job.rb
create mode 100644 spec/jobs/info_request_expire_job_spec.rb
diff --git a/app/jobs/info_request_expire_job.rb b/app/jobs/info_request_expire_job.rb
new file mode 100644
index 0000000000..394d21bf1f
--- /dev/null
+++ b/app/jobs/info_request_expire_job.rb
@@ -0,0 +1,25 @@
+##
+# Job to expire InfoRequest objects. Can expire single requests, all requests or
+# a collection of requests through an model associations.
+#
+# Examples:
+# InfoRequestExpireJob.perform(InfoRequest.first)
+# InfoRequestExpireJob.perform(InfoRequest, :all)
+# InfoRequestExpireJob.perform(PublicBody.first, :info_requests)
+#
+class InfoRequestExpireJob < ApplicationJob
+ queue_as :default
+
+ def perform(object, method = nil)
+ return object.expire if object.is_a?(InfoRequest)
+
+ if object == InfoRequest && method == :all
+ enumerator = InfoRequest.all
+ else
+ association = object.association(method)
+ enumerator = association.reader if association.klass == InfoRequest
+ end
+
+ enumerator.find_each { |request| perform(request) }
+ end
+end
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index 71e319f30c..0e42ce3ea5 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -74,15 +74,13 @@ def is_global?
def expire_requests
if info_request
- info_request.expire
+ InfoRequestExpireJob.perform_later(info_request)
elsif user
- user.expire_requests
+ InfoRequestExpireJob.perform_later(user, :info_requests)
elsif public_body
- public_body.expire_requests
+ InfoRequestExpireJob.perform_later(public_body, :info_requests)
else # global rule
- InfoRequest.find_in_batches do |group|
- group.each(&:expire)
- end
+ InfoRequestExpireJob.perform_later(InfoRequest, :all)
end
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 3154a0c8dc..ec91425ef1 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -705,7 +705,7 @@ def json_for_api
end
def expire_requests
- info_requests.find_each(&:expire)
+ InfoRequestExpireJob.perform_later(self, :info_requests)
end
def self.where_clause_for_stats(minimum_requests, total_column)
diff --git a/app/models/user.rb b/app/models/user.rb
index f4cb040c71..60652b8ef8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -327,7 +327,7 @@ def reindex_referencing_models
end
def expire_requests
- info_requests.find_each(&:expire)
+ InfoRequestExpireJob.perform_later(self, :info_requests)
end
def expire_comments
diff --git a/spec/integration/admin_censor_rule_spec.rb b/spec/integration/admin_censor_rule_spec.rb
index 97c3eb11f9..e8a4e8f687 100644
--- a/spec/integration/admin_censor_rule_spec.rb
+++ b/spec/integration/admin_censor_rule_spec.rb
@@ -2,6 +2,8 @@
require 'integration/alaveteli_dsl'
RSpec.describe 'Updating censor rules' do
+ include ActiveJob::TestHelper
+
let!(:admin) do
confirm(:admin_user)
login(:admin_user)
@@ -57,6 +59,8 @@
click_button 'Create'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a rubbish answer for you"
expect(page).to have_content "I have [REDACTED] for you"
@@ -81,6 +85,8 @@
click_button 'Save'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish [REDACTED] for you"
@@ -102,6 +108,8 @@
click_link 'Destroy censor rule'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish answer for you"
@@ -125,6 +133,8 @@
click_button 'Create'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a rubbish answer for you"
expect(page).to have_content "I have [REDACTED] for you"
@@ -149,6 +159,8 @@
click_button 'Save'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish [REDACTED] for you"
@@ -170,6 +182,8 @@
click_link 'Destroy censor rule'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish answer for you"
@@ -194,6 +208,8 @@
click_button 'Create'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a rubbish answer for you"
expect(page).to have_content "I have [REDACTED] for you"
@@ -219,6 +235,8 @@
click_button 'Save'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish [REDACTED] for you"
@@ -241,6 +259,8 @@
click_link 'Destroy censor rule'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish answer for you"
@@ -264,6 +284,8 @@
click_button 'Create'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a rubbish answer for you"
expect(page).to have_content "I have [REDACTED] for you"
@@ -287,6 +309,8 @@
click_button 'Save'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish [REDACTED] for you"
@@ -307,6 +331,8 @@
click_link 'Destroy censor rule'
end
+ perform_enqueued_jobs
+
visit show_request_path url_title: url_title
expect(page).not_to have_content "I have a [REDACTED] answer for you"
expect(page).to have_content "I have a rubbish answer for you"
diff --git a/spec/jobs/info_request_expire_job_spec.rb b/spec/jobs/info_request_expire_job_spec.rb
new file mode 100644
index 0000000000..ab875aafa4
--- /dev/null
+++ b/spec/jobs/info_request_expire_job_spec.rb
@@ -0,0 +1,51 @@
+require 'spec_helper'
+
+RSpec.describe InfoRequestExpireJob, type: :job do
+ let(:args) { [] }
+ subject(:perform) { described_class.new.perform(*args) }
+
+ let(:request_1) { FactoryBot.build(:info_request) }
+ let(:request_2) { FactoryBot.build(:info_request) }
+
+ context 'when called with a request' do
+ let(:args) { [request_1] }
+
+ it 'calls expire on the request' do
+ expect(request_1).to receive(:expire)
+ perform
+ end
+ end
+
+ context 'when called with an object with a info_requests association' do
+ let(:user) do
+ FactoryBot.build(:user, info_requests: [request_1, request_2])
+ end
+
+ let(:args) { [user, :info_requests] }
+
+ it 'calls expire on the associated requests' do
+ association = double(klass: InfoRequest)
+ allow(user).to receive(:association).with(:info_requests).
+ and_return(association)
+ allow(association).to receive_message_chain(:reader, :find_each).
+ and_yield(request_1).and_yield(request_2)
+
+ expect(request_1).to receive(:expire)
+ expect(request_2).to receive(:expire)
+ perform
+ end
+ end
+
+ context 'when called with the InfoRequest class' do
+ let(:args) { [InfoRequest, :all] }
+
+ it 'calls expire on the all requests' do
+ allow(InfoRequest).to receive_message_chain(:all, :find_each).
+ and_yield(request_1).and_yield(request_2)
+
+ expect(request_1).to receive(:expire)
+ expect(request_2).to receive(:expire)
+ perform
+ end
+ end
+end
diff --git a/spec/models/censor_rule_spec.rb b/spec/models/censor_rule_spec.rb
index 0d165521fd..7ca697f288 100644
--- a/spec/models/censor_rule_spec.rb
+++ b/spec/models/censor_rule_spec.rb
@@ -160,37 +160,34 @@
describe '#expire_requests' do
- it 'calls expire on the request if it is a request rule' do
+ it 'create expire job for the request if it is a request rule' do
request = FactoryBot.create(:info_request)
rule = FactoryBot.create(:info_request_censor_rule,
info_request: request)
- expect(request).to receive(:expire)
+ expect(InfoRequestExpireJob).to receive(:perform_later).with(request)
rule.expire_requests
end
- it 'calls expire_requests on the user if it is a user rule' do
+ it 'create expire job for the user if it is a user rule' do
user = FactoryBot.create(:user)
rule = FactoryBot.create(:user_censor_rule, user: user)
- expect(user).to receive(:expire_requests)
+ expect(InfoRequestExpireJob).to receive(:perform_later).
+ with(user, :info_requests)
rule.expire_requests
end
- it 'calls expire_requests on the public body if it is a public body rule' do
+ it 'create expire job for the public body if it is a public body rule' do
body = FactoryBot.create(:public_body)
rule = FactoryBot.create(:public_body_censor_rule, public_body: body)
- expect(body).to receive(:expire_requests)
+ expect(InfoRequestExpireJob).to receive(:perform_later).
+ with(body, :info_requests)
rule.expire_requests
end
- it 'calls expire on all public requests if it is a global rule' do
+ it 'create expire job for all requests if it is a global rule' do
rule = FactoryBot.build(:global_censor_rule)
- requests = [double, double]
- expect(InfoRequest).to receive(:find_in_batches).and_yield(requests)
-
- requests.each do |request|
- expect(request).to receive(:expire)
- end
-
+ expect(InfoRequestExpireJob).to receive(:perform_later).
+ with(InfoRequest, :all)
rule.expire_requests
end
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 45dab953a3..6c61f5aaa9 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -753,18 +753,10 @@
end
describe '#expire_requests' do
- it 'calls expire on all associated requests' do
+ it 'create expire job for the public body' do
public_body = FactoryBot.build(:public_body)
-
- request_1 = double(:info_request)
- request_2 = double(:info_request)
-
- allow(public_body).to receive_message_chain(:info_requests, :find_each).
- and_yield(request_1).and_yield(request_2)
-
- expect(request_1).to receive(:expire)
- expect(request_2).to receive(:expire)
-
+ expect(InfoRequestExpireJob).to receive(:perform_later).
+ with(public_body, :info_requests)
public_body.expire_requests
end
end
@@ -1109,6 +1101,8 @@
end
RSpec.describe PublicBody, " when saving" do
+ include ActiveJob::TestHelper
+
before do
@public_body = PublicBody.new
end
@@ -1191,6 +1185,7 @@ def set_default_attributes(public_body)
ActsAsXapian::ActsAsXapianJob.destroy_all
body.update!(url_name: 'baz-bar-foo')
+ perform_enqueued_jobs
expected_events =
ActsAsXapian::ActsAsXapianJob.
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index a098be54a1..645b844163 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -791,18 +791,10 @@ def create_user(options = {})
end
describe '#expire_requests' do
- it 'calls expire on all associated requests' do
+ it 'create expire job for the user' do
user = FactoryBot.build(:user)
-
- request_1 = double(:info_request)
- request_2 = double(:info_request)
-
- allow(user).to receive_message_chain(:info_requests, :find_each).
- and_yield(request_1).and_yield(request_2)
-
- expect(request_1).to receive(:expire)
- expect(request_2).to receive(:expire)
-
+ expect(InfoRequestExpireJob).to receive(:perform_later).
+ with(user, :info_requests)
user.expire_requests
end
end
diff --git a/spec/models/xapian_spec.rb b/spec/models/xapian_spec.rb
index 2e39e45aea..60773b98b6 100644
--- a/spec/models/xapian_spec.rb
+++ b/spec/models/xapian_spec.rb
@@ -67,6 +67,8 @@
RSpec.describe PublicBody, " when indexing requests by body they are to" do
+ include ActiveJob::TestHelper
+
before(:each) do
load_raw_emails_data
update_xapian_index
@@ -88,6 +90,7 @@
body.short_name = 'GQ'
body.save!
expect(body.url_name).to eq('gq')
+ perform_enqueued_jobs
update_xapian_index
# check we get results expected
@@ -108,6 +111,7 @@
body.short_name = 'The Uncensored, Complete Name of the Quasi-Autonomous Public Body Also Known As Geraldine'
body.save!
expect(body.url_name.size).to be > 70
+ perform_enqueued_jobs
update_xapian_index
# check we get results expected
@@ -122,6 +126,8 @@
end
RSpec.describe User, " when indexing requests by user they are from" do
+ include ActiveJob::TestHelper
+
before(:each) do
load_raw_emails_data
update_xapian_index
@@ -243,6 +249,7 @@
u.name = 'Robert Smith'
u.save!
expect(u.url_name).to eq('robert_smith')
+ perform_enqueued_jobs
update_xapian_index
# check we get results expected
From b64f99c7a244552d1f67b4e8bf642bdf58110bfe Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 27 Feb 2023 04:58:29 +0000
Subject: [PATCH 161/289] Build(deps-dev): Bump rubocop-rails from 2.17.4 to
2.18.0
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.17.4 to 2.18.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.17.4...v2.18.0)
---
updated-dependencies:
- dependency-name: rubocop-rails
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 3 +++
Gemfile.lock | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index fdb65ea814..700b99e505 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -1313,6 +1313,9 @@ Rails/RequestReferer:
Rails/RequireDependency:
Enabled: false
+Rails/ResponseParsedBody:
+ Enabled: false
+
Rails/ReversibleMigration:
Enabled: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 787c6f4d4b..eae3bda673 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -170,7 +170,7 @@ GEM
xpath (~> 3.2)
charlock_holmes (0.7.7)
coderay (1.1.3)
- concurrent-ruby (1.2.0)
+ concurrent-ruby (1.2.2)
crack (0.4.5)
rexml
crass (1.0.6)
@@ -454,7 +454,7 @@ GEM
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
- rubocop-rails (2.17.4)
+ rubocop-rails (2.18.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
From 0510d63c17660fc6856bad5e36c5b058eba6c6c3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 6 Mar 2023 04:57:24 +0000
Subject: [PATCH 162/289] Build(deps-dev): Bump rubocop from 1.45.1 to 1.48.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.45.1 to 1.48.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.45.1...v1.48.0)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 9 +++++++++
Gemfile | 2 +-
Gemfile.lock | 10 +++++-----
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index fdb65ea814..9bcf093122 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -807,6 +807,9 @@ Metrics/BlockNesting:
Metrics/ClassLength:
Enabled: false
+Metrics/CollectionLiteralLength:
+ Enabled: false
+
Metrics/CyclomaticComplexity:
Enabled: false
@@ -1556,6 +1559,9 @@ Style/DefWithParentheses:
Style/Dir:
Enabled: false
+Style/DirEmpty:
+ Enabled: false
+
Style/DisableCopsWithinSourceCodeDirective:
Enabled: false
@@ -1635,6 +1641,9 @@ Style/ExponentialNotation:
Style/FetchEnvVar:
Enabled: false
+Style/FileEmpty:
+ Enabled: false
+
Style/FileRead:
Enabled: false
diff --git a/Gemfile b/Gemfile
index 969146a9d3..fcf7838a75 100644
--- a/Gemfile
+++ b/Gemfile
@@ -188,7 +188,7 @@ group :development do
gem 'launchy', '< 2.6.0'
gem 'listen', '>= 3.0.5', '< 3.8.1'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.45.1', require: false
+ gem 'rubocop', '~> 1.48.0', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 787c6f4d4b..4e7e80287c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -439,17 +439,17 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.45.1)
+ rubocop (1.48.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.24.1, < 2.0)
+ rubocop-ast (>= 1.26.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.26.0)
+ rubocop-ast (1.27.0)
parser (>= 3.2.1.0)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
@@ -459,7 +459,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-ole (1.2.12.1)
- ruby-progressbar (1.11.0)
+ ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sass (3.4.25)
sass-rails (5.0.8)
@@ -603,7 +603,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.45.1)
+ rubocop (~> 1.48.0)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From 11de6d21f623a8513d5343948b0e7bab0bc29109 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 7 Mar 2023 18:16:02 +0000
Subject: [PATCH 163/289] Add daily limit to user message creation
Follows the same pattern as comments.
---
app/models/user.rb | 9 ++-------
app/views/users/messages/rate_limited.html.erb | 15 +++++++++++++--
doc/CHANGES.md | 1 +
spec/models/user_spec.rb | 9 ++++++++-
4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 5fd869c4ce..77d930107e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -49,7 +49,8 @@ class User < ApplicationRecord
CONTENT_LIMIT = {
info_requests: AlaveteliConfiguration.max_requests_per_user_per_day,
- comments: AlaveteliConfiguration.max_requests_per_user_per_day
+ comments: AlaveteliConfiguration.max_requests_per_user_per_day,
+ user_messages: AlaveteliConfiguration.max_requests_per_user_per_day
}.freeze
rolify before_add: :setup_pro_account,
@@ -469,8 +470,6 @@ def can_contact_other_users?
end
def exceeded_limit?(content)
- return exceeded_user_message_limit? if content == :user_messages
-
return false if no_limit?
return false if can_make_batch_requests?
return false if content_limit(content).blank?
@@ -682,8 +681,4 @@ def update_pro_account
def content_limit(content)
CONTENT_LIMIT[content]
end
-
- def exceeded_user_message_limit?
- false
- end
end
diff --git a/app/views/users/messages/rate_limited.html.erb b/app/views/users/messages/rate_limited.html.erb
index 70271df2d0..15771d8aeb 100644
--- a/app/views/users/messages/rate_limited.html.erb
+++ b/app/views/users/messages/rate_limited.html.erb
@@ -1,7 +1,18 @@
-<% @title = _('Cannot send messages') %>
+<% @title = _('Too many messages') %>
<%= @title %>
- <%= _('User messages cannot be sent right now. Please try again later.') %>
+ <%= _('You have hit the rate limit on user messages. Users are ordinarily ' \
+ 'limited to {{message_limit}} messages per day.',
+ message_limit: User::CONTENT_LIMIT[:user_messages]) %>
+
+
+
+ <%= _("There is a limit on the number of messages you can send in a day " \
+ "because we don’t want users to be bombarded with " \
+ "large numbers of inappropriate messages. If you feel you have a " \
+ "good reason to ask for the limit to be lifted in your case, " \
+ "please get in touch.",
+ help_contact_path: help_contact_path) %>
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index bb38ad1d5e..d01ebc4b6e 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,7 @@
## Highlighted Features
+* Add daily limit to user message creation (Gareth Rees)
* Add rate limiting to comment creation (Gareth Rees)
* Fix bug preventing ex-pro users follow up to still-private requests (Gareth
Rees, Graeme Porteous)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 7e08f5fb35..179b343872 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -2039,10 +2039,17 @@ def create_user(options = {})
context 'limiting user messages' do
let(:content) { :user_messages }
+ before { FactoryBot.create(:user_message, user: user) }
- it 'always returns false' do
+ it 'returns false if the user has not submitted more than the limit' do
+ allow(user).to receive(:content_limit).with(content).and_return(2)
expect(subject).to eq(false)
end
+
+ it 'returns true if the user has submitted more than the limit' do
+ allow(user).to receive(:content_limit).with(content).and_return(0)
+ expect(subject).to eq(true)
+ end
end
end
end
From c77640ae043526c343ee6a251b057a97bbdc45f1 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 10 Mar 2023 09:44:50 +0000
Subject: [PATCH 164/289] Fix Project request extractable scope
Requests were being returned in this scope when they has already been
extracted. This was due to the query matching the extract submission for
different project.
Moving the project conditional from the `WHERE NOT` into the `LEFT JOIN`
limits the submission objects we're inspecting to the current project.
Fixes #7631
---
app/models/project/info_request_extension.rb | 16 +++++++++-----
spec/models/project_spec.rb | 23 ++++++++++++++++++--
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/app/models/project/info_request_extension.rb b/app/models/project/info_request_extension.rb
index d749800067..750801ec1c 100644
--- a/app/models/project/info_request_extension.rb
+++ b/app/models/project/info_request_extension.rb
@@ -15,13 +15,17 @@ def classified
end
def extractable
- scope = where(described_state: EXTRACTABLE_STATES).
- left_joins(:extraction_project_submissions).
+ where(described_state: EXTRACTABLE_STATES).
+ joins(
+ <<~SQL.squish
+ LEFT OUTER JOIN "project_submissions" ON
+ "project_submissions"."resource_type" = 'Dataset::ValueSet' AND
+ "project_submissions"."info_request_id" = "info_requests"."id" AND
+ "project_submissions"."project_id" = #{project.id}
+ SQL
+ ).
+ where(project_submissions: { id: nil }).
classified
-
- scope.where(project_submissions: { id: nil }).or(
- scope.where.not(project_submissions: { project: project })
- )
end
def extracted
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index d8b8180514..0d59ac252a 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -35,14 +35,14 @@
FactoryBot.create(
:project, requests: [
unclassified_request, classified_request, extracted_request,
- other_project_extracted_request
+ other_project_extracted_request, both_projects_extracted_request
]
)
end
let(:other_project) do
FactoryBot.create(
:project, requests: [
- other_project_extracted_request
+ other_project_extracted_request, both_projects_extracted_request
]
)
end
@@ -69,6 +69,13 @@
described_state: 'successful'
)
end
+ let(:both_projects_extracted_request) do
+ FactoryBot.build(
+ :info_request,
+ awaiting_description: false,
+ described_state: 'successful'
+ )
+ end
before do
FactoryBot.create(
@@ -83,6 +90,14 @@
:project_submission, :for_extraction,
project: other_project, info_request: other_project_extracted_request
)
+ FactoryBot.create(
+ :project_submission, :for_extraction,
+ project: project, info_request: both_projects_extracted_request
+ )
+ FactoryBot.create(
+ :project_submission, :for_extraction,
+ project: other_project, info_request: both_projects_extracted_request
+ )
end
end
@@ -364,6 +379,10 @@
it 'includes requests extracted in other projects' do
is_expected.to include other_project_extracted_request
end
+
+ it 'excludes requests extracted in both projects' do
+ is_expected.not_to include both_projects_extracted_request
+ end
end
describe '#info_requests.extracted' do
From 9f26e490bcd75a45d3ce3d9373faee52eddb4779 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 13 Mar 2023 04:59:16 +0000
Subject: [PATCH 165/289] Build(deps-dev): Bump net-ssh from 7.0.1 to 7.1.0
Bumps [net-ssh](https://github.com/net-ssh/net-ssh) from 7.0.1 to 7.1.0.
- [Release notes](https://github.com/net-ssh/net-ssh/releases)
- [Changelog](https://github.com/net-ssh/net-ssh/blob/master/CHANGES.txt)
- [Commits](https://github.com/net-ssh/net-ssh/compare/v7.0.1...v7.1.0)
---
updated-dependencies:
- dependency-name: net-ssh
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 657a313781..bb5c05bf50 100644
--- a/Gemfile
+++ b/Gemfile
@@ -185,7 +185,7 @@ end
group :development do
gem 'annotate', '< 3.2.1'
gem 'capistrano', '~> 2.15.0', '< 3.0.0'
- gem 'net-ssh', '~> 7.0.1'
+ gem 'net-ssh', '~> 7.1.0'
gem 'net-ssh-gateway', '>= 1.1.0', '< 3.0.0'
gem 'launchy', '< 2.6.0'
gem 'listen', '>= 3.0.5', '< 3.8.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 6dd3671a86..641cbcd83b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -328,7 +328,7 @@ GEM
net-ssh (>= 2.6.5)
net-smtp (0.3.3)
net-protocol
- net-ssh (7.0.1)
+ net-ssh (7.1.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
nio4r (2.5.8)
@@ -592,7 +592,7 @@ DEPENDENCIES
mini_magick (~> 4.12.0)
mini_racer (~> 0.6.3)
money (~> 6.16.0)
- net-ssh (~> 7.0.1)
+ net-ssh (~> 7.1.0)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
nokogiri (~> 1.14.1)
oink (~> 0.10.1)
From 3e261c233e07d55a0162a6f5d6dbc4cb03562d44 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Mar 2023 14:48:34 +0000
Subject: [PATCH 166/289] Refactor blog specs
Place specs under an single top-level describe block and within that a
'GET blog' describe and context blocks. Increasing the indentation where
needed.
Also rewrites `context` and `it` titles to match current style, EG:
`context "when ..."` and remove `it "should"`
These specs will soon be rewritten with further refactoring.
---
spec/controllers/general_controller_spec.rb | 110 +++++++++++---------
1 file changed, 63 insertions(+), 47 deletions(-)
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 3ced23cfd9..bf0fd7b66f 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -21,69 +21,85 @@
expect(response.media_type).to eq('application/json')
end
end
-end
-RSpec.describe GeneralController, "when trying to show the blog" do
- it "should fail silently if the blog is returning an error" do
- allow(AlaveteliConfiguration).to receive(:blog_feed).
- and_return("http://blog.example.com")
- stub_request(:get, %r|blog.example.com|).to_return(status: 500)
- get :blog
- expect(response.status).to eq(200)
- expect(assigns[:blog_items].count).to eq(0)
- end
-end
+ describe 'GET blog' do
+ context 'when feed is configured' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ allow(controller).to receive(:quietly_try_to_open).and_return('')
+ end
-RSpec.describe GeneralController, 'when getting the blog feed' do
+ it 'adds lang query param correctly' do
+ get :blog
+ expect(assigns[:feed_url]).to eq('http://blog.example.com?lang=en')
+ end
+ end
- before do
- allow(AlaveteliConfiguration).to receive(:blog_feed).and_return("http://blog.example.com")
- # Don't call out to external url during tests
- allow(controller).to receive(:quietly_try_to_open).and_return('')
- end
+ context 'when feed is configured with existing query param' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com?alt=rss')
+ allow(controller).to receive(:quietly_try_to_open).and_return('')
+ end
- it 'should add a lang param correctly to a url with no querystring' do
- get :blog
- expect(assigns[:feed_url]).to eq("http://blog.example.com?lang=en")
- end
+ it 'adds lang query param correctly' do
+ get :blog
+ expect(assigns[:feed_url]).to eq(
+ 'http://blog.example.com?alt=rss&lang=en'
+ )
+ end
+ end
- it 'should add a lang param correctly to a url with an existing querystring' do
- allow(AlaveteliConfiguration).to receive(:blog_feed).and_return("http://blog.example.com?alt=rss")
- get :blog
- expect(assigns[:feed_url]).to eq("http://blog.example.com?alt=rss&lang=en")
- end
+ context 'when blog has entries' do
+ render_views
- it 'should parse an item from an example feed' do
- allow(controller).to receive(:quietly_try_to_open).and_return(load_file_fixture("blog_feed.atom"))
- get :blog
- expect(assigns[:blog_items].count).to eq(1)
- end
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ allow(controller).to receive(:quietly_try_to_open).
+ and_return(load_file_fixture('blog_feed.atom'))
+ end
- context 'if no feed is configured' do
+ it 'parses item from an example feed' do
+ get :blog
+ expect(assigns[:blog_items].count).to eq(1)
+ end
- before do
- allow(AlaveteliConfiguration).to receive(:blog_feed).and_return('')
+ it 'escapes any javascript from the entries' do
+ get :blog
+ expect(response.body).not_to include(
+ ''
+ )
+ end
end
- it 'should raise an ActiveRecord::RecordNotFound error' do
- expect {
+ context 'when feed returns an error' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ stub_request(:get, %r|blog.example.com|).to_return(status: 500)
+ end
+
+ it 'should fail silently if the blog is returning an error' do
get :blog
- }.to raise_error(ActiveRecord::RecordNotFound)
+ expect(response.status).to eq(200)
+ expect(assigns[:blog_items].count).to eq(0)
+ end
end
- end
- context 'when the blog has entries' do
-
- render_views
+ context 'when feed is not configured' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).and_return('')
+ end
- it 'should escape any javascript from the entries' do
- allow(controller).to receive(:quietly_try_to_open).and_return(load_file_fixture("blog_feed.atom"))
- get :blog
- expect(response.body).not_to include('')
+ it 'should raise an ActiveRecord::RecordNotFound error' do
+ expect {
+ get :blog
+ }.to raise_error(ActiveRecord::RecordNotFound)
+ end
end
-
end
-
end
RSpec.describe GeneralController, "when showing the frontpage" do
From 0de57394cdab7ec3b225ad943e94efe4373c88b3 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Mar 2023 15:00:13 +0000
Subject: [PATCH 167/289] Add Blog.enabled?
This helper method can be used instead of checking the configuration
through the codebase.
---
app/controllers/general_controller.rb | 4 +---
app/models/blog.rb | 13 ++++++++++
.../alaveteli_pro/general/_nav_items.html.erb | 2 +-
app/views/general/_nav_items.html.erb | 2 +-
spec/models/blog_spec.rb | 24 +++++++++++++++++++
5 files changed, 40 insertions(+), 5 deletions(-)
create mode 100644 app/models/blog.rb
create mode 100644 spec/models/blog_spec.rb
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 1b8e4af052..d55e695fc4 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -29,9 +29,7 @@ def frontpage
# Display blog entries
def blog
- if AlaveteliConfiguration.blog_feed.empty?
- raise ActiveRecord::RecordNotFound, "Page not enabled"
- end
+ raise(ActiveRecord::RecordNotFound, "Page not enabled") unless Blog.enabled?
medium_cache
diff --git a/app/models/blog.rb b/app/models/blog.rb
new file mode 100644
index 0000000000..4f6a660037
--- /dev/null
+++ b/app/models/blog.rb
@@ -0,0 +1,13 @@
+##
+# Class responsible for loading external blog content
+#
+# Requires `BLOG_FEED` to be configured in config/general.yml
+#
+# Currently WordPress is the only "officially supported" external blog feed,
+# but other feeds may work if they use the same data format.
+#
+class Blog
+ def self.enabled?
+ AlaveteliConfiguration.blog_feed.present?
+ end
+end
diff --git a/app/views/alaveteli_pro/general/_nav_items.html.erb b/app/views/alaveteli_pro/general/_nav_items.html.erb
index 7147aca890..b2f5662b4c 100644
--- a/app/views/alaveteli_pro/general/_nav_items.html.erb
+++ b/app/views/alaveteli_pro/general/_nav_items.html.erb
@@ -39,7 +39,7 @@
AnalyticsEvent::Action::PRO_NAV_VIEW_AUTHORITIES) %>
-<% unless AlaveteliConfiguration::blog_feed.empty? %>
+<% if Blog.enabled? %>
-<% unless AlaveteliConfiguration::blog_feed.empty? %>
+<% if Blog.enabled? %>
<%= link_to _("Read blog"), blog_path %>
<% end %>
diff --git a/spec/models/blog_spec.rb b/spec/models/blog_spec.rb
new file mode 100644
index 0000000000..2d19109e4c
--- /dev/null
+++ b/spec/models/blog_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+RSpec.describe Blog do
+ describe '.enabled?' do
+ subject { described_class.enabled? }
+
+ context 'when feed is configured' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when feed is not configured' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).and_return('')
+ end
+
+ it { is_expected.to eq(false) }
+ end
+ end
+end
From 1a7b9c7ad01a56df5098da95cb6e93faf2e984b5 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Mar 2023 15:00:42 +0000
Subject: [PATCH 168/289] Refactor Blog content loading
Move out of the controller into the Blog class. Minial changes made to
keep the implementation and current specs working.
Further refactoring of the specs will come next.
---
app/controllers/general_controller.rb | 27 ++---------------
app/models/blog.rb | 32 +++++++++++++++++++++
app/views/general/blog.html.erb | 2 +-
spec/controllers/general_controller_spec.rb | 20 ++++++++-----
spec/views/general/blog.html.erb_spec.rb | 2 +-
5 files changed, 49 insertions(+), 34 deletions(-)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index d55e695fc4..ea19c533de 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -32,33 +32,10 @@ def blog
raise(ActiveRecord::RecordNotFound, "Page not enabled") unless Blog.enabled?
medium_cache
-
- get_blog_content
- end
-
- def get_blog_content
- @feed_autodetect = []
- @feed_url = AlaveteliConfiguration.blog_feed
- separator = @feed_url.include?('?') ? '&' : '?'
- @feed_url = "#{ @feed_url }#{ separator }lang=" \
- "#{ AlaveteliLocalization.html_lang }"
- @blog_items = []
- unless @feed_url.empty?
- timeout = if AlaveteliConfiguration.blog_timeout.blank?
- 60
- else
- AlaveteliConfiguration.blog_timeout
- end
- content = quietly_try_to_open(@feed_url, timeout)
- unless content.empty?
- @data = XmlSimple.xml_in(content)
- @channel = @data['channel'][0]
- @blog_items = @channel.fetch('item') { [] }
- @feed_autodetect = [{url: @feed_url, title: "#{site_name} blog"}]
- end
- end
+ @blog = Blog.new
@twitter_user = AlaveteliConfiguration.twitter_username
@facebook_user = AlaveteliConfiguration.facebook_username
+ @feed_autodetect = @blog.feeds
end
# Just does a redirect from ?query= search to /query
diff --git a/app/models/blog.rb b/app/models/blog.rb
index 4f6a660037..66869228f9 100644
--- a/app/models/blog.rb
+++ b/app/models/blog.rb
@@ -7,7 +7,39 @@
# but other feeds may work if they use the same data format.
#
class Blog
+ include ConfigHelper
+
def self.enabled?
AlaveteliConfiguration.blog_feed.present?
end
+
+ def items
+ return [] if content.empty?
+
+ data = XmlSimple.xml_in(content)
+ channel = data['channel'][0]
+ channel.fetch('item') { [] }
+ end
+
+ def feeds
+ [{ url: feed_url, title: "#{site_name} blog" }]
+ end
+
+ def feed_url
+ uri = URI(AlaveteliConfiguration.blog_feed)
+ uri.query = URI.decode_www_form(uri.query || '').to_h.merge(
+ lang: AlaveteliLocalization.html_lang.to_s
+ ).to_param
+ uri.to_s
+ end
+
+ private
+
+ def content
+ @content ||= quietly_try_to_open(feed_url, timeout)
+ end
+
+ def timeout
+ AlaveteliConfiguration.blog_timeout.presence || 60
+ end
end
diff --git a/app/views/general/blog.html.erb b/app/views/general/blog.html.erb
index 1e80cebc50..8c24cbdbea 100644
--- a/app/views/general/blog.html.erb
+++ b/app/views/general/blog.html.erb
@@ -4,7 +4,7 @@
<%=@title %>
- <% @blog_items.each do |item| %>
+ <% @blog.items.each do |item| %>
<% date = Time.zone.parse(item['pubDate'][0]) %>
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index bf0fd7b66f..3c549dcdb9 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -23,16 +23,22 @@
end
describe 'GET blog' do
+ let(:blog) { Blog.new }
+
+ before do
+ allow(Blog).to receive(:new).and_return(blog)
+ end
+
context 'when feed is configured' do
before do
allow(AlaveteliConfiguration).to receive(:blog_feed).
and_return('http://blog.example.com')
- allow(controller).to receive(:quietly_try_to_open).and_return('')
+ allow(blog).to receive(:quietly_try_to_open).and_return('')
end
it 'adds lang query param correctly' do
get :blog
- expect(assigns[:feed_url]).to eq('http://blog.example.com?lang=en')
+ expect(assigns[:blog].feed_url).to eq('http://blog.example.com?lang=en')
end
end
@@ -40,12 +46,12 @@
before do
allow(AlaveteliConfiguration).to receive(:blog_feed).
and_return('http://blog.example.com?alt=rss')
- allow(controller).to receive(:quietly_try_to_open).and_return('')
+ allow(blog).to receive(:quietly_try_to_open).and_return('')
end
it 'adds lang query param correctly' do
get :blog
- expect(assigns[:feed_url]).to eq(
+ expect(assigns[:blog].feed_url).to eq(
'http://blog.example.com?alt=rss&lang=en'
)
end
@@ -57,13 +63,13 @@
before do
allow(AlaveteliConfiguration).to receive(:blog_feed).
and_return('http://blog.example.com')
- allow(controller).to receive(:quietly_try_to_open).
+ allow(blog).to receive(:quietly_try_to_open).
and_return(load_file_fixture('blog_feed.atom'))
end
it 'parses item from an example feed' do
get :blog
- expect(assigns[:blog_items].count).to eq(1)
+ expect(assigns[:blog].items.count).to eq(1)
end
it 'escapes any javascript from the entries' do
@@ -84,7 +90,7 @@
it 'should fail silently if the blog is returning an error' do
get :blog
expect(response.status).to eq(200)
- expect(assigns[:blog_items].count).to eq(0)
+ expect(assigns[:blog].items.count).to eq(0)
end
end
diff --git a/spec/views/general/blog.html.erb_spec.rb b/spec/views/general/blog.html.erb_spec.rb
index ccc583ac2c..71dc0ee8ae 100644
--- a/spec/views/general/blog.html.erb_spec.rb
+++ b/spec/views/general/blog.html.erb_spec.rb
@@ -4,7 +4,7 @@
subject { rendered }
before do
- assign :blog_items, blog_items
+ assign :blog, double(items: blog_items)
assign :twitter_user, double.as_null_object
assign :facebook_user, double.as_null_object
render
From 8ddf3d99f74b5a8a100a9a413d564fbe20ae6df8 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 9 Mar 2023 16:41:10 +0000
Subject: [PATCH 169/289] Add specs for Blog class
Bring over the old specs from the controller and update for current
styling of model specs.
Also updates the controller specs so we're not looking into the blog.
Although we do still stub the content of the blog feed to ensure content
is properly sanitized in the view.
---
spec/controllers/general_controller_spec.rb | 51 ++------------
spec/models/blog_spec.rb | 76 +++++++++++++++++++++
2 files changed, 83 insertions(+), 44 deletions(-)
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 3c549dcdb9..6a459a4eca 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -30,34 +30,6 @@
end
context 'when feed is configured' do
- before do
- allow(AlaveteliConfiguration).to receive(:blog_feed).
- and_return('http://blog.example.com')
- allow(blog).to receive(:quietly_try_to_open).and_return('')
- end
-
- it 'adds lang query param correctly' do
- get :blog
- expect(assigns[:blog].feed_url).to eq('http://blog.example.com?lang=en')
- end
- end
-
- context 'when feed is configured with existing query param' do
- before do
- allow(AlaveteliConfiguration).to receive(:blog_feed).
- and_return('http://blog.example.com?alt=rss')
- allow(blog).to receive(:quietly_try_to_open).and_return('')
- end
-
- it 'adds lang query param correctly' do
- get :blog
- expect(assigns[:blog].feed_url).to eq(
- 'http://blog.example.com?alt=rss&lang=en'
- )
- end
- end
-
- context 'when blog has entries' do
render_views
before do
@@ -67,9 +39,14 @@
and_return(load_file_fixture('blog_feed.atom'))
end
- it 'parses item from an example feed' do
+ it 'assigns blog' do
+ get :blog
+ expect(assigns[:blog]).to eq(blog)
+ end
+
+ it 'assigns feed_autodetect' do
get :blog
- expect(assigns[:blog].items.count).to eq(1)
+ expect(assigns[:feed_autodetect]).to eq(blog.feeds)
end
it 'escapes any javascript from the entries' do
@@ -80,20 +57,6 @@
end
end
- context 'when feed returns an error' do
- before do
- allow(AlaveteliConfiguration).to receive(:blog_feed).
- and_return('http://blog.example.com')
- stub_request(:get, %r|blog.example.com|).to_return(status: 500)
- end
-
- it 'should fail silently if the blog is returning an error' do
- get :blog
- expect(response.status).to eq(200)
- expect(assigns[:blog].items.count).to eq(0)
- end
- end
-
context 'when feed is not configured' do
before do
allow(AlaveteliConfiguration).to receive(:blog_feed).and_return('')
diff --git a/spec/models/blog_spec.rb b/spec/models/blog_spec.rb
index 2d19109e4c..176157ab0e 100644
--- a/spec/models/blog_spec.rb
+++ b/spec/models/blog_spec.rb
@@ -21,4 +21,80 @@
it { is_expected.to eq(false) }
end
end
+
+ describe '#items' do
+ let(:blog) { described_class.new }
+ subject(:items) { blog.items }
+
+ context 'when feed is fetched successfully' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+
+ allow(blog).to receive(:quietly_try_to_open).
+ and_return(load_file_fixture('blog_feed.atom'))
+ end
+
+ it 'parses an item from an example feed' do
+ expect(items.count).to eq(1)
+ end
+ end
+
+ context 'when feed returns an error' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ stub_request(:get, %r|blog.example.com|).to_return(status: 500)
+ end
+
+ it 'should fail silently if the blog is returning an error' do
+ expect(items.count).to eq(0)
+ end
+ end
+ end
+
+ describe '#feeds' do
+ let(:blog) { described_class.new }
+ subject(:feeds) { blog.feeds }
+
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ allow(AlaveteliConfiguration).to receive(:site_name).
+ and_return('My site')
+ end
+
+ it 'returns an array with a url (with lang query param) and title hash' do
+ is_expected.to include(
+ { url: 'http://blog.example.com?lang=en', title: 'My site blog' }
+ )
+ end
+ end
+
+ describe '#feed_url' do
+ let(:blog) { described_class.new }
+ subject(:feed_url) { blog.feed_url }
+
+ context 'when feed is configured' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com')
+ end
+
+ it 'add lang query param correctly' do
+ is_expected.to eq('http://blog.example.com?lang=en')
+ end
+ end
+
+ context 'when feed is configured with existing query param' do
+ before do
+ allow(AlaveteliConfiguration).to receive(:blog_feed).
+ and_return('http://blog.example.com?alt=rss')
+ end
+
+ it 'adds lang query param correctly' do
+ is_expected.to eq('http://blog.example.com?alt=rss&lang=en')
+ end
+ end
+ end
end
From 0048a249fe11488a4b60339ac5b8acb58cf3c2bb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 16 Mar 2023 11:28:18 +0000
Subject: [PATCH 170/289] Build(deps): Bump rack from 2.2.6.2 to 2.2.6.4
Bumps [rack](https://github.com/rack/rack) from 2.2.6.2 to 2.2.6.4.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.6.2...v2.2.6.4)
---
updated-dependencies:
- dependency-name: rack
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 6dd3671a86..772e541c50 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -360,7 +360,7 @@ GEM
method_source (~> 1.0)
public_suffix (5.0.1)
racc (1.6.2)
- rack (2.2.6.2)
+ rack (2.2.6.4)
rack-test (2.0.2)
rack (>= 1.3)
rack-utf8_sanitizer (1.8.0)
From 0f9cf138d0c26054f55ea6ab871ca954c8338f8c Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Wed, 15 Mar 2023 13:27:03 +0000
Subject: [PATCH 171/289] Feat: add leaderboards to project page
Two separate leaderboards, one for the
whole project to date, and one for the
last 28 days
---
.../projects/projects_controller.rb | 1 +
app/models/project/leaderboard.rb | 58 +++++++++++++++++++
app/views/projects/projects/show.html.erb | 33 +++++++++++
3 files changed, 92 insertions(+)
create mode 100644 app/models/project/leaderboard.rb
diff --git a/app/controllers/projects/projects_controller.rb b/app/controllers/projects/projects_controller.rb
index 883e094016..2e6cb5e89b 100644
--- a/app/controllers/projects/projects_controller.rb
+++ b/app/controllers/projects/projects_controller.rb
@@ -4,6 +4,7 @@ class Projects::ProjectsController < Projects::BaseController
def show
authorize! :read, @project
+ @leaderboard = Project::Leaderboard.new(@project)
end
private
diff --git a/app/models/project/leaderboard.rb b/app/models/project/leaderboard.rb
new file mode 100644
index 0000000000..afa5a2a5f4
--- /dev/null
+++ b/app/models/project/leaderboard.rb
@@ -0,0 +1,58 @@
+##
+# Export a project's leaderboard of classifications and data extractions to CSV.
+#
+class Project::Leaderboard
+ include DownloadHelper
+
+ attr_reader :project
+ protected :project
+
+ def initialize(project)
+ @project = project
+ end
+
+ def all_time
+ @leaderboard_all_time ||= data.first(5)
+ end
+
+ def twenty_eight_days
+ @leaderboard_28_days ||= data(
+ project.submissions.where(created_at: 28.days.ago..)
+ ).first(5)
+ end
+
+ def name
+ generate_download_filename(
+ resource: 'project-leaderboard',
+ id: project.id,
+ title: project.title,
+ ext: 'csv'
+ )
+ end
+
+ def to_csv
+ CSV.generate do |csv|
+ header = data.first
+ csv << header.keys.map(&:to_s) if header
+ data.each do |row|
+ row[:user] = row[:user].name
+ csv << row.values
+ end
+ end
+ end
+
+ private
+
+ def data(scope = project.submissions)
+ leaderboard = project.members.map do |user|
+ user_scope = scope.where(user_id: user.id)
+ {
+ user: user,
+ classifications: user_scope.classification.size,
+ extractions: user_scope.extraction.size,
+ total_contributions: user_scope.size
+ }
+ end
+ leaderboard.sort_by { |row| row[:total_contributions] }.reverse
+ end
+end
diff --git a/app/views/projects/projects/show.html.erb b/app/views/projects/projects/show.html.erb
index 7b12a9d3a7..cee883a335 100644
--- a/app/views/projects/projects/show.html.erb
+++ b/app/views/projects/projects/show.html.erb
@@ -124,6 +124,39 @@
class: 'button-tertiary' %>
<% end %>
+
+
+
<%= _("Top recent contributors") %>
+
+ <% @leaderboard.twenty_eight_days.each_with_index do |row, index| %>
+
<%= render partial: 'admin_request/some_annotations' ,
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index d01ebc4b6e..f1b1be1089 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,7 @@
## Highlighted Features
+* Add list of batch requests to admin user page (Gareth Rees)
* Add daily limit to user message creation (Gareth Rees)
* Add rate limiting to comment creation (Gareth Rees)
* Fix bug preventing ex-pro users follow up to still-private requests (Gareth
diff --git a/spec/views/admin_user/show.html.erb_spec.rb b/spec/views/admin_user/show.html.erb_spec.rb
index 9d052d836d..ce7aaa6515 100644
--- a/spec/views/admin_user/show.html.erb_spec.rb
+++ b/spec/views/admin_user/show.html.erb_spec.rb
@@ -6,6 +6,7 @@
info_requests = []
allow(info_requests).to receive(:total_pages).and_return(0)
assign :info_requests, info_requests
+ assign :info_request_batches, []
assign :admin_user, user_being_viewed
assign :comments, []
end
From 34d1117ded0183fd2cac0c310f333e99acdbbb6e Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 24 Feb 2023 13:25:12 +0000
Subject: [PATCH 177/289] User#close should disable email alerts
Closing your account should stop all communications from the app. This
is likely not completely true in practice [1] as some messages may
ignore this flag, but this sets the intent.
[1] https://github.com/mysociety/alaveteli/issues/4603
---
app/models/user.rb | 2 +-
spec/factories/users.rb | 1 +
spec/models/user_spec.rb | 4 ++++
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 190b86f538..d01ff80509 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -403,7 +403,7 @@ def banned?
end
def close
- update(closed_at: Time.zone.now)
+ update(closed_at: Time.zone.now, receive_email_alerts: false)
end
def closed?
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index e1cc18af33..ea36869d03 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -99,6 +99,7 @@
trait :closed do
closed_at { Time.zone.now }
+ receive_email_alerts { false }
end
end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c8525473a2..968a4b1c3b 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1181,6 +1181,10 @@ def create_user(options = {})
it 'sets closed_at' do
expect(user.closed_at).to be_present
end
+
+ it 'disables email alerts' do
+ expect(user.receive_email_alerts).to eq(false)
+ end
end
describe '#closed?' do
From 0a211dfaf42fc092bb817602a0b4fcc986fb3b1e Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 24 Feb 2023 13:50:35 +0000
Subject: [PATCH 178/289] Add User#close!
Add a version of `#close` that raises on failure, and define `#close` in
terms of `#close!` as per convention.
---
app/models/user.rb | 8 +++++-
spec/models/user_spec.rb | 58 +++++++++++++++++++++++++++++++++++-----
2 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index d01ff80509..2aee6395e3 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -403,7 +403,13 @@ def banned?
end
def close
- update(closed_at: Time.zone.now, receive_email_alerts: false)
+ close!
+ rescue ActiveRecord::RecordInvalid
+ false
+ end
+
+ def close!
+ update!(closed_at: Time.zone.now, receive_email_alerts: false)
end
def closed?
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 968a4b1c3b..bace32a4a9 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1172,18 +1172,62 @@ def create_user(options = {})
let(:user) { FactoryBot.build(:user) }
- before { subject }
+ context 'the update is successful' do
+ before do
+ expect(user).to receive(:close!).and_call_original
+ subject
+ end
- it 'closes the account' do
- expect(user).to be_closed
+ it { is_expected.to eq(true) }
+
+ it 'closes the account' do
+ expect(user).to be_closed
+ end
+ end
+
+ context 'the update is unsuccessful' do
+ before do
+ expect(user).to receive(:close!).and_raise(ActiveRecord::RecordInvalid)
+ subject
+ end
+
+ it { is_expected.to eq(false) }
+
+ it 'does not close the account' do
+ expect(user).not_to be_closed
+ end
end
+ end
+
+ describe '#close!' do
+ subject { user.close! }
+
+ let(:user) { FactoryBot.build(:user) }
+
+ context 'the update is successful' do
+ before { subject }
+
+ it 'closes the account' do
+ expect(user).to be_closed
+ end
- it 'sets closed_at' do
- expect(user.closed_at).to be_present
+ it 'sets closed_at' do
+ expect(user.closed_at).to be_present
+ end
+
+ it 'disables email alerts' do
+ expect(user.receive_email_alerts).to eq(false)
+ end
end
- it 'disables email alerts' do
- expect(user.receive_email_alerts).to eq(false)
+ context 'the update is unsuccessful' do
+ before do
+ expect(user).to receive(:update!).and_raise(ActiveRecord::RecordInvalid)
+ end
+
+ it 'raises an ActiveRecord::RecordInvalid error' do
+ expect { subject }.to raise_error(ActiveRecord::RecordInvalid)
+ end
end
end
From 90306d23fda2033bf1ff5d851e6286d85a9b4e20 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 24 Feb 2023 14:07:53 +0000
Subject: [PATCH 179/289] Add User#erase and User#erase!
Method to only erase PII account data to enable forthcoming composition
of various close / anonymise / erase options.
---
app/models/user.rb | 25 +++++++++
spec/models/user_spec.rb | 106 +++++++++++++++++++++++++++++++++++++++
2 files changed, 131 insertions(+)
diff --git a/app/models/user.rb b/app/models/user.rb
index 2aee6395e3..430515c14a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -416,6 +416,31 @@ def closed?
closed_at.present?
end
+ def erase
+ erase!
+ rescue ActiveRecord::RecordInvalid
+ false
+ end
+
+ def erase!
+ raise ActiveRecord::RecordInvalid unless closed?
+
+ sha = Digest::SHA1.hexdigest(rand.to_s)
+
+ transaction do
+ sign_ins.destroy_all
+ profile_photo&.destroy!
+
+ update!(
+ name: _('[Name Removed]'),
+ email: "#{sha}@invalid",
+ url_name: sha,
+ about_me: '',
+ password: MySociety::Util.generate_token
+ )
+ end
+ end
+
def close_and_anonymise
sha = Digest::SHA1.hexdigest(rand.to_s)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index bace32a4a9..b0a2cf21a1 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1246,6 +1246,112 @@ def create_user(options = {})
end
+ describe '#erase' do
+ subject { user.erase }
+
+ let(:user) { FactoryBot.build(:user) }
+
+ context 'the update is successful' do
+ before do
+ user.close!
+ expect(user).to receive(:erase!).and_call_original
+ subject
+ end
+
+ it { is_expected.to eq(true) }
+
+ it 'erases the account' do
+ expect(user.name).to match(/Name Removed/)
+ end
+ end
+
+ context 'the update is unsuccessful' do
+ before do
+ expect(user).to receive(:erase!).and_raise(ActiveRecord::RecordInvalid)
+ subject
+ end
+
+ it { is_expected.to eq(false) }
+
+ it 'does not erase the account' do
+ expect(user.name).not_to match(/Name Removed/)
+ end
+ end
+ end
+
+ describe '#erase!' do
+ subject { user.erase! }
+
+ context 'the user account is not closed' do
+ let(:user) { FactoryBot.build(:user, about_me: 'Hi') }
+
+ it 'raises an ActiveRecord::RecordInvalid' do
+ expect { subject }.to raise_error(ActiveRecord::RecordInvalid)
+ end
+ end
+
+ context 'the update is successful' do
+ let(:user) { FactoryBot.build(:user, :closed, about_me: 'Hi') }
+
+ before do
+ allow(AlaveteliConfiguration).
+ to receive(:user_sign_in_activity_retention_days).and_return(1)
+ FactoryBot.create(:user_sign_in, user: user)
+ FactoryBot.create(:profile_photo, user: user)
+
+ allow(Digest::SHA1).to receive(:hexdigest).and_return('a1b2c3d4')
+ allow(MySociety::Util).
+ to receive(:generate_token).and_return('r@nd0m-pa$$w0rd')
+
+ subject
+
+ user.reload
+ end
+
+ it 'erases the name' do
+ # #name currently appends "(Account suspended)". Here we specifically
+ # only care about the data we hold.
+ expect(user.read_attribute(:name)).to eq('[Name Removed]')
+ end
+
+ it 'erases the url_name' do
+ expect(user.url_name).to eq('a1b2c3d4')
+ end
+
+ it 'erases the email' do
+ expect(user.email).to eq('a1b2c3d4@invalid')
+ end
+
+ it 'erases the password' do
+ expect(user.password).to eq('r@nd0m-pa$$w0rd')
+ end
+
+ it 'erases the about_me' do
+ expect(user.about_me).to be_empty
+ end
+
+ it 'destroys any sign_ins' do
+ expect(user.sign_ins).to be_empty
+ end
+
+ it 'destroys any profile photo' do
+ expect(user.profile_photo).to be_nil
+ end
+ end
+
+ context 'the update is unsuccessful' do
+ let(:user) { FactoryBot.build(:user, :closed, about_me: 'Hi') }
+
+ before do
+ expect(user).to receive(:update!).and_raise(ActiveRecord::RecordInvalid)
+ end
+
+ it 'raises an ActiveRecord::RecordInvalid error' do
+ expect { subject }.to raise_error(ActiveRecord::RecordInvalid)
+ end
+ end
+ end
+
describe '.closed' do
it 'should not return users with closed_at timestamp' do
From 0717a947b5d786c46e8d6aac220759422721bab2 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 27 Feb 2023 18:26:20 +0000
Subject: [PATCH 180/289] Add User#anonymise!
Simple method to handle anonymisation via CensorRule if the user has any
content to anonymise.
---
app/models/user.rb | 9 +++++++++
spec/models/user_spec.rb | 26 ++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/app/models/user.rb b/app/models/user.rb
index 430515c14a..5231e257af 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -441,6 +441,15 @@ def erase!
end
end
+ def anonymise!
+ return if info_requests.none?
+
+ censor_rules.create!(text: name,
+ replacement: _('[Name Removed]'),
+ last_edit_editor: 'User#anonymise!',
+ last_edit_comment: 'User#anonymise!')
+ end
+
def close_and_anonymise
sha = Digest::SHA1.hexdigest(rand.to_s)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index b0a2cf21a1..9184df3e2e 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1352,6 +1352,32 @@ def create_user(options = {})
end
end
+ describe '#anonymise!' do
+ subject { user.anonymise! }
+
+ let(:user) { FactoryBot.build(:user, name: 'Bob Smith') }
+
+ context 'when the user has info requests' do
+ before { FactoryBot.create(:info_request, user: user) }
+
+ it 'creates a censor rule for user name if the user has info requests' do
+ subject
+ censor_rule = user.censor_rules.last
+ expect(censor_rule.text).to eq(user.name)
+ expect(censor_rule.replacement).to eq ('[Name Removed]')
+ expect(censor_rule.last_edit_editor).to eq('User#anonymise!')
+ expect(censor_rule.last_edit_comment).to eq('User#anonymise!')
+ end
+ end
+
+ context 'when the user has no info requests' do
+ it 'does not create a censor rule' do
+ subject
+ expect(user.censor_rules).to be_empty
+ end
+ end
+ end
+
describe '.closed' do
it 'should not return users with closed_at timestamp' do
From 8c25e2bb347a9c453698437df8b07c787a937ccd Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 27 Feb 2023 18:33:05 +0000
Subject: [PATCH 181/289] Refactor User#close_and_anonymise
Compose from new task-specific methods to make clearer.
Had to tweak the censor rule creation since closing currently appends
"(Account suspended)", which then gets added to the censor rule `text`.
We only want to redact the raw attribute content.
Drop `User#redact_name!` since we now have `anonymise!` to do the same
thing.
Fixes https://github.com/mysociety/alaveteli/issues/5600 as the use of
`#erase!` for this method now clears the profile photo.
---
app/models/user.rb | 27 ++++-----------------------
app/views/admin_user/edit.html.erb | 1 +
spec/models/user_spec.rb | 5 +++--
3 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 5231e257af..cfd8ac5620 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -444,29 +444,17 @@ def erase!
def anonymise!
return if info_requests.none?
- censor_rules.create!(text: name,
+ censor_rules.create!(text: read_attribute(:name),
replacement: _('[Name Removed]'),
last_edit_editor: 'User#anonymise!',
last_edit_comment: 'User#anonymise!')
end
def close_and_anonymise
- sha = Digest::SHA1.hexdigest(rand.to_s)
-
transaction do
- redact_name! if info_requests.any?
-
- sign_ins.destroy_all
-
- update(
- name: _('[Name Removed]'),
- email: "#{sha}@invalid",
- url_name: sha,
- about_me: '',
- password: MySociety::Util.generate_token,
- receive_email_alerts: false,
- closed_at: Time.zone.now
- )
+ close!
+ anonymise!
+ erase!
end
end
@@ -671,13 +659,6 @@ def flipper_id
private
- def redact_name!
- censor_rules.create!(text: name,
- replacement: _('[Name Removed]'),
- last_edit_editor: 'User#close_and_anonymise',
- last_edit_comment: 'User#close_and_anonymise')
- end
-
def set_defaults
return unless new_record?
diff --git a/app/views/admin_user/edit.html.erb b/app/views/admin_user/edit.html.erb
index 4a82ef3239..9405ed185c 100644
--- a/app/views/admin_user/edit.html.erb
+++ b/app/views/admin_user/edit.html.erb
@@ -43,6 +43,7 @@
Disables email alerts
Removes user from search index
Hides requests on the profile page
+
Clears sign ins and profile photo
Does not delete or set prominence of the user's requests
Makes a naive attempt to redact name from requests1
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 9184df3e2e..7770904553 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1105,7 +1105,8 @@ def create_user(options = {})
before do
allow(Digest::SHA1).to receive(:hexdigest).and_return('1234')
- allow(MySociety::Util).to receive(:generate_token).and_return('ABCD')
+ allow(MySociety::Util).
+ to receive(:generate_token).and_return('r@nd0m-pa$$w0rd')
allow(AlaveteliConfiguration).
to receive(:user_sign_in_activity_retention_days).and_return(1)
FactoryBot.create(:user_sign_in, user: user)
@@ -1152,7 +1153,7 @@ def create_user(options = {})
it 'should anonymise user password' do
expect { user.close_and_anonymise }.
- to change(user, :password).to('ABCD')
+ to change(user, :password).to('r@nd0m-pa$$w0rd')
end
it 'should set user to not receive email alerts' do
From d01888152d87389a8da669322e7d6fb585f0b80c Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 17 Mar 2023 16:23:19 +0000
Subject: [PATCH 182/289] Fix missed lints
Fixes Lint/ParenthesesAsGroupedExpression
---
spec/models/user_spec.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 4d1dfe67b8..4dc429bbf6 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1111,7 +1111,7 @@ def create_user(options = {})
user.close_and_anonymise
censor_rule = user.censor_rules.last
expect(censor_rule.text).to eq(user_name)
- expect(censor_rule.replacement).to eq ('[Name Removed]')
+ expect(censor_rule.replacement).to eq('[Name Removed]')
end
it 'does not create a censor rule for user name if the user does not have info requests' do
@@ -1358,7 +1358,7 @@ def create_user(options = {})
subject
censor_rule = user.censor_rules.last
expect(censor_rule.text).to eq(user.name)
- expect(censor_rule.replacement).to eq ('[Name Removed]')
+ expect(censor_rule.replacement).to eq('[Name Removed]')
expect(censor_rule.last_edit_editor).to eq('User#anonymise!')
expect(censor_rule.last_edit_comment).to eq('User#anonymise!')
end
From 5b57b2adee7c20b68be46e478fdd2a4926dbbbcd Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 3 Jan 2023 09:53:50 +0000
Subject: [PATCH 183/289] Add ability to paginate through batch requests
Add "Next" and "Prev" pagination links to the sidebar of info requests
that belong to a batch request.
This allows users to navigate through requests in the batch without
having to click "in and out" via the batch page.
To minimise implementation complexity the pagination doesn't have a
beginning and end. We just cycle back around to the first request in the
batch when we hit the last one; same for paginating in reverse. If we
didn't do this we'd have to have conditionals for disabling the
particular navigation option when we hit an end.
---
app/models/info_request.rb | 1 +
app/models/info_request/batch_pagination.rb | 26 ++++++++++
.../info_requests/_batch.html.erb | 3 ++
.../info_request_batch/_pagination.html.erb | 2 +
app/views/request/_batch.html.erb | 3 ++
doc/CHANGES.md | 1 +
spec/models/info_request/batch_pagination.rb | 47 +++++++++++++++++++
spec/models/info_request_spec.rb | 2 +
8 files changed, 85 insertions(+)
create mode 100644 app/models/info_request/batch_pagination.rb
create mode 100644 app/views/info_request_batch/_pagination.html.erb
create mode 100644 spec/models/info_request/batch_pagination.rb
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 584281fd94..f2f6d3e73b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -46,6 +46,7 @@ class InfoRequest < ApplicationRecord
include Rails.application.routes.url_helpers
include AlaveteliPro::RequestSummaries
include AlaveteliFeatures::Helpers
+ include InfoRequest::BatchPagination
include InfoRequest::PublicToken
include InfoRequest::Sluggable
include InfoRequest::TitleValidation
diff --git a/app/models/info_request/batch_pagination.rb b/app/models/info_request/batch_pagination.rb
new file mode 100644
index 0000000000..91ec018ea7
--- /dev/null
+++ b/app/models/info_request/batch_pagination.rb
@@ -0,0 +1,26 @@
+# Methods to handle pagination within an associated InfoRequestBatch
+module InfoRequest::BatchPagination
+ def next_in_batch
+ return nil unless info_request_batch
+ batch_sibling_requests_ordered_by_id[index_in_batch + 1] || first_in_batch
+ end
+
+ def prev_in_batch
+ return nil unless info_request_batch
+ batch_sibling_requests_ordered_by_id[index_in_batch - 1]
+ end
+
+ private
+
+ def first_in_batch
+ batch_sibling_requests_ordered_by_id.first
+ end
+
+ def index_in_batch
+ batch_sibling_requests_ordered_by_id.pluck(:id).index(id)
+ end
+
+ def batch_sibling_requests_ordered_by_id
+ info_request_batch.info_requests.reorder(id: :asc)
+ end
+end
diff --git a/app/views/alaveteli_pro/info_requests/_batch.html.erb b/app/views/alaveteli_pro/info_requests/_batch.html.erb
index 851f7841a4..593f09b17e 100644
--- a/app/views/alaveteli_pro/info_requests/_batch.html.erb
+++ b/app/views/alaveteli_pro/info_requests/_batch.html.erb
@@ -10,5 +10,8 @@
:count => @info_request.info_request_batch.public_bodies.count) %>
+
+ <%= render partial: 'info_request_batch/pagination',
+ locals: { info_request: @info_request } %>
<% end %>
diff --git a/app/views/info_request_batch/_pagination.html.erb b/app/views/info_request_batch/_pagination.html.erb
new file mode 100644
index 0000000000..8667331515
--- /dev/null
+++ b/app/views/info_request_batch/_pagination.html.erb
@@ -0,0 +1,2 @@
+<%= link_to _('Prev'), request_path(info_request.prev_in_batch) %> |
+<%= link_to _('Next'), request_path(info_request.next_in_batch) %>
diff --git a/app/views/request/_batch.html.erb b/app/views/request/_batch.html.erb
index efb5df451a..a2a6c77c75 100644
--- a/app/views/request/_batch.html.erb
+++ b/app/views/request/_batch.html.erb
@@ -8,5 +8,8 @@
url: info_request_batch_path(info_request.info_request_batch),
count: info_request.info_request_batch.public_bodies.size) %>
+
+ <%= render partial: 'info_request_batch/pagination',
+ locals: { info_request: info_request } %>
<% end %>
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index f1b1be1089..7ece89c3b3 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,6 +2,7 @@
## Highlighted Features
+* Add ability to paginate through requests in a batch (Gareth Rees)
* Add list of batch requests to admin user page (Gareth Rees)
* Add daily limit to user message creation (Gareth Rees)
* Add rate limiting to comment creation (Gareth Rees)
diff --git a/spec/models/info_request/batch_pagination.rb b/spec/models/info_request/batch_pagination.rb
new file mode 100644
index 0000000000..08b7249441
--- /dev/null
+++ b/spec/models/info_request/batch_pagination.rb
@@ -0,0 +1,47 @@
+RSpec.shared_examples 'info_request/batch_pagination' do
+ describe '#next_in_batch' do
+ subject { info_request.next_in_batch }
+
+ let(:batch) do
+ FactoryBot.create(:info_request_batch, :sent, public_body_count: 2)
+ end
+
+ context 'the request is not part of a batch' do
+ let(:info_request) { FactoryBot.build(:info_request) }
+ it { is_expected.to be_nil }
+ end
+
+ context 'the request is part of a batch' do
+ let(:info_request) { batch.info_requests.first }
+ it { is_expected.to eq(batch.info_requests.last) }
+ end
+
+ context 'the request is the last of a batch' do
+ let(:info_request) { batch.info_requests.last }
+ it { is_expected.to eq(batch.info_requests.first) }
+ end
+ end
+
+ describe '#prev_in_batch' do
+ subject { info_request.prev_in_batch }
+
+ let(:batch) do
+ FactoryBot.create(:info_request_batch, :sent, public_body_count: 2)
+ end
+
+ context 'the request is not part of a batch' do
+ let(:info_request) { FactoryBot.build(:info_request) }
+ it { is_expected.to be_nil }
+ end
+
+ context 'the request is part of a batch' do
+ let(:info_request) { batch.info_requests.last }
+ it { is_expected.to eq(batch.info_requests.first) }
+ end
+
+ context 'the request is the first of a batch' do
+ let(:info_request) { batch.info_requests.first }
+ it { is_expected.to eq(batch.info_requests.last) }
+ end
+ end
+end
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index f3fc72cbe9..f9c19010d6 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -41,12 +41,14 @@
require 'models/concerns/notable'
require 'models/concerns/notable_and_taggable'
require 'models/concerns/taggable'
+require 'models/info_request/batch_pagination'
RSpec.describe InfoRequest do
it_behaves_like 'concerns/info_request/title_validation', :info_request
it_behaves_like 'concerns/notable', :info_request
it_behaves_like 'concerns/notable_and_taggable', :info_request
it_behaves_like 'concerns/taggable', :info_request
+ it_behaves_like 'info_request/batch_pagination'
describe '.internal' do
subject { described_class.internal }
From dc0e6e173869c6130dc57fdefc63288c47401221 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 12:18:08 +0000
Subject: [PATCH 184/289] Style: Lint/UnusedMethodArgument (Rubocop)
---
.../draft_info_request_batches_controller.rb | 2 +-
app/controllers/user_controller.rb | 2 +-
app/helpers/application_helper.rb | 2 +-
app/helpers/info_request_helper.rb | 34 +++++------
app/mailers/application_mailer.rb | 2 +-
app/mailers/request_mailer.rb | 2 +-
app/models/info_request.rb | 6 +-
.../info_request/response_gatekeeper/base.rb | 2 +-
.../info_request/response_rejection/base.rb | 2 +-
.../info_request/response_rejection/bounce.rb | 2 +-
app/models/info_request/state/calculator.rb | 4 +-
app/models/info_request/state/transitions.rb | 58 +++++++++----------
.../template/batch_request.rb | 2 +-
app/models/public_body.rb | 2 +-
.../lib/alaveteli_features/constraints.rb | 2 +-
lib/alaveteli_mail_poller.rb | 2 +-
lib/attachment_to_html/adapter.rb | 2 +-
lib/routing_filters.rb | 4 +-
lib/stripe_mock_patch.rb | 4 +-
spec/support/mock_pop3.rb | 8 +--
20 files changed, 72 insertions(+), 72 deletions(-)
diff --git a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
index b8588f8843..1550c296dc 100644
--- a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
+++ b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
@@ -40,7 +40,7 @@ def update_bodies
private
- def respond_or_redirect(draft)
+ def respond_or_redirect(_draft)
@query = params[:authority_query]
@page = params[:page]
if request.xhr?
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 44fabfbcd0..1ea409b5c2 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -408,7 +408,7 @@ def block_restricted_country_ips?
AlaveteliConfiguration.enable_anti_spam
end
- def blocked_ip?(country, user)
+ def blocked_ip?(country, _user)
AlaveteliConfiguration.restricted_countries.include?(country) &&
country != AlaveteliConfiguration.iso_country_code
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index fd80f7ae54..e94e40f96a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -126,7 +126,7 @@ def is_admin?
!session[:using_admin].nil? || (!@user.nil? && @user.is_admin?)
end
- def cache_if_caching_fragments(*args, &block)
+ def cache_if_caching_fragments(*args)
if AlaveteliConfiguration.cache_fragments
cache(*args) { yield }
else
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index 066b8bcec9..d2879cd827 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -53,7 +53,7 @@ def status_text_awaiting_description(info_request, opts = {})
end
end
- def status_text_waiting_response(info_request, opts = {})
+ def status_text_waiting_response(info_request, _opts = {})
str = _('Currently waiting for a response from ' \
'{{public_body_link}}, they should respond promptly and',
public_body_link: public_body_link(info_request.public_body))
@@ -70,7 +70,7 @@ def status_text_waiting_response(info_request, opts = {})
str += ")."
end
- def status_text_waiting_response_overdue(info_request, opts = {})
+ def status_text_waiting_response_overdue(info_request, _opts = {})
str = _('Response to this request is delayed.')
str += ' '
if info_request.public_body.not_subject_to_law?
@@ -93,7 +93,7 @@ def status_text_waiting_response_overdue(info_request, opts = {})
str += ")"
end
- def status_text_waiting_response_very_overdue(info_request, opts = {})
+ def status_text_waiting_response_very_overdue(info_request, _opts = {})
str = _('Response to this request is long overdue.')
str += ' '
if info_request.public_body.not_subject_to_law?
@@ -123,22 +123,22 @@ def status_text_waiting_response_very_overdue(info_request, opts = {})
str
end
- def status_text_not_held(info_request, opts = {})
+ def status_text_not_held(info_request, _opts = {})
_('{{authority_name}} did not have the information ' \
'requested.',
authority_name: public_body_link(info_request.public_body))
end
- def status_text_rejected(info_request, opts = {})
+ def status_text_rejected(info_request, _opts = {})
_('The request was refused by {{authority_name}}.',
authority_name: public_body_link(info_request.public_body))
end
- def status_text_successful(info_request, opts = {})
+ def status_text_successful(_info_request, _opts = {})
_('The request was successful.')
end
- def status_text_partially_successful(info_request, opts = {})
+ def status_text_partially_successful(_info_request, _opts = {})
_('The request was partially successful.')
end
@@ -176,50 +176,50 @@ def status_text_waiting_clarification(info_request, opts = {})
str
end
- def status_text_gone_postal(info_request, opts = {})
+ def status_text_gone_postal(_info_request, _opts = {})
_('The authority would like to / has responded by ' \
'postal mail to this request.')
end
- def status_text_internal_review(info_request, opts = {})
+ def status_text_internal_review(info_request, _opts = {})
_('Waiting for an internal review by ' \
'{{public_body_link}} of their handling of this request.',
public_body_link: public_body_link(info_request.public_body))
end
- def status_text_error_message(info_request, opts = {})
+ def status_text_error_message(_info_request, _opts = {})
_('There was a delivery error or similar, which ' \
'needs fixing by the {{site_name}} team.',
site_name: site_name)
end
- def status_text_requires_admin(info_request, opts = {})
+ def status_text_requires_admin(_info_request, _opts = {})
_('This request has had an unusual response, and requires ' \
'attention from the {{site_name}} team.',
site_name: site_name)
end
- def status_text_user_withdrawn(info_request, opts = {})
+ def status_text_user_withdrawn(_info_request, _opts = {})
_('This request has been withdrawn by the person ' \
'who made it. There may be an explanation in the correspondence below.')
end
- def status_text_attention_requested(info_request, opts = {})
+ def status_text_attention_requested(_info_request, _opts = {})
_('This request has been reported as needing ' \
'administrator attention.')
end
- def status_text_vexatious(info_request, opts = {})
+ def status_text_vexatious(_info_request, _opts = {})
_('This request has been reviewed by an administrator and is ' \
'considered to be vexatious')
end
- def status_text_not_foi(info_request, opts = {})
+ def status_text_not_foi(_info_request, _opts = {})
_('This request has been reviewed by an administrator and is ' \
'considered not to be an FOI request')
end
- def custom_state_description(info_request, opts = {})
+ def custom_state_description(info_request, _opts = {})
render partial: 'general/custom_state_descriptions',
locals: { status: info_request.calculate_status }
end
@@ -258,7 +258,7 @@ def status_text_awaiting_description_other(info_request, new_responses_count)
user: user_link_for_request(info_request))
end
- def attachment_link(incoming_message, attachment)
+ def attachment_link(_incoming_message, attachment)
img_filename = "icon_#{attachment.content_type.sub('/', '_')}_large.png"
full_filename = File.expand_path(Rails.root.join('app',
'assets',
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 1d9e81d2fb..3379f5ab58 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -48,7 +48,7 @@ def contact_for_user(user = nil)
# Set headers that mark an email as being auto-generated and suppress out of
# office responses to them
- def set_auto_generated_headers(opts = {})
+ def set_auto_generated_headers(_opts = {})
headers({
'Auto-Submitted' => 'auto-generated', # http://tools.ietf.org/html/rfc3834
'X-Auto-Response-Suppress' => 'OOF'
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 45f56b0fca..857645f563 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -48,7 +48,7 @@ def external_response(info_request, message_body, sent_at, attachment_hashes)
end
# Incoming message arrived for a request, but new responses have been stopped.
- def stopped_responses(info_request, email, raw_email_data)
+ def stopped_responses(info_request, email, _raw_email_data)
headers('Return-Path' => blackhole_email, # we don't care about bounces, likely from spammers
'Auto-Submitted' => 'auto-replied') # http://tools.ietf.org/html/rfc3834
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index f2f6d3e73b..253387d8df 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -722,7 +722,7 @@ def prominence(opts = {})
# opts = Hash of options (default: {})
# Returns a StateCalculator
- def state(opts = {})
+ def state(_opts = {})
State::Calculator.new(self)
end
@@ -877,7 +877,7 @@ def find_existing_outgoing_message(body)
end
# Has this email already been received here? Based just on message id.
- def already_received?(email, raw_email_data)
+ def already_received?(email, _raw_email_data)
message_id = email.message_id
raise "No message id for this message" if message_id.nil?
@@ -1811,7 +1811,7 @@ def accept_incoming?(email, raw_email_data)
end
end
- def create_response!(email, raw_email_data, rejected_reason = nil)
+ def create_response!(_email, raw_email_data, rejected_reason = nil)
incoming_message = incoming_messages.build
# To avoid a deadlock when simultaneously dealing with two
diff --git a/app/models/info_request/response_gatekeeper/base.rb b/app/models/info_request/response_gatekeeper/base.rb
index f147c00fb6..3ceb1d2c64 100644
--- a/app/models/info_request/response_gatekeeper/base.rb
+++ b/app/models/info_request/response_gatekeeper/base.rb
@@ -9,7 +9,7 @@ def initialize(info_request)
@reason = nil
end
- def allow?(email)
+ def allow?(_email)
allow
end
diff --git a/app/models/info_request/response_rejection/base.rb b/app/models/info_request/response_rejection/base.rb
index edffed23e0..b6ec406c0f 100644
--- a/app/models/info_request/response_rejection/base.rb
+++ b/app/models/info_request/response_rejection/base.rb
@@ -9,7 +9,7 @@ def initialize(info_request, email, raw_email_data)
@raw_email_data = raw_email_data
end
- def reject(reason = nil)
+ def reject(_reason = nil)
true
end
end
diff --git a/app/models/info_request/response_rejection/bounce.rb b/app/models/info_request/response_rejection/bounce.rb
index e8996a2a43..93b4651f23 100644
--- a/app/models/info_request/response_rejection/bounce.rb
+++ b/app/models/info_request/response_rejection/bounce.rb
@@ -1,7 +1,7 @@
class InfoRequest
module ResponseRejection
class Bounce < Base
- def reject(reason = nil)
+ def reject(_reason = nil)
from_address = MailHandler.get_from_address(email)
if from_address.nil? || from_address.downcase == info_request.incoming_email.downcase
# do nothing – can't bounce the mail as there's no address to send it
diff --git a/app/models/info_request/state/calculator.rb b/app/models/info_request/state/calculator.rb
index 99b8cf2cda..b4109f120d 100644
--- a/app/models/info_request/state/calculator.rb
+++ b/app/models/info_request/state/calculator.rb
@@ -144,7 +144,7 @@ def pending_states(opts)
states
end
- def complete_states(opts = {})
+ def complete_states(_opts = {})
# States from which a request can go no further, because it's complete
%w[
not_held
@@ -154,7 +154,7 @@ def complete_states(opts = {})
]
end
- def admin_states(opts = {})
+ def admin_states(_opts = {})
# States which only an admin can put a request into, and from which
# a normal user can't get the request out again
%w[not_foi vexatious]
diff --git a/app/models/info_request/state/transitions.rb b/app/models/info_request/state/transitions.rb
index 9efd6a1acf..98f0f66836 100644
--- a/app/models/info_request/state/transitions.rb
+++ b/app/models/info_request/state/transitions.rb
@@ -59,31 +59,31 @@ def self.labelled_hash(states, opts = {})
private
- def self.owner_waiting_response_transition_label(opts = {})
+ def self.owner_waiting_response_transition_label(_opts = {})
_("I'm still waiting for my information (maybe you got an acknowledgement)")
end
- def self.owner_not_held_transition_label(opts = {})
+ def self.owner_not_held_transition_label(_opts = {})
_("They do not have the information (maybe they say who does)")
end
- def self.owner_rejected_transition_label(opts = {})
+ def self.owner_rejected_transition_label(_opts = {})
_("My request has been refused")
end
- def self.owner_partially_successful_transition_label(opts = {})
+ def self.owner_partially_successful_transition_label(_opts = {})
_("I've received some of the information")
end
- def self.owner_successful_transition_label(opts = {})
+ def self.owner_successful_transition_label(_opts = {})
_("I've received all the information")
end
- def self.owner_waiting_clarification_transition_label(opts = {})
+ def self.owner_waiting_clarification_transition_label(_opts = {})
_("I've been asked to clarify my request")
end
- def self.owner_gone_postal_transition_label(opts = {})
+ def self.owner_gone_postal_transition_label(_opts = {})
_("They are going to reply by postal mail")
end
@@ -95,48 +95,48 @@ def self.owner_internal_review_transition_label(opts = {})
end
end
- def self.owner_error_message_transition_label(opts = {})
+ def self.owner_error_message_transition_label(_opts = {})
_("I've received an error message")
end
- def self.owner_requires_admin_transition_label(opts = {})
+ def self.owner_requires_admin_transition_label(_opts = {})
_("This request requires administrator attention")
end
- def self.owner_user_withdrawn_transition_label(opts = {})
+ def self.owner_user_withdrawn_transition_label(_opts = {})
_("I would like to withdraw this request")
end
- def self.other_user_waiting_response_transition_label(opts = {})
+ def self.other_user_waiting_response_transition_label(_opts = {})
_("No response has been received (maybe " \
"there's just an acknowledgement)")
end
- def self.other_user_not_held_transition_label(opts = {})
+ def self.other_user_not_held_transition_label(_opts = {})
_("The authority do not have the information " \
"(maybe they say who does)")
end
- def self.other_user_rejected_transition_label(opts = {})
+ def self.other_user_rejected_transition_label(_opts = {})
_("The request has been refused")
end
- def self.other_user_partially_successful_transition_label(opts = {})
+ def self.other_user_partially_successful_transition_label(_opts = {})
# TODO: - trailing space copied from
# views/request/_other_describe_state.html.erb, will it break
# translations if I fix it?
_("Some of the information has been sent ")
end
- def self.other_user_successful_transition_label(opts = {})
+ def self.other_user_successful_transition_label(_opts = {})
_("All the information has been sent")
end
- def self.other_user_waiting_clarification_transition_label(opts = {})
+ def self.other_user_waiting_clarification_transition_label(_opts = {})
_("Clarification has been requested")
end
- def self.other_user_gone_postal_transition_label(opts = {})
+ def self.other_user_gone_postal_transition_label(_opts = {})
_("A response will be sent by postal mail")
end
@@ -150,51 +150,51 @@ def self.other_user_internal_review_transition_label(opts = {})
end
end
- def self.other_user_error_message_transition_label(opts = {})
+ def self.other_user_error_message_transition_label(_opts = {})
_("An error message has been received")
end
- def self.pro_waiting_response_transition_label(opts = {})
+ def self.pro_waiting_response_transition_label(_opts = {})
State.short_description('waiting_response')
end
- def self.pro_not_held_transition_label(opts = {})
+ def self.pro_not_held_transition_label(_opts = {})
State.short_description('not_held')
end
- def self.pro_rejected_transition_label(opts = {})
+ def self.pro_rejected_transition_label(_opts = {})
State.short_description('rejected')
end
- def self.pro_partially_successful_transition_label(opts = {})
+ def self.pro_partially_successful_transition_label(_opts = {})
State.short_description('partially_successful')
end
- def self.pro_successful_transition_label(opts = {})
+ def self.pro_successful_transition_label(_opts = {})
State.short_description('successful')
end
- def self.pro_waiting_clarification_transition_label(opts = {})
+ def self.pro_waiting_clarification_transition_label(_opts = {})
State.short_description('waiting_clarification')
end
- def self.pro_gone_postal_transition_label(opts = {})
+ def self.pro_gone_postal_transition_label(_opts = {})
State.short_description('gone_postal')
end
- def self.pro_internal_review_transition_label(opts = {})
+ def self.pro_internal_review_transition_label(_opts = {})
State.short_description('internal_review')
end
- def self.pro_error_message_transition_label(opts = {})
+ def self.pro_error_message_transition_label(_opts = {})
State.short_description('error_message')
end
- def self.pro_requires_admin_transition_label(opts = {})
+ def self.pro_requires_admin_transition_label(_opts = {})
State.short_description('requires_admin')
end
- def self.pro_user_withdrawn_transition_label(opts = {})
+ def self.pro_user_withdrawn_transition_label(_opts = {})
State.short_description('user_withdrawn')
end
end
diff --git a/app/models/outgoing_message/template/batch_request.rb b/app/models/outgoing_message/template/batch_request.rb
index bfaab7962d..223f890190 100644
--- a/app/models/outgoing_message/template/batch_request.rb
+++ b/app/models/outgoing_message/template/batch_request.rb
@@ -9,7 +9,7 @@ def body(opts = {})
template_string(opts)
end
- def salutation(replacements = {})
+ def salutation(_replacements = {})
self.class.placeholder_salutation
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index ec91425ef1..e2aa082cad 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -193,7 +193,7 @@ def last_edit_comment_for_html_display
text.gsub(/\n/, ' ')
end
- def compare(previous = nil, &block)
+ def compare(previous = nil)
if previous.nil?
changes = []
else
diff --git a/gems/alaveteli_features/lib/alaveteli_features/constraints.rb b/gems/alaveteli_features/lib/alaveteli_features/constraints.rb
index 803f7d6a43..e68e9bf031 100644
--- a/gems/alaveteli_features/lib/alaveteli_features/constraints.rb
+++ b/gems/alaveteli_features/lib/alaveteli_features/constraints.rb
@@ -7,7 +7,7 @@ def initialize(feature)
@feature = feature
end
- def matches?(request)
+ def matches?(_request)
feature_enabled? @feature
end
end
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index 069093ebe5..fe6c67c8d9 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -102,7 +102,7 @@ def retrieve?(unique_id)
!failed?(unique_id) || retry?(unique_id)
end
- def start(&block)
+ def start()
# Start a POP3 session and ensure that it will be closed in any case.
unless block_given?
raise ArgumentError, "AlaveteliMailPoller#start takes a block"
diff --git a/lib/attachment_to_html/adapter.rb b/lib/attachment_to_html/adapter.rb
index e66298abff..51ce96d7e3 100644
--- a/lib/attachment_to_html/adapter.rb
+++ b/lib/attachment_to_html/adapter.rb
@@ -7,7 +7,7 @@ class Adapter
# attachment - the FoiAttachment to convert to HTML
# opts - a Hash of options (default: {}):
# No options currently accepted
- def initialize(attachment, opts = {})
+ def initialize(attachment, _opts = {})
@attachment = attachment
end
diff --git a/lib/routing_filters.rb b/lib/routing_filters.rb
index 0a5f4f2458..8648fee425 100644
--- a/lib/routing_filters.rb
+++ b/lib/routing_filters.rb
@@ -12,7 +12,7 @@ def prepend_locale?(locale)
# internally and may look like `en-US`, whereas the former is
# what FastGettext and other POSIX-based systems use, and will
# look like `en_US`
- def around_generate(*args, &block)
+ def around_generate(*args)
# this is because we might get a call like forum_topics_path(forum, topic, :locale => :en)
params = args.extract_options!
# extract the passed :locale option
@@ -48,7 +48,7 @@ def locales_pattern
end
ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper.class_eval do
- def self.optimize_helper?(route)
+ def self.optimize_helper?(_route)
false
end
end
diff --git a/lib/stripe_mock_patch.rb b/lib/stripe_mock_patch.rb
index d2144222ce..c8b13b8043 100644
--- a/lib/stripe_mock_patch.rb
+++ b/lib/stripe_mock_patch.rb
@@ -14,7 +14,7 @@ module RequestHandlers::Subscriptions
# set_custom_status_from_metatdata method to set the status
# from the stored info in the subscription metatdata when the
# subscription is retrieved (including calling #refresh)
- def retrieve_subscription(route, method_url, params, headers)
+ def retrieve_subscription(route, method_url, _params, _headers)
route =~ method_url
set_custom_status_from_metadata(subscriptions[$1]) if subscriptions[$1]
@@ -25,7 +25,7 @@ def retrieve_subscription(route, method_url, params, headers)
# set_custom_status_from_metatdata method to set the status
# from the stored info in the subscription metatdata when multiple
# subscriptions are retrieved (including from `Subscription::List`)
- def retrieve_subscriptions(route, method_url, params, headers)
+ def retrieve_subscriptions(route, method_url, params, _headers)
route =~ method_url
subscriptions.values.each do |subscription|
diff --git a/spec/support/mock_pop3.rb b/spec/support/mock_pop3.rb
index bef1a2127e..4a3b18716f 100644
--- a/spec/support/mock_pop3.rb
+++ b/spec/support/mock_pop3.rb
@@ -13,22 +13,22 @@ def self.popmails
@@popmails.clone
end
- def each_mail(*args)
+ def each_mail(*_args)
@@popmails.each do |popmail|
yield popmail
end
end
- def mails(*args)
+ def mails(*_args)
@@popmails.clone
end
- def start(*args)
+ def start(*_args)
@@start = true
block_given? ? yield(self) : self
end
- def enable_ssl(*args)
+ def enable_ssl(*_args)
true
end
From 00e57331f5037abaa82d975000facf42f07f507f Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 12:20:10 +0000
Subject: [PATCH 185/289] Style: Lint/UnusedBlockArgument (Rubocop)
---
.../stripe_webhooks_controller.rb | 2 +-
app/controllers/api_controller.rb | 2 +-
app/controllers/application_controller.rb | 2 +-
app/models/ability.rb | 2 +-
app/models/alaveteli_pro/embargo_extension.rb | 2 +-
app/models/holiday_import.rb | 2 +-
app/models/info_request_event.rb | 2 +-
app/models/public_body.rb | 2 +-
db/migrate/096_create_translation_tables.rb | 2 +-
...1107_create_category_translation_tables.rb | 8 ++++----
lib/acts_as_xapian/acts_as_xapian.rb | 6 +++---
lib/memory_profiler.rb | 4 ++--
lib/tasks/import.rake | 2 +-
lib/use_spans_for_errors.rb | 2 +-
spec/factories/incoming_messages.rb | 6 +++---
spec/factories/info_request_batches.rb | 2 +-
spec/factories/info_request_events.rb | 4 ++--
spec/factories/info_requests.rb | 20 +++++++++----------
spec/factories/track_things.rb | 6 +++---
spec/factories/users.rb | 2 +-
spec/lib/acts_as_xapian_spec.rb | 2 +-
spec/support/email_helpers.rb | 2 +-
spec/support/xml_matchers.rb | 2 +-
23 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/app/controllers/alaveteli_pro/stripe_webhooks_controller.rb b/app/controllers/alaveteli_pro/stripe_webhooks_controller.rb
index a02d0b206d..4bb9f98187 100644
--- a/app/controllers/alaveteli_pro/stripe_webhooks_controller.rb
+++ b/app/controllers/alaveteli_pro/stripe_webhooks_controller.rb
@@ -17,7 +17,7 @@ class UnknownPlanStripeWebhookError < StandardError; end
render json: { error: exception.message }, status: 401
end
- rescue_from UnknownPlanStripeWebhookError do |exception|
+ rescue_from UnknownPlanStripeWebhookError do |_exception|
# accept it so it doesn't get resent but don't process it
# (and don't generate an exception email for it)
render json: { message: 'Does not appear to be one of our plans' },
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index b5a777353a..2f646996b2 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -134,7 +134,7 @@ def add_correspondence
else
# In the 'response' direction, i.e. what we (Alaveteli) regard as incoming
attachment_hashes = []
- (attachments || []).each_with_index do |attachment, i|
+ (attachments || []).each_with_index do |attachment, _i|
filename = File.basename(attachment.original_filename)
attachment_body = attachment.read
content_type = AlaveteliFileTypes.filename_and_content_to_mimetype(filename, attachment_body) || 'application/octet-stream'
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a5782bb414..febfd15bfa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -19,7 +19,7 @@ class RouteNotFound < StandardError
skip_before_action :verify_authenticity_token, unless: :authenticated?
# Deal with access denied errors from CanCan
- rescue_from CanCan::AccessDenied do |exception|
+ rescue_from CanCan::AccessDenied do |_exception|
raise PermissionDenied
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 7ef1689933..645fad5da5 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -106,7 +106,7 @@ def initialize(user, project: nil, public_token: false)
public_token
end
- can :manage, OutgoingMessage::Snippet do |request|
+ can :manage, OutgoingMessage::Snippet do |_request|
user && user.is_admin?
end
diff --git a/app/models/alaveteli_pro/embargo_extension.rb b/app/models/alaveteli_pro/embargo_extension.rb
index 5e223b2f51..bff61e5f15 100644
--- a/app/models/alaveteli_pro/embargo_extension.rb
+++ b/app/models/alaveteli_pro/embargo_extension.rb
@@ -17,6 +17,6 @@ class EmbargoExtension < ApplicationRecord
validates_presence_of :embargo
validates_presence_of :extension_duration
validates_inclusion_of :extension_duration,
- in: lambda { |e| AlaveteliPro::Embargo.new.allowed_durations }
+ in: lambda { |_e| AlaveteliPro::Embargo.new.allowed_durations }
end
end
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index 97166e6442..bb2b954a6c 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -50,7 +50,7 @@ def save!
end
def holidays_attributes=(incoming_data)
- incoming_data.each { |offset, incoming| holidays << Holiday.new(incoming) }
+ incoming_data.each { |_offset, incoming| holidays << Holiday.new(incoming) }
end
def holidays
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 478cfd4ca3..e3451f0a7f 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -358,7 +358,7 @@ def params_diff
other_params[key.to_sym] = value
end
end
- new_params.delete_if { |key, value| ignore.keys.include?(key) }
+ new_params.delete_if { |key, _value| ignore.keys.include?(key) }
{new: new_params, old: old_params, other: other_params}
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index e2aa082cad..acffe9cd75 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -603,7 +603,7 @@ def import_values_from_csv_row(row, line, name, options)
def set_locale_fields_from_csv_row(is_new, locale, row, options)
changed = ActiveSupport::OrderedHash.new
csv_field_names = options[:field_names]
- csv_import_fields.each do |field_name, field_notes|
+ csv_import_fields.each do |field_name, _field_notes|
localized_field_name = self.class.localized_csv_field_name(locale, field_name)
column = csv_field_names[localized_field_name]
value = column && row[column]
diff --git a/db/migrate/096_create_translation_tables.rb b/db/migrate/096_create_translation_tables.rb
index bf3d7b741c..08b6dedf7c 100644
--- a/db/migrate/096_create_translation_tables.rb
+++ b/db/migrate/096_create_translation_tables.rb
@@ -17,7 +17,7 @@ def self.up
# copy current values across to default locale
PublicBody.all.each do |publicbody|
- publicbody.translated_attributes.each do |a, default|
+ publicbody.translated_attributes.each do |a, _default|
value = publicbody.read_attribute(a)
publicbody.send(:"#{a}=", value) unless value.nil?
end
diff --git a/db/migrate/20140716131107_create_category_translation_tables.rb b/db/migrate/20140716131107_create_category_translation_tables.rb
index 84959512be..c550dffb61 100644
--- a/db/migrate/20140716131107_create_category_translation_tables.rb
+++ b/db/migrate/20140716131107_create_category_translation_tables.rb
@@ -14,7 +14,7 @@ def up
# copy current values across to the default locale
PublicBodyCategory.where(locale: default_locale).each do |category|
- category.translated_attributes.each do |a, default|
+ category.translated_attributes.each do |a, _default|
value = category.read_attribute(a)
category.send(:"#{a}=", value) unless value.nil?
end
@@ -25,7 +25,7 @@ def up
PublicBodyCategory.where('locale != ?', default_locale).each do |category|
default_category = PublicBodyCategory.find_by_category_tag_and_locale(category.category_tag, default_locale)
AlaveteliLocalization.with_locale(category.locale) do
- category.translated_attributes.each do |a, default|
+ category.translated_attributes.each do |a, _default|
value = category.read_attribute(a)
unless value.nil?
if default_category
@@ -50,7 +50,7 @@ def up
# copy current values across to the default locale
PublicBodyHeading.where(locale: default_locale).each do |heading|
- heading.translated_attributes.each do |a, default|
+ heading.translated_attributes.each do |a, _default|
value = heading.read_attribute(a)
heading.send(:"#{a}=", value) unless value.nil?
end
@@ -61,7 +61,7 @@ def up
PublicBodyHeading.where('locale != ?', default_locale).each do |heading|
default_heading = PublicBodyHeading.find_by_name_and_locale(heading.name, default_locale)
AlaveteliLocalization.with_locale(heading.locale) do
- heading.translated_attributes.each do |a, default|
+ heading.translated_attributes.each do |a, _default|
value = heading.read_attribute(a)
unless value.nil?
if default_heading
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 9013edf744..57f7484049 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -199,7 +199,7 @@ def self.init_query_parser
@@values_by_prefix = {}
@@value_ranges_store = []
- @@init_values.each do |classname, options|
+ @@init_values.each do |_classname, options|
# go through the various field types, and tell query parser about them,
# and error check them - i.e. check for consistency between models
@@query_parser.add_boolean_prefix("model", "M")
@@ -210,7 +210,7 @@ def self.init_query_parser
end
def self.init_values(values)
- values.each do |method, index, prefix, value_type|
+ values.each do |_method, index, prefix, value_type|
unless index.is_a? Integer
raise "Value index '#{index}' must be an Integer, is #{index.class}"
end
@@ -244,7 +244,7 @@ def self.init_values(values)
end
def self.init_terms(terms)
- terms.each do |method, term_code, prefix|
+ terms.each do |_method, term_code, prefix|
unless term_code.match(/^[A-Z]$/)
raise "Use a single capital letter for term code"
end
diff --git a/lib/memory_profiler.rb b/lib/memory_profiler.rb
index 17f7128460..b7bd56bb78 100644
--- a/lib/memory_profiler.rb
+++ b/lib/memory_profiler.rb
@@ -48,12 +48,12 @@ def self.start(opt={})
end
delta.clear
- (curr.keys + delta.keys).uniq.each do |k,v|
+ (curr.keys + delta.keys).uniq.each do |k,_v|
delta[k] = curr[k]-prev[k]
end
file.puts "Top 20"
- delta.sort_by { |k,v| -v.abs }[0..19].sort_by { |k,v| -v }.each do |k,v|
+ delta.sort_by { |_k,v| -v.abs }[0..19].sort_by { |_k,v| -v }.each do |k,v|
file.printf "%+5d: %s (%d)\n", v, k.name, curr[k] unless v == 0
end
file.flush
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 6c14682e52..5739ccc373 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -59,7 +59,7 @@ namespace :import do
import_args = [tmp_csv.path, tag, tag_behaviour, dryrun, editor, locales]
errors, notes =
- PublicBody.import_csv_from_file(*import_args) do |row_number, fields|
+ PublicBody.import_csv_from_file(*import_args) do |row_number, _fields|
percent_complete = (100 * row_number.to_f / number_of_rows).to_i
STDERR.print "#{row_number} out of #{number_of_rows} "
STDERR.puts "(#{percent_complete}% complete)"
diff --git a/lib/use_spans_for_errors.rb b/lib/use_spans_for_errors.rb
index 55dc7fa853..ec394acc70 100644
--- a/lib/use_spans_for_errors.rb
+++ b/lib/use_spans_for_errors.rb
@@ -8,4 +8,4 @@
#
# See http://dev.rubyonrails.org/ticket/2210
-ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| %(#{html_tag}).html_safe }
+ActionView::Base.field_error_proc = Proc.new { |html_tag, _instance| %(#{html_tag}).html_safe }
diff --git a/spec/factories/incoming_messages.rb b/spec/factories/incoming_messages.rb
index 8a2af65300..da264a5d54 100644
--- a/spec/factories/incoming_messages.rb
+++ b/spec/factories/incoming_messages.rb
@@ -30,7 +30,7 @@
last_parsed { 1.week.ago }
sent_at { 1.week.ago }
- after(:build) do |incoming_message, evaluator|
+ after(:build) do |incoming_message, _evaluator|
incoming_message.foi_attachments << build(
:body_text,
incoming_message: incoming_message,
@@ -54,7 +54,7 @@
last_parsed { nil }
sent_at { nil }
- after(:create) do |incoming_message, evaluator|
+ after(:create) do |incoming_message, _evaluator|
data = load_file_fixture('incoming-request-plain.email')
data.gsub!('EMAIL_FROM', 'Bob Responder ')
incoming_message.raw_email.data = data
@@ -63,7 +63,7 @@
end
factory :incoming_message_with_html_attachment do
- after(:build) do |incoming_message, evaluator|
+ after(:build) do |incoming_message, _evaluator|
incoming_message.foi_attachments << build(
:html_attachment,
incoming_message: incoming_message,
diff --git a/spec/factories/info_request_batches.rb b/spec/factories/info_request_batches.rb
index 686d6fa1a2..1dae2e9ad3 100644
--- a/spec/factories/info_request_batches.rb
+++ b/spec/factories/info_request_batches.rb
@@ -26,7 +26,7 @@
trait :embargoed do
embargo_duration { '3_months' }
- after(:build) do |batch, evaluator|
+ after(:build) do |batch, _evaluator|
batch.info_requests.each do |request|
request.embargo = build(:embargo)
end
diff --git a/spec/factories/info_request_events.rb b/spec/factories/info_request_events.rb
index 0f194d7e5e..3c8a2b839b 100644
--- a/spec/factories/info_request_events.rb
+++ b/spec/factories/info_request_events.rb
@@ -46,7 +46,7 @@
event.info_request = event.outgoing_message.info_request
end
- after(:create) do |evnt, evaluator|
+ after(:create) do |evnt, _evaluator|
evnt.params = evnt.params.merge(
outgoing_message_id: evnt.outgoing_message.id
)
@@ -107,7 +107,7 @@
event.info_request = event.outgoing_message.info_request
end
- after(:create) do |evnt, evaluator|
+ after(:create) do |evnt, _evaluator|
evnt.params = evnt.params.merge(
outgoing_message_id: evnt.outgoing_message.id
)
diff --git a/spec/factories/info_requests.rb b/spec/factories/info_requests.rb
index 7d95524aca..41fb826f53 100644
--- a/spec/factories/info_requests.rb
+++ b/spec/factories/info_requests.rb
@@ -43,7 +43,7 @@
public_body
user
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
initial_request = create(:initial_request, info_request: info_request,
created_at: info_request.created_at)
initial_request.last_sent_at = info_request.created_at
@@ -156,27 +156,27 @@
end
trait :with_internal_review_request do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
outgoing_message = create(:internal_review_request, info_request: info_request)
end
end
trait :embargoed do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
create(:embargo, info_request: info_request)
info_request.reload
end
end
trait :embargo_expiring do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
create(:expiring_embargo, info_request: info_request)
info_request.reload
end
end
trait :re_embargoed do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.log_event('expire_embargo', {})
create(:embargo, info_request: info_request)
info_request
@@ -184,7 +184,7 @@
end
trait :embargo_expired do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.log_event('expire_embargo', info_request: info_request)
info_request.reload
end
@@ -213,13 +213,13 @@
end
trait :waiting_clarification do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.set_described_state('waiting_clarification')
end
end
trait :successful do
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.set_described_state('successful')
end
end
@@ -244,7 +244,7 @@
trait :overdue do
date_response_required_by { Time.zone.now - 1.day }
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.date_response_required_by = Time.zone.now - 1.day
info_request.save!
end
@@ -253,7 +253,7 @@
trait :very_overdue do
date_response_required_by { Time.zone.now - 21.days }
date_very_overdue_after { Time.zone.now - 1.days }
- after(:create) do |info_request, evaluator|
+ after(:create) do |info_request, _evaluator|
info_request.date_response_required_by = Time.zone.now - 21.days
info_request.date_very_overdue_after = Time.zone.now - 1.day
info_request.save!
diff --git a/spec/factories/track_things.rb b/spec/factories/track_things.rb
index 545e52fe93..125bb499b4 100644
--- a/spec/factories/track_things.rb
+++ b/spec/factories/track_things.rb
@@ -26,7 +26,7 @@
factory :user_track do
association :tracked_user, factory: :user
track_type { 'user_updates' }
- after(:create) do |track_thing, evaluator|
+ after(:create) do |track_thing, _evaluator|
track_thing.track_query = "requested_by:#{ user.url_name }" \
" OR commented_by: #{ user.url_name }"
track_thing.save!
@@ -35,7 +35,7 @@
factory :public_body_track do
association :public_body, factory: :public_body
track_type { 'public_body_updates' }
- after(:create) do |track_thing, evaluator|
+ after(:create) do |track_thing, _evaluator|
track_thing.track_query = "requested_from:" \
"#{ track_thing.public_body.url_name }"
track_thing.save!
@@ -44,7 +44,7 @@
factory :request_update_track do
association :info_request, factory: :info_request
track_type { 'request_updates' }
- after(:create) do |track_thing, evaluator|
+ after(:create) do |track_thing, _evaluator|
track_thing.track_query = "request:" \
"#{ track_thing.info_request.url_title }"
track_thing.save!
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index cf17872cdb..62315d415e 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -63,7 +63,7 @@
sequence(:name) { |n| "Pro User #{n}" }
pro
- after(:create) do |user, evaluator|
+ after(:create) do |user, _evaluator|
create(:pro_account, user: user)
end
end
diff --git a/spec/lib/acts_as_xapian_spec.rb b/spec/lib/acts_as_xapian_spec.rb
index 9f4d844e61..e7496d9182 100644
--- a/spec/lib/acts_as_xapian_spec.rb
+++ b/spec/lib/acts_as_xapian_spec.rb
@@ -7,7 +7,7 @@
describe '.update_index' do
it 'processes jobs that were queued after a job that errors' do
- job1, job2 = Array.new(2) do |i|
+ job1, job2 = Array.new(2) do |_i|
body = FactoryBot.create(:public_body)
body.xapian_mark_needs_index
ActsAsXapian::ActsAsXapianJob.
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb
index 1f4d84699f..64f6bf5fc9 100644
--- a/spec/support/email_helpers.rb
+++ b/spec/support/email_helpers.rb
@@ -1,6 +1,6 @@
def load_raw_emails_data
raw_emails_yml = File.join(RSpec.configuration.fixture_path, "raw_emails.yml")
- YAML.load_file(raw_emails_yml).map { |k,v| v["id"] }.each do |raw_email_id|
+ YAML.load_file(raw_emails_yml).map { |_k,v| v["id"] }.each do |raw_email_id|
raw_email = RawEmail.find(raw_email_id)
raw_email.data = load_file_fixture(format("raw_emails/%d.email", raw_email_id))
end
diff --git a/spec/support/xml_matchers.rb b/spec/support/xml_matchers.rb
index 2d34fd2959..498c37c4c1 100644
--- a/spec/support/xml_matchers.rb
+++ b/spec/support/xml_matchers.rb
@@ -17,7 +17,7 @@
"expected to find xml tag #{xpath} in:\n#{body}"
end
- failure_message_when_negated do |response|
+ failure_message_when_negated do |_response|
"expected not to find xml tag #{xpath} in:\n#{body}"
end
From 01c41ed08e50b7af10fc51bc6c674bc2b256ef1b Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 12:22:30 +0000
Subject: [PATCH 186/289] Style: Lint/AmbiguousRegexpLiteral (Rubocop)
---
lib/tasks/import.rake | 2 +-
spec/controllers/general_controller_spec.rb | 2 +-
spec/controllers/request_controller_spec.rb | 8 +++----
spec/integration/localisation_spec.rb | 24 +++++++++----------
.../post_redirect_handler_spec.rb | 2 +-
spec/lib/mail_handler/mail_handler_spec.rb | 2 +-
.../alaveteli_pro/request_summary_spec.rb | 2 +-
spec/views/request/show.html.erb_spec.rb | 4 ++--
8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 5739ccc373..8b0531799d 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -23,7 +23,7 @@ namespace :import do
name_count = Hash.new { 0 }
reader = CSV.open(tmp_csv.path, 'r')
header_line = reader.shift
- headers = header_line.map { |h| h.gsub /^#/, '' }
+ headers = header_line.map { |h| h.gsub(/^#/, '') }
reader.each do |row_array|
row = Hash[headers.zip row_array]
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index 3ced23cfd9..d16cc5ad27 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -160,7 +160,7 @@
it "should use our test PO files rather than the application one" do
get :frontpage, params: { locale: 'es' }
- expect(response.body).to match /XOXO/
+ expect(response.body).to match(/XOXO/)
end
end
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index 7167f4a15d..e0af8a9bad 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1732,8 +1732,8 @@ def send_request
sign_in users(:bob_smith_user)
get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
- expect(s).to contain /Silly.*left an annotation/m
- expect(s).not_to contain /You.*left an annotation/m
+ expect(s).to contain(/Silly.*left an annotation/m)
+ expect(s).not_to contain(/You.*left an annotation/m)
end
end
@@ -1741,8 +1741,8 @@ def send_request
sign_in users(:silly_name_user)
get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
- expect(s).to contain /Silly.*left an annotation/m
- expect(s).not_to contain /You.*left an annotation/m
+ expect(s).to contain(/Silly.*left an annotation/m)
+ expect(s).not_to contain(/You.*left an annotation/m)
end
end
diff --git a/spec/integration/localisation_spec.rb b/spec/integration/localisation_spec.rb
index 583351e05d..c228749051 100644
--- a/spec/integration/localisation_spec.rb
+++ b/spec/integration/localisation_spec.rb
@@ -9,7 +9,7 @@
it "should generate URLs that include the locale when using one that includes an underscore" do
AlaveteliLocalization.set_locales('es en_GB', 'es')
get '/en_GB'
- expect(response.body).to match /href="\/en_GB\//
+ expect(response.body).to match(/href="\/en_GB\//)
end
it "returns a 404 error if passed the locale with a hyphen instead of an underscore", local_requests: false do
@@ -20,20 +20,20 @@
it "should fall back to the language if the territory is unknown" do
AlaveteliLocalization.set_locales('es en', 'en')
get '/', headers: { 'HTTP_ACCEPT_LANGUAGE' => 'en_US' }
- expect(response.body).to match /href="\/en\//
- expect(response.body).not_to match /href="\/en_US\//
+ expect(response.body).to match(/href="\/en\//)
+ expect(response.body).not_to match(/href="\/en_US\//)
end
it 'falls back to the default if the requested locale is unavailable' do
get '/', params: { locale: "unknown" }
- expect(response.body).to match /href="\/en\//
- expect(response.body).not_to match /href="\/unknown\//
+ expect(response.body).to match(/href="\/en\//)
+ expect(response.body).not_to match(/href="\/unknown\//)
end
it "should generate URLs without a locale prepended when there's only one locale set" do
AlaveteliLocalization.set_locales('en', 'en')
get '/'
- expect(response).not_to match /#{@home_link_regex}/
+ expect(response).not_to match(/#{@home_link_regex}/)
end
context 'when handling public body requests' do
@@ -90,8 +90,8 @@
it 'should generate URLs without a locale prepended' do
get '/'
- expect(response.body).to match /class="current-locale">English/
- expect(response.body).not_to match /#{@default_lang_home_link}/
+ expect(response.body).to match(/class="current-locale">English/)
+ expect(response.body).not_to match(/#{@default_lang_home_link}/)
end
describe "when the default url contains an underscore" do
@@ -99,7 +99,7 @@
it "generates URLs without a locale prepended" do
AlaveteliLocalization.set_locales('en_GB es', 'en_GB')
get '/'
- expect(response.body).not_to match /href="\/en_GB\//
+ expect(response.body).not_to match(/href="\/en_GB\//)
end
end
@@ -107,7 +107,7 @@
it 'should render the front page in the default language when no locale param
is present and the session locale is not the default' do
get '/', headers: { locale: 'es' }
- expect(response.body).to match /class="current-locale">English/
+ expect(response.body).to match(/class="current-locale">English/)
end
end
@@ -120,8 +120,8 @@
it 'should generate URLs with a locale prepended' do
get '/'
- expect(response.body).to match /class="current-locale">English/
- expect(response.body).to match /#{@default_lang_home_link}/
+ expect(response.body).to match(/class="current-locale">English/)
+ expect(response.body).to match(/#{@default_lang_home_link}/)
end
end
diff --git a/spec/lib/alaveteli_pro/post_redirect_handler_spec.rb b/spec/lib/alaveteli_pro/post_redirect_handler_spec.rb
index d8bd6189e3..397685f083 100644
--- a/spec/lib/alaveteli_pro/post_redirect_handler_spec.rb
+++ b/spec/lib/alaveteli_pro/post_redirect_handler_spec.rb
@@ -28,7 +28,7 @@
it "overrides the uri" do
expect(
controller.override_post_redirect_for_pro(uri, post_redirect, user)
- ).to match /#{new_alaveteli_pro_info_request_path}\?draft_id=\d+/
+ ).to match(/#{new_alaveteli_pro_info_request_path}\?draft_id=\d+/)
end
end
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index f2434312cf..9d5e302ad5 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -34,7 +34,7 @@ def create_message_from(from_field)
it 'should convert an iso8859 email to utf8' do
mail = get_fixture_mail('iso8859_2_raw_email.email')
- expect(mail.subject).to match /gjatë/u
+ expect(mail.subject).to match(/gjatë/u)
expect(MailHandler.get_part_body(mail).is_utf8?).to eq(true)
end
diff --git a/spec/models/alaveteli_pro/request_summary_spec.rb b/spec/models/alaveteli_pro/request_summary_spec.rb
index d6b159511c..30da118b53 100644
--- a/spec/models/alaveteli_pro/request_summary_spec.rb
+++ b/spec/models/alaveteli_pro/request_summary_spec.rb
@@ -96,7 +96,7 @@
expect(updated_summary.title).to eq batch.title
expect(updated_summary.body).to eq batch.body
expect(updated_summary.public_body_names).
- to match /.*#{public_body.name}.*/
+ to match(/.*#{public_body.name}.*/)
expect(updated_summary.summarisable).to eq batch
expect(updated_summary.user).to eq batch.user
expected_categories = [
diff --git a/spec/views/request/show.html.erb_spec.rb b/spec/views/request/show.html.erb_spec.rb
index 6e1cb15c4a..3c52f840e3 100644
--- a/spec/views/request/show.html.erb_spec.rb
+++ b/spec/views/request/show.html.erb_spec.rb
@@ -277,7 +277,7 @@ def request_page
assign :track_thing, TrackThing.create_track_for_request(request_with_attachment)
render
expect(rendered).to have_css(".attachment .attachment__name") do |s|
- expect(s).to contain /interesting.pdf/m
+ expect(s).to contain(/interesting.pdf/m)
end
end
end
@@ -300,7 +300,7 @@ def request_page
# Note that the censor rule applies to the original filename,
# not the display_filename:
expect(rendered).to have_css(".attachment .attachment__name") do |s|
- expect(s).to contain /Mouse.pdf/m
+ expect(s).to contain(/Mouse.pdf/m)
end
end
end
From 7a9e0c053f3c1beb3447cd5b40ce46b07a539023 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 12:24:44 +0000
Subject: [PATCH 187/289] Style: Lint/ParenthesesAsGroupedExpression (Rubocop)
---
spec/controllers/request_controller_spec.rb | 4 ++--
.../public_body_change_request_spec.rb | 2 +-
spec/mailers/notification_mailer_spec.rb | 2 +-
.../draft_info_request_batch_spec.rb | 2 +-
spec/models/info_request_batch_spec.rb | 2 +-
spec/models/info_request_event_spec.rb | 4 ++--
spec/models/info_request_spec.rb | 16 ++++++++--------
.../shared_examples_for_viewing_requests.rb | 2 +-
8 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index e0af8a9bad..a7ffcfe862 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -315,7 +315,7 @@ def make_request
it "should set @sidebar_template to the pro sidebar" do
expect(assigns[:sidebar_template]).
- to eq ("alaveteli_pro/info_requests/sidebar")
+ to eq("alaveteli_pro/info_requests/sidebar")
end
end
@@ -329,7 +329,7 @@ def make_request
end
it "should set @sidebar_template to the normal sidebar" do
- expect(assigns[:sidebar_template]).to eq ("sidebar")
+ expect(assigns[:sidebar_template]).to eq("sidebar")
end
end
diff --git a/spec/integration/public_body_change_request_spec.rb b/spec/integration/public_body_change_request_spec.rb
index 9e50826c8c..3f6c74b540 100644
--- a/spec/integration/public_body_change_request_spec.rb
+++ b/spec/integration/public_body_change_request_spec.rb
@@ -13,7 +13,7 @@
it "should not forget which public body you are updating during login" do
visit show_public_body_path(url_name: public_body.url_name)
click_link("Ask us to update FOI email")
- click_link ("sign in")
+ click_link("sign in")
fill_in :user_signin_email, with: user.email
fill_in :user_signin_password, with: "jonespassword"
diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb
index 69d8e6c3e5..06dc28f7ec 100644
--- a/spec/mailers/notification_mailer_spec.rb
+++ b/spec/mailers/notification_mailer_spec.rb
@@ -380,7 +380,7 @@
it "sets the right subject line" do
mail = NotificationMailer.daily_summary(user, all_notifications)
expect(mail.subject).
- to eq ("Your daily request summary from Alaveteli Professional")
+ to eq("Your daily request summary from Alaveteli Professional")
end
it "matches the expected message" do
diff --git a/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb b/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
index 5c8c104d3f..f1aaeb2ecf 100644
--- a/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
+++ b/spec/models/alaveteli_pro/draft_info_request_batch_spec.rb
@@ -41,7 +41,7 @@
public_bodies: [public_body1, public_body2],
user: pro_user)
draft.reload
- expect(draft.public_bodies).to eq ([public_body2, public_body1])
+ expect(draft.public_bodies).to eq([public_body2, public_body1])
end
it 'returns a distinct list of associated public bodies' do
diff --git a/spec/models/info_request_batch_spec.rb b/spec/models/info_request_batch_spec.rb
index d09bd2c444..ba53794930 100644
--- a/spec/models/info_request_batch_spec.rb
+++ b/spec/models/info_request_batch_spec.rb
@@ -267,7 +267,7 @@
public_bodies: [first_public_body,
third_public_body])
batch.reload
- expect(batch.public_bodies).to eq ([third_public_body,
+ expect(batch.public_bodies).to eq([third_public_body,
first_public_body])
end
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index a55967fd52..aa91c48e32 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -529,8 +529,8 @@
end
describe '#destroy' do
- let (:info_request) { FactoryBot.create(:info_request) }
- let (:event) { InfoRequestEvent.create(info_request: info_request,
+ let(:info_request) { FactoryBot.create(:info_request) }
+ let(:event) { InfoRequestEvent.create(info_request: info_request,
event_type: 'sent',
params: {})
}
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index f9c19010d6..01553af038 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -3614,28 +3614,28 @@ def apply_filters(filters)
shared_examples_for "a situation when everything is public" do
it "doesn't add a suffix for anyone" do
- expect(request.make_zip_cache_path(nil)).to eq (path)
- expect(request.make_zip_cache_path(non_owner)).to eq (path)
- expect(request.make_zip_cache_path(admin)).to eq (path)
- expect(request.make_zip_cache_path(owner)).to eq (path)
+ expect(request.make_zip_cache_path(nil)).to eq(path)
+ expect(request.make_zip_cache_path(non_owner)).to eq(path)
+ expect(request.make_zip_cache_path(admin)).to eq(path)
+ expect(request.make_zip_cache_path(owner)).to eq(path)
end
end
shared_examples_for "a situation when anything is not public" do
it "doesn't add a suffix for anonymous users" do
- expect(request.make_zip_cache_path(nil)).to eq (path)
+ expect(request.make_zip_cache_path(nil)).to eq(path)
end
it "doesn't add a suffix for non owner users" do
- expect(request.make_zip_cache_path(non_owner)).to eq (path)
+ expect(request.make_zip_cache_path(non_owner)).to eq(path)
end
it "adds a _hidden suffix for admin users" do
- expect(request.make_zip_cache_path(admin)).to eq (hidden_path)
+ expect(request.make_zip_cache_path(admin)).to eq(hidden_path)
end
it "adds a requester_only suffix for owner users" do
- expect(request.make_zip_cache_path(owner)).to eq (requester_only_path)
+ expect(request.make_zip_cache_path(owner)).to eq(requester_only_path)
end
end
diff --git a/spec/support/shared_examples_for_viewing_requests.rb b/spec/support/shared_examples_for_viewing_requests.rb
index 6396c5907f..bd76640831 100644
--- a/spec/support/shared_examples_for_viewing_requests.rb
+++ b/spec/support/shared_examples_for_viewing_requests.rb
@@ -122,7 +122,7 @@
click_button("Update")
end
expect(info_request.reload.described_state).
- to eq ("partially_successful")
+ to eq("partially_successful")
expect(page).to have_content("Your request has been updated!")
# The form should still be there to allow us to go back if we
# updated by mistake
From 8a1b5b036c73bdedc43e33c7d632449ca2929b77 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 12:33:17 +0000
Subject: [PATCH 188/289] Style: Lint/RedundantStringCoercion (Rubocop)
---
app/models/public_body.rb | 2 +-
config/application.rb | 4 ++--
db/migrate/099_move_raw_email_to_filesystem.rb | 2 +-
lib/acts_as_xapian/acts_as_xapian.rb | 6 +++---
spec/lib/mail_handler/mail_handler_spec.rb | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index acffe9cd75..0803b38255 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -528,7 +528,7 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
email.strip! unless email.nil?
if !email.nil? && !email.empty? && !MySociety::Validate.is_valid_email(email)
- errors.push "error: line #{line.to_s}: invalid email '#{email}' for authority '#{name}'"
+ errors.push "error: line #{line}: invalid email '#{email}' for authority '#{name}'"
next
end
diff --git a/config/application.rb b/config/application.rb
index b878c700ce..ef52d7f85f 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -79,8 +79,8 @@ class Application < Rails::Application
app.routes.append { match '*path', to: 'general#not_found', via: [:get, :post] }
end
- config.autoload_paths << "#{Rails.root.to_s}/app/controllers/concerns"
- config.autoload_paths << "#{Rails.root.to_s}/app/models/concerns"
+ config.autoload_paths << "#{Rails.root}/app/controllers/concerns"
+ config.autoload_paths << "#{Rails.root}/app/models/concerns"
config.enable_dependency_loading = true
diff --git a/db/migrate/099_move_raw_email_to_filesystem.rb b/db/migrate/099_move_raw_email_to_filesystem.rb
index 5390f7c22b..e764579e65 100644
--- a/db/migrate/099_move_raw_email_to_filesystem.rb
+++ b/db/migrate/099_move_raw_email_to_filesystem.rb
@@ -2,7 +2,7 @@ class MoveRawEmailToFilesystem < ActiveRecord::Migration[4.2] # 2.3
def self.up
RawEmail.find_each(batch_size: 10) do |raw_email|
unless File.exist?(raw_email.filepath)
- STDERR.puts "converting raw_email #{raw_email.id.to_s}"
+ STDERR.puts "converting raw_email #{raw_email.id}"
raw_email.data = raw_email.dbdata
end
end
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 57f7484049..5ca5d3f84d 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -777,7 +777,7 @@ def self.update_index(flush = false, verbose = false)
def self.run_job(job, flush, verbose)
if verbose
- STDOUT.puts("ActsAsXapian.update_index #{job.action} #{job.model} #{job.model_id.to_s} #{Time.now.to_s}")
+ STDOUT.puts("ActsAsXapian.update_index #{job.action} #{job.model} #{job.model_id} #{Time.now}")
end
begin
@@ -854,7 +854,7 @@ def self.destroy_and_rebuild_index(model_classes, verbose = false, terms = true,
# Save time by running the indexing in one go and in-process
model_classes.each do |model_class|
if verbose
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: Rebuilding #{model_class.to_s}")
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: Rebuilding #{model_class}")
end
model_class.find_each do |model|
if verbose
@@ -916,7 +916,7 @@ def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values
@@db_path = ActsAsXapian.db_path + ".new"
ActsAsXapian.writable_init
if verbose
- STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: New batch. #{model_class.to_s} from #{i} to #{i + batch_size} of #{model_class_count} pid #{Process.pid.to_s}")
+ STDOUT.puts("ActsAsXapian.destroy_and_rebuild_index: New batch. #{model_class} from #{i} to #{i + batch_size} of #{model_class_count} pid #{Process.pid}")
end
model_class.limit(batch_size).offset(i).order(:id).each do |model|
if verbose
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index 9d5e302ad5..6bba6524e1 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -11,7 +11,7 @@ def create_message_from(from_field)
it "should be able to parse a large email without raising an exception" do
m = Mail.new
m.add_file(filename: "attachment.data", content: "a" * (8 * 1024 * 1024))
- raw_email = "From jamis_buck@byu.edu Mon May 2 16:07:05 2005\r\n#{m.to_s}"
+ raw_email = "From jamis_buck@byu.edu Mon May 2 16:07:05 2005\r\n#{m}"
expect { Mail::Message.new(raw_email) }.not_to raise_error
end
From 348a91bb8488b694beb333a226ed19af014c3471 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 15:18:40 +0000
Subject: [PATCH 189/289] Style: Lint/AssignmentInCondition (Rubocop)
---
app/controllers/concerns/translatable_params.rb | 2 +-
app/helpers/highlight_helper.rb | 2 +-
app/models/alaveteli_pro/embargo.rb | 2 +-
app/models/info_request.rb | 2 +-
app/models/public_body.rb | 4 ++--
app/models/public_body_heading.rb | 2 +-
lib/mail_handler/backends/mail_backend.rb | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/controllers/concerns/translatable_params.rb b/app/controllers/concerns/translatable_params.rb
index a1c4d79630..add0f7f0e4 100644
--- a/app/controllers/concerns/translatable_params.rb
+++ b/app/controllers/concerns/translatable_params.rb
@@ -44,7 +44,7 @@ def translation_keys
end
def slice_translations_params(sliced_params)
- if translation_params = sliced_params[:translations_attributes]
+ if (translation_params = sliced_params[:translations_attributes])
translation_params.each do |locale, attributes|
translation_params[locale] = attributes.slice(*translation_keys)
end
diff --git a/app/helpers/highlight_helper.rb b/app/helpers/highlight_helper.rb
index d8fee963d0..ec1c77179d 100644
--- a/app/helpers/highlight_helper.rb
+++ b/app/helpers/highlight_helper.rb
@@ -51,7 +51,7 @@ def excerpt(text, phrase, options = {})
regex = /#{Regexp.escape(phrase)}/i
end
- return unless matches = text.match(regex)
+ return unless (matches = text.match(regex))
phrase = matches[0]
unless separator.empty?
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index 588e1087ad..950ca5ca63 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -161,7 +161,7 @@ def set_expiring_notification_at
def notify_expiration
if info_request.use_notifications?
- if event = info_request.last_embargo_expire_event
+ if (event = info_request.last_embargo_expire_event)
info_request.user.notify(event)
end
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 253387d8df..cb6ddda4c7 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1440,7 +1440,7 @@ def who_can_followup_to(skip_message = nil)
ret = []
done = {}
if skip_message
- if email = OutgoingMailer.email_for_followup(self, skip_message)
+ if (email = OutgoingMailer.email_for_followup(self, skip_message))
done[email.downcase] = 1
end
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 0803b38255..e192d0a131 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -422,8 +422,8 @@ def self.internal_admin_body
if matching_pbs.empty?
# "internal admin" exists but has the wrong default locale - fix & return
- if invalid_locale = PublicBody::Translation.
- find_by_url_name('internal_admin_authority')
+ if (invalid_locale = PublicBody::Translation.
+ find_by_url_name('internal_admin_authority'))
found_pb = PublicBody.find(invalid_locale.public_body_id)
AlaveteliLocalization.
with_locale(AlaveteliLocalization.default_locale) do
diff --git a/app/models/public_body_heading.rb b/app/models/public_body_heading.rb
index 2ba476523b..95b9d0d73a 100644
--- a/app/models/public_body_heading.rb
+++ b/app/models/public_body_heading.rb
@@ -45,7 +45,7 @@ def add_category(category)
end
def self.next_display_order
- if max = maximum(:display_order)
+ if (max = maximum(:display_order))
max + 1
else
0
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 03d8a7ce7f..6becb79062 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -350,7 +350,7 @@ def extract_attached_message_headers(leaf)
if leaf.within_rfc822_attachment == leaf && get_content_type(leaf) == 'text/plain'
headers = ""
%w[Date Subject From To Cc].each do |header|
- if header_value = get_header_string(header, leaf.within_rfc822_attachment)
+ if (header_value = get_header_string(header, leaf.within_rfc822_attachment))
unless header_value.blank?
headers = headers + header + ": " + header_value.to_s + "\n"
end
From 1539b508514a8a7e4a87444a924a86f4dd003961 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 15:26:25 +0000
Subject: [PATCH 190/289] Style: Lint/UselessAccessModifier (Rubocop)
---
app/helpers/info_request_helper.rb | 2 --
app/models/alaveteli_pro/request_summary.rb | 2 --
app/models/alaveteli_pro/to_do_list/list.rb | 2 --
app/models/info_request/state/transitions.rb | 2 --
lib/data_export.rb | 2 --
5 files changed, 10 deletions(-)
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index d2879cd827..1ef7a7cd9b 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -300,8 +300,6 @@ def details_help_link(public_body)
link_to _('details'), help_requesting_path(anchor: anchor)
end
- private
-
def attachment_params(attachment, options = {})
attach_params = {
incoming_message_id: attachment.incoming_message_id,
diff --git a/app/models/alaveteli_pro/request_summary.rb b/app/models/alaveteli_pro/request_summary.rb
index 6c5a6c2a6f..1ac859fe76 100644
--- a/app/models/alaveteli_pro/request_summary.rb
+++ b/app/models/alaveteli_pro/request_summary.rb
@@ -69,8 +69,6 @@ def update_from(request)
update(self.class.attributes_from_request(request))
end
- private
-
def self.create_from(request)
create(attributes_from_request(request))
end
diff --git a/app/models/alaveteli_pro/to_do_list/list.rb b/app/models/alaveteli_pro/to_do_list/list.rb
index 506f6cbb10..4d56d0a196 100644
--- a/app/models/alaveteli_pro/to_do_list/list.rb
+++ b/app/models/alaveteli_pro/to_do_list/list.rb
@@ -16,8 +16,6 @@ def active_items
items.select { |item| item.count > 0 }
end
- private
-
def self.item_types
[ ToDoList::NewResponse,
ToDoList::ExpiringEmbargo,
diff --git a/app/models/info_request/state/transitions.rb b/app/models/info_request/state/transitions.rb
index 98f0f66836..149719910a 100644
--- a/app/models/info_request/state/transitions.rb
+++ b/app/models/info_request/state/transitions.rb
@@ -57,8 +57,6 @@ def self.labelled_hash(states, opts = {})
hash
end
- private
-
def self.owner_waiting_response_transition_label(_opts = {})
_("I'm still waiting for my information (maybe you got an acknowledgement)")
end
diff --git a/lib/data_export.rb b/lib/data_export.rb
index dda50e6bfe..085fca6cab 100644
--- a/lib/data_export.rb
+++ b/lib/data_export.rb
@@ -167,8 +167,6 @@ def self.is_required?(model_name, to_run)
to_run.include?(model_name)
end
- private
-
def self.handle_error(err, data)
p "---"
puts "Error processing data:"
From 1a5e0bdf5543aed8b62b96a98dde47a4ebc90ee7 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 3 Mar 2023 15:44:23 +0000
Subject: [PATCH 191/289] Style: Lint/Loop (Rubocop)
---
lib/tasks/cleanup.rake | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 6ae2682505..5239dc8234 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -33,10 +33,11 @@ namespace :cleanup do
user.with_lock do
display_user(user, spam_score)
- begin
+ loop do
puts "Is this a spam account? [(Y)es/(n)o/(s)kip]"
input = $stdin.gets.strip
- end until %w(Y n s).include?(input)
+ break if %w(Y n s).include?(input)
+ end
case input
when 'Y'
From 4f50ef2fc8f9ba7d6fe3254f8637149651e4e1c8 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:28:05 +0000
Subject: [PATCH 192/289] Style: RedundantCapitalW (RuboCop)
---
spec/models/public_body_spec.rb | 26 +++++++++----------
.../reply_to_address_validator_spec.rb | 2 +-
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 6c61f5aaa9..69b43d615d 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1449,7 +1449,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'add', false, 'someadmin')
- expected = %W(imported)
+ expected = %w(imported)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1462,7 +1462,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'add', false, 'someadmin')
- expected = %W(first_tag imported second_tag)
+ expected = %w(first_tag imported second_tag)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1475,7 +1475,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'replace', false, 'someadmin')
- expected = %W(imported)
+ expected = %w(imported)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1488,7 +1488,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'replace', false, 'someadmin')
- expected = %W(first_tag imported second_tag)
+ expected = %w(first_tag imported second_tag)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1509,7 +1509,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
errors, notes = PublicBody.import_csv(csv, 'imported', 'add', false, 'someadmin')
- expected = %W(imported)
+ expected = %w(imported)
expect(errors).to include("error: line 2: Name Name is already taken for authority 'Existing Body'")
end
@@ -1529,7 +1529,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'add', false, 'someadmin')
- expected = %W(first_tag imported new_tag second_tag)
+ expected = %w(first_tag imported new_tag second_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
@@ -1542,7 +1542,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, 'imported', 'replace', false, 'someadmin')
- expected = %W(first_tag imported new_tag)
+ expected = %w(first_tag imported new_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
@@ -1576,7 +1576,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'add', false, 'someadmin')
- expected = %W(first_tag)
+ expected = %w(first_tag)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1602,7 +1602,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'replace', false, 'someadmin')
- expected = %W(first_tag)
+ expected = %w(first_tag)
expect(PublicBody.find_by_name('Quango').tag_array_for_search).to eq(expected)
end
@@ -1636,7 +1636,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'add', false, 'someadmin')
- expected = %W(new_tag)
+ expected = %w(new_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
@@ -1662,7 +1662,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'replace', false, 'someadmin')
- expected = %W(new_tag)
+ expected = %w(new_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
@@ -1683,7 +1683,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'add', false, 'someadmin')
- expected = %W(first_tag new_tag second_tag)
+ expected = %w(first_tag new_tag second_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
@@ -1696,7 +1696,7 @@ def set_default_attributes(public_body)
# csv, tag, tag_behaviour, dry_run, editor
PublicBody.import_csv(csv, '', 'replace', false, 'someadmin')
- expected = %W(first_tag new_tag)
+ expected = %w(first_tag new_tag)
expect(PublicBody.find(@body.id).tag_array_for_search).to eq(expected)
end
diff --git a/spec/validators/reply_to_address_validator_spec.rb b/spec/validators/reply_to_address_validator_spec.rb
index 09e3fcf88a..0745c6194d 100644
--- a/spec/validators/reply_to_address_validator_spec.rb
+++ b/spec/validators/reply_to_address_validator_spec.rb
@@ -37,7 +37,7 @@
described_class::DEFAULT_INVALID_REPLY_ADDRESSES
end
- it { is_expected.to eq(%W(a@example.com)) }
+ it { is_expected.to eq(%w(a@example.com)) }
end
end
From 4c450e23434bb378029778ba4853fcfb5bdd4dcc Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:30:08 +0000
Subject: [PATCH 193/289] Style: Semicolon (RuboCop)
---
app/controllers/admin_controller.rb | 2 +-
.../alaveteli_pro/info_requests_controller.rb | 3 ++-
app/controllers/public_body_controller.rb | 5 ++++-
app/controllers/request_controller.rb | 5 ++++-
db/migrate/053_acts_as_xapian_migration.rb | 5 ++++-
lib/acts_as_xapian/acts_as_xapian.rb | 3 ++-
lib/mail_handler/reply_handler.rb | 4 ++--
spec/models/post_redirect_spec.rb | 4 ++--
spec/models/public_body_spec.rb | 10 ++++++++--
9 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 58d3eac8b0..1672a3b709 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -33,7 +33,7 @@ def admin_http_auth_user
elsif request.env["HTTP_X_FORWARDED_USER"]
request.env["HTTP_X_FORWARDED_USER"]
else
- "*unknown*";
+ "*unknown*"
end
end
diff --git a/app/controllers/alaveteli_pro/info_requests_controller.rb b/app/controllers/alaveteli_pro/info_requests_controller.rb
index bbdeb30def..d751e985b4 100644
--- a/app/controllers/alaveteli_pro/info_requests_controller.rb
+++ b/app/controllers/alaveteli_pro/info_requests_controller.rb
@@ -30,7 +30,8 @@ def new
else
create_initial_objects
end
- check_public_body_is_requestable; return if performed?
+ check_public_body_is_requestable
+ return if performed?
end
def preview
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index 6a344797ca..b4eb2eb541 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -86,7 +86,10 @@ def show
has_json: true } ]
respond_to do |format|
- format.html { @has_json = true; render template: "public_body/show" }
+ format.html do
+ @has_json = true
+ render template: "public_body/show"
+ end
format.json { render json: @public_body.json_for_api }
end
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 055180c5c6..c982401635 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -95,7 +95,10 @@ def show
@feed_autodetect = [ { url: do_track_url(@track_thing, 'feed'), title: @track_thing.params[:title_in_rss], has_json: true } ]
respond_to do |format|
- format.html { @has_json = true; render template: 'request/show' }
+ format.html do
+ @has_json = true
+ render template: 'request/show'
+ end
format.json { render json: @info_request.json_for_api(true) }
end
end
diff --git a/db/migrate/053_acts_as_xapian_migration.rb b/db/migrate/053_acts_as_xapian_migration.rb
index c5965291c5..1281bb494d 100644
--- a/db/migrate/053_acts_as_xapian_migration.rb
+++ b/db/migrate/053_acts_as_xapian_migration.rb
@@ -11,7 +11,10 @@ def self.up
remove_index :info_requests, :solr_up_to_date
remove_column :info_requests, :solr_up_to_date
- InfoRequest.find_each { |i| i.calculate_event_states; STDERR.puts "calculate_event_states " + i.id.to_s }
+ InfoRequest.find_each do |i|
+ i.calculate_event_states
+ STDERR.puts "calculate_event_states " + i.id.to_s
+ end
end
def self.down
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 5ca5d3f84d..2e9b18c947 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -321,7 +321,8 @@ def initialize_query(options)
#raise options.to_yaml
self.runtime += Benchmark.realtime {
- offset = options[:offset] || 0; offset = offset.to_i
+ offset = options[:offset] || 0
+ offset = offset.to_i
limit = options[:limit]
unless limit
raise "please specifiy maximum number of results to return with parameter :limit"
diff --git a/lib/mail_handler/reply_handler.rb b/lib/mail_handler/reply_handler.rb
index af7b917c43..9133437db2 100644
--- a/lib/mail_handler/reply_handler.rb
+++ b/lib/mail_handler/reply_handler.rb
@@ -82,8 +82,8 @@ def self.is_oof?(message)
def self.forward_on(raw_message, message = nil)
forward_to = get_forward_to_address(message)
IO.popen(%Q(/usr/sbin/sendmail -i "#{forward_to}"), 'wb') do |f|
- f.write(raw_message);
- f.close;
+ f.write(raw_message)
+ f.close
end
end
diff --git a/spec/models/post_redirect_spec.rb b/spec/models/post_redirect_spec.rb
index e8f89c9ae8..cac55bd3dd 100644
--- a/spec/models/post_redirect_spec.rb
+++ b/spec/models/post_redirect_spec.rb
@@ -122,12 +122,12 @@
it "should generate a URL friendly token" do
pr = PostRedirect.new
- expect(pr.token).to match(/[a-z0-9]+/);
+ expect(pr.token).to match(/[a-z0-9]+/)
end
it "should generate an email friendly email token" do
pr = PostRedirect.new
- expect(pr.email_token).to match(/[a-z0-9]+/);
+ expect(pr.email_token).to match(/[a-z0-9]+/)
end
context 'when normal circumstance' do
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index 69b43d615d..c18e12ec92 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -65,7 +65,10 @@
it 'update with translated name' do
body = FactoryBot.create(:public_body)
- AlaveteliLocalization.with_locale(:es) { body.name = 'hola'; body.save! }
+ AlaveteliLocalization.with_locale(:es) do
+ body.name = 'hola'
+ body.save!
+ end
body.reload
expect(body.update('name' => nil)).to eq(false)
@@ -95,7 +98,10 @@
it 'blank string update with translated name' do
body = FactoryBot.create(:public_body)
- AlaveteliLocalization.with_locale(:es) { body.name = 'hola'; body.save! }
+ AlaveteliLocalization.with_locale(:es) do
+ body.name = 'hola'
+ body.save!
+ end
body.reload
expect(body.update('name' => '')).to eq(false)
From 91ad6509e9b5b65a446bf2cd1071925431a38d85 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:35:18 +0000
Subject: [PATCH 194/289] Style: SelfAssignment (RuboCop)
---
app/helpers/link_to_helper.rb | 2 +-
app/mailers/request_mailer.rb | 2 +-
app/models/alaveteli_pro/subscription_with_discount.rb | 2 +-
app/models/info_request.rb | 4 ++--
app/models/info_request_event.rb | 2 +-
app/models/mail_server_log.rb | 4 ++--
app/models/public_body.rb | 2 +-
app/models/user.rb | 2 +-
lib/alaveteli_mail_poller.rb | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 707a038be8..d963efe48c 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -233,7 +233,7 @@ def do_track_path(track_thing, feed = 'track', options = {})
# General pages.
def search_url(query, options = nil)
if query.kind_of?(Array)
- query = query - ["", nil]
+ query -= ["", nil]
query = query.join("/")
end
routing_info = {controller: 'general',
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index 857645f563..be8825ea84 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -490,7 +490,7 @@ def self.alert_comment_on_request
info_request.user_id).
first
if alerted_for.nil?
- count = count + 1
+ count += 1
earliest_unalerted_comment_event = e
else
break
diff --git a/app/models/alaveteli_pro/subscription_with_discount.rb b/app/models/alaveteli_pro/subscription_with_discount.rb
index 456508a63a..b257c2d33d 100644
--- a/app/models/alaveteli_pro/subscription_with_discount.rb
+++ b/app/models/alaveteli_pro/subscription_with_discount.rb
@@ -27,7 +27,7 @@ def initialize(subscription)
def amount
net = BigDecimal((original_amount * 0.01), 0).round(2)
- net = net - reduction(net)
+ net -= reduction(net)
(net * 100).floor
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index cb6ddda4c7..6d3e391100 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1454,13 +1454,13 @@ def who_can_followup_to(skip_message = nil)
name = OutgoingMailer.name_for_followup(self, incoming_message)
unless done.include?(email.downcase)
- ret = ret + [[name, email, incoming_message.id]]
+ ret += [[name, email, incoming_message.id]]
end
done[email.downcase] = 1
end
unless done.include?(public_body.request_email.downcase)
- ret = ret + [[public_body.name, public_body.request_email, nil]]
+ ret += [[public_body.name, public_body.request_email, nil]]
end
done[public_body.request_email.downcase] = 1
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index e3451f0a7f..e6d9c95217 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -240,7 +240,7 @@ def search_text_main(clipped = false)
text = text + outgoing_message.get_text_for_indexing + "\n\n"
elsif event_type == 'response'
if clipped
- text = text + get_clipped_response_efficiently
+ text += get_clipped_response_efficiently
else
text = text + incoming_message.get_text_for_indexing_full + "\n\n"
end
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index c2da664cad..a3266b1635 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -78,7 +78,7 @@ def self.load_file(file_name)
def self.load_exim_log_data(f, done)
order = 0
f.each do |line|
- order = order + 1
+ order += 1
create_exim_log_line(line, done, order)
end
end
@@ -90,7 +90,7 @@ def self.load_postfix_log_data(f, done)
f.rewind
f.each do |line|
sanitised_line = scrub(line)
- order = order + 1
+ order += 1
queue_id = extract_postfix_queue_id_from_syslog_line(sanitised_line)
if emails.has_key?(queue_id)
create_mail_server_logs(emails[queue_id], sanitised_line, order, done)
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index e192d0a131..0ccf755049 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -506,7 +506,7 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
errors: errors }
CSV.foreach(csv_filename) do |row|
- line = line + 1
+ line += 1
# Parse the first line as a field list if it starts with '#'
if line==1 and row.first.to_s =~ /^#(.*)$/
diff --git a/app/models/user.rb b/app/models/user.rb
index 2e6b305453..019029dc46 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -361,7 +361,7 @@ def update_url_name
conditions = id ? ["id <> ?", id] : []
while !User.where(url_name: unique_url_name).where(conditions).first.nil?
unique_url_name = url_name + "_" + suffix_num.to_s
- suffix_num = suffix_num + 1
+ suffix_num += 1
end
self.url_name = unique_url_name
end
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index fe6c67c8d9..04174a2372 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -23,7 +23,7 @@ def poll_for_incoming
start do |pop3|
pop3.each_mail do |popmail|
received = get_mail(popmail)
- found_mail = found_mail || received
+ found_mail ||= received
end
end
found_mail
From a1ca0c6adfe5b424425e05b3d45105cc7a1c5cb0 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:39:14 +0000
Subject: [PATCH 195/289] Style: LineEndConcatenation (RuboCop)
---
app/models/incoming_message.rb | 8 ++++----
.../info_request/prominence/been_published_query.rb | 6 +++---
config/preinitializer.rb | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 839b8cb36e..11b5f40b4c 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -283,10 +283,10 @@ def self.remove_quoted_sections(text, replacement = "FOLDED_QUOTED_SECTION")
# http://www.whatdotheyknow.com/request/235/response/513
# http://www.whatdotheyknow.com/request/445/response/743
original_message =
- '(' + '''----* This is a copy of the message, including all the headers. ----*''' +
- '|' + '''----*\s*Original Message\s*----*''' +
- '|' + '''----*\s*Forwarded message.+----*''' +
- '|' + '''----*\s*Forwarded by.+----*''' +
+ '(' + '''----* This is a copy of the message, including all the headers. ----*''' \
+ '|' + '''----*\s*Original Message\s*----*''' \
+ '|' + '''----*\s*Forwarded message.+----*''' \
+ '|' + '''----*\s*Forwarded by.+----*''' \
')'
# Could have a ^ at start here, but see messed up formatting here:
# http://www.whatdotheyknow.com/request/refuse_and_recycling_collection#incoming-842
diff --git a/app/models/info_request/prominence/been_published_query.rb b/app/models/info_request/prominence/been_published_query.rb
index 81edbd2833..aef67c27c1 100644
--- a/app/models/info_request/prominence/been_published_query.rb
+++ b/app/models/info_request/prominence/been_published_query.rb
@@ -7,13 +7,13 @@ def initialize(relation = InfoRequest)
def call
@relation.joins(
- 'LEFT JOIN "embargoes" ' +
+ 'LEFT JOIN "embargoes" ' \
'ON "embargoes"."info_request_id" = "info_requests"."id"'
).joins(
- 'LEFT JOIN "info_request_events" ' +
+ 'LEFT JOIN "info_request_events" ' \
'ON "info_request_events"."info_request_id" = "info_requests"."id"'
).where(
- '"embargoes"."id" IS NULL ' +
+ '"embargoes"."id" IS NULL ' \
'OR "info_request_events"."event_type" = ?', 'expire_embargo'
)
end
diff --git a/config/preinitializer.rb b/config/preinitializer.rb
index 9836dad79c..954a00c77f 100644
--- a/config/preinitializer.rb
+++ b/config/preinitializer.rb
@@ -6,7 +6,7 @@
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
- raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." \
"Run `gem install bundler` to upgrade."
end
@@ -15,6 +15,6 @@
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
- raise RuntimeError, "Bundler couldn't find some gems." +
+ raise RuntimeError, "Bundler couldn't find some gems." \
"Did you run `bundle install`?"
end
From e802acad083e3f1839a44b53a40c6735bed98836 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:40:23 +0000
Subject: [PATCH 196/289] Style: Alias (RuboCop)
---
app/controllers/application_controller.rb | 2 +-
app/models/incoming_message.rb | 2 +-
app/models/info_request.rb | 4 ++--
app/models/info_request/response_gatekeeper/spam_checker.rb | 2 +-
app/models/public_body.rb | 2 +-
lib/mail_handler/backends/mail_backend.rb | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index febfd15bfa..19a678595a 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -285,7 +285,7 @@ def authenticated_user
end
# For CanCanCan and other libs which need a Devise-like current_user method
- alias_method :current_user, :authenticated_user
+ alias current_user authenticated_user
helper_method :current_user
# Do a POST redirect. This is a nasty hack - we store the posted values in
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 11b5f40b4c..b6bc994f75 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -111,7 +111,7 @@ def parse_raw_email!(force = nil)
end
end
- alias_method :valid_to_reply_to?, :valid_to_reply_to
+ alias valid_to_reply_to? valid_to_reply_to
# Public: The display name of the email sender with the associated
# InfoRequest's censor rules applied.
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 6d3e391100..1be1ab511a 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -160,7 +160,7 @@ def self.admin_title
scope :surveyable, Survey::InfoRequestQuery.new
class << self
- alias_method :in_progress, :awaiting_response
+ alias in_progress awaiting_response
end
scope :action_needed, State::ActionNeededQuery.new
scope :updated_before, ->(ts) { where('"info_requests"."updated_at" < ?', ts) }
@@ -788,7 +788,7 @@ def reindex_request_events
end
# Force reindex when tag string changes
- alias_method :orig_tag_string=, :tag_string=
+ alias orig_tag_string= tag_string=
def tag_string=(tag_string)
ret = self.orig_tag_string=(tag_string)
reindex_request_events
diff --git a/app/models/info_request/response_gatekeeper/spam_checker.rb b/app/models/info_request/response_gatekeeper/spam_checker.rb
index de023e8772..69168dad05 100644
--- a/app/models/info_request/response_gatekeeper/spam_checker.rb
+++ b/app/models/info_request/response_gatekeeper/spam_checker.rb
@@ -8,7 +8,7 @@ class SpamChecker
}
attr_reader :spam_action, :spam_header, :spam_threshold
- alias_method :rejection_action, :spam_action
+ alias rejection_action spam_action
def initialize(opts = {})
@spam_action = opts[:spam_action] || DEFAULT_CONFIGURATION[:spam_action]
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 0ccf755049..f14d2426be 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -655,7 +655,7 @@ def request_email_domain
PublicBody.extract_domain_from_email(request_email)
end
- alias_method :foi_officer_domain_required, :request_email_domain
+ alias foi_officer_domain_required request_email_domain
# Return the canonicalised domain part of an email address
#
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 6becb79062..e2c118cac4 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -13,8 +13,8 @@ class Message
# string as an ActiveSupport::Multibyte::Chars, whereas
# previously TMail would return nil.
- alias_method :old_to, :to
- alias_method :old_cc, :cc
+ alias old_to to
+ alias old_cc cc
def clean_addresses(old_method, val)
old_result = send(old_method, val)
From bd22925b5b431be96b09769c3938a9f978327e83 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:43:05 +0000
Subject: [PATCH 197/289] Style: ClassCheck (RuboCop)
---
app/helpers/link_to_helper.rb | 4 ++--
lib/acts_as_xapian/acts_as_xapian.rb | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index d963efe48c..d8f151f769 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -232,7 +232,7 @@ def do_track_path(track_thing, feed = 'track', options = {})
# General pages.
def search_url(query, options = nil)
- if query.kind_of?(Array)
+ if query.is_a?(Array)
query -= ["", nil]
query = query.join("/")
end
@@ -242,7 +242,7 @@ def search_url(query, options = nil)
view: nil}
routing_info = options.merge(routing_info) unless options.nil?
- if routing_info.kind_of?(Hash)
+ if routing_info.is_a?(Hash)
routing_info = ActionController::Parameters.new(routing_info)
end
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 2e9b18c947..063006ae52 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -959,7 +959,7 @@ def xapian_value(field, type = nil, index_translations = false)
values << single_xapian_value(field, type=type)
end
end
- if values[0].kind_of?(Array)
+ if values[0].is_a?(Array)
values = values.flatten
value = values.reject(&:nil?)
else
@@ -977,9 +977,9 @@ def xapian_value(field, type = nil, index_translations = false)
def single_xapian_value(field, type = nil)
value = send(field.to_sym) || self[field]
if type == :date
- if value.kind_of?(Time)
+ if value.is_a?(Time)
value.utc.strftime("%Y%m%d")
- elsif value.kind_of?(Date)
+ elsif value.is_a?(Date)
value.to_time.utc.strftime("%Y%m%d")
else
raise "Only Time or Date types supported by acts_as_xapian for :date fields, got " + value.class.to_s
@@ -988,7 +988,7 @@ def single_xapian_value(field, type = nil)
value ? true : false
else
# Arrays are for terms which require multiple of them, e.g. tags
- if value.kind_of?(Array)
+ if value.is_a?(Array)
value.map(&:to_s)
else
value.to_s
@@ -1069,7 +1069,7 @@ def xapian_index(terms = true, values = true, texts = true)
terms_to_index.each do |term|
value = xapian_value(term[0])
- if value.kind_of?(Array)
+ if value.is_a?(Array)
value.each do |v|
doc.add_term(term[1] + v)
doc.add_posting(term[1] + v, 1, Integer(term[3])) if term[3]
From ab5e8a1a3aac129a6be9f2a656dcb59df5c2c9b4 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:44:17 +0000
Subject: [PATCH 198/289] Style: NegatedWhile (RuboCop)
---
app/mailers/notification_mailer.rb | 2 +-
app/mailers/track_mailer.rb | 2 +-
app/models/user.rb | 2 +-
lib/acts_as_xapian/acts_as_xapian.rb | 6 +++---
lib/alaveteli_mail_poller.rb | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 2e17660cd7..3a51979ff4 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -63,7 +63,7 @@ def self.send_notifications_loop
# nothing to do
while true
sleep_seconds = 1
- while !send_notifications
+ until send_notifications
sleep sleep_seconds
sleep_seconds *= 2
sleep_seconds = 300 if sleep_seconds > 300
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index f1a51a9f8d..42599fb283 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -138,7 +138,7 @@ def self.alert_tracks_loop
# Run alert_tracks in an endless loop, sleeping when there is nothing to do
while true
sleep_seconds = 1
- while !alert_tracks
+ until alert_tracks
sleep sleep_seconds
sleep_seconds *= 2
sleep_seconds = 300 if sleep_seconds > 300
diff --git a/app/models/user.rb b/app/models/user.rb
index 019029dc46..035fc1cc51 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -359,7 +359,7 @@ def update_url_name
unique_url_name = url_name
suffix_num = 2 # as there's already one without numeric suffix
conditions = id ? ["id <> ?", id] : []
- while !User.where(url_name: unique_url_name).where(conditions).first.nil?
+ until User.where(url_name: unique_url_name).where(conditions).first.nil?
unique_url_name = url_name + "_" + suffix_num.to_s
suffix_num += 1
end
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 063006ae52..ecfba4241d 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -422,7 +422,7 @@ def results
self.runtime += Benchmark.realtime {
# Pull out all the results
iter = matches._begin
- while not iter.equals(matches._end)
+ until iter.equals(matches._end)
docs.push({data: iter.document.data,
percent: iter.percent,
weight: iter.weight,
@@ -598,7 +598,7 @@ def initialize(model_classes, query_models, options = {})
# Get set of relevant terms for those documents
selection = Xapian::RSet.new
iter = matches._begin
- while not iter.equals(matches._end)
+ until iter.equals(matches._end)
selection.add_document(iter)
iter.next
end
@@ -612,7 +612,7 @@ def initialize(model_classes, query_models, options = {})
# Do main search for them
self.important_terms = []
iter = eset._begin
- while not iter.equals(eset._end)
+ until iter.equals(eset._end)
important_terms.push(iter.term)
iter.next
end
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index 04174a2372..713f48c94d 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -37,7 +37,7 @@ def self.poll_for_incoming_loop
Rails.logger.info "Starting #{ poller } polling loop"
while true
sleep_seconds = 1
- while !poller.poll_for_incoming
+ until poller.poll_for_incoming
Rails.logger.debug "#{ poller } sleeping for #{ sleep_seconds }"
sleep sleep_seconds
sleep_seconds *= 2
From 8e31aa846198be4f31a66dc6eaa69cc6ac9a9997 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:45:36 +0000
Subject: [PATCH 199/289] Style: ParenthesesAroundCondition (RuboCop)
---
app/controllers/general_controller.rb | 2 +-
app/controllers/public_body_controller.rb | 2 +-
app/controllers/request_controller.rb | 2 +-
app/models/incoming_message.rb | 2 +-
app/models/notification.rb | 4 ++--
lib/acts_as_xapian/acts_as_xapian.rb | 4 ++--
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 1b8e4af052..b6f20db005 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -188,7 +188,7 @@ def search
# Spelling and highight words are same for all three queries
@highlight_words = @request_for_spelling.words_to_highlight(regex: true, include_original: true)
- unless (@request_for_spelling.spelling_correction =~ /[a-z]+:/)
+ unless @request_for_spelling.spelling_correction =~ /[a-z]+:/
@spelling_correction = @request_for_spelling.spelling_correction
end
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index b4eb2eb541..f116ee780d 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -64,7 +64,7 @@ def show
sortby = "described"
begin
@xapian_requests = perform_search([InfoRequestEvent], query, sortby, 'request_collapse', requests_per_page)
- if (@page > 1)
+ if @page > 1
@page_desc = " (page #{ @page })"
else
@page_desc = ""
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index c982401635..aaf7f12a8a 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -156,7 +156,7 @@ def list
@filters = params.merge(latest_status: @view)
- if (@page > 1)
+ if @page > 1
@title = _("Browse and search requests (page {{count}})", count: @page)
else
@title = _('Browse and search requests')
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index b6bc994f75..37a14f4245 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -96,7 +96,7 @@ def parse_raw_email!(force = nil)
# values in case we want to regenerate them (due to mail
# parsing bugs, etc).
raise "Incoming message id=#{id} has no raw_email" if raw_email.nil?
- if (!force.nil? || last_parsed.nil?)
+ if !force.nil? || last_parsed.nil?
ActiveRecord::Base.transaction do
extract_attachments
self.sent_at = raw_email.date || created_at
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 99fe083813..e240251913 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -73,8 +73,8 @@ def response_expired
def embargo_expiring_expired
# If someone has changed the embargo date on the request, or published it,
# they might not need this notification any more.
- if (info_request_event.info_request.embargo_expiring? ||
- info_request_event.info_request.embargo_pending_expiry?)
+ if info_request_event.info_request.embargo_expiring? ||
+ info_request_event.info_request.embargo_pending_expiry?
false
else
true
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index ecfba4241d..25fb93248b 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -1119,7 +1119,7 @@ def xapian_mark_needs_destroy
# Allow reindexing to be skipped if a flag is set
def xapian_mark_needs_index_if_reindex
- if (respond_to?(:no_xapian_reindex) && no_xapian_reindex == true)
+ if respond_to?(:no_xapian_reindex) && no_xapian_reindex == true
return true
end
xapian_mark_needs_index
@@ -1139,7 +1139,7 @@ def xapian_create_job(action, model, model_id)
rescue ActiveRecord::RecordNotUnique => e
# Given the error handling in ActsAsXapian::update_index, we can just fail silently if
# another process has inserted an acts_as_xapian_jobs record for this model.
- unless (e.message =~ /duplicate key value violates unique constraint "index_acts_as_xapian_jobs_on_model_and_model_id"/)
+ unless e.message =~ /duplicate key value violates unique constraint "index_acts_as_xapian_jobs_on_model_and_model_id"/
raise
end
end
From 1da6c0ec81ca6de592caaf35bedc23b930556c09 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:53:10 +0000
Subject: [PATCH 200/289] Style: EmptyElse (RuboCop)
---
app/helpers/application_helper.rb | 2 --
app/models/incoming_message.rb | 2 --
app/models/info_request_event.rb | 2 --
lib/mail_handler/backends/mail_backend.rb | 6 ------
4 files changed, 12 deletions(-)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e94e40f96a..327427227a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -151,8 +151,6 @@ def request_list_cache_key
cacheable_param_list = %w[controller action locale view]
if params.keys.all? { |key| cacheable_param_list.include?(key) }
"request-list-#{@view}-#{@locale}"
- else
- nil
end
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 37a14f4245..cff47e7cb5 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -169,8 +169,6 @@ def self.get_attachment_by_url_part_number_and_filename(attachments, found_url_p
}
if attachments_by_filename.length == 1
attachments_by_filename[0]
- else
- nil
end
end
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index e6d9c95217..0cf7211a12 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -246,8 +246,6 @@ def search_text_main(clipped = false)
end
elsif event_type == 'comment'
text = text + comment.body + "\n\n"
- else
- # nothing
end
text
end
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index e2c118cac4..13c2115cc5 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -107,8 +107,6 @@ def first_from(mail)
rescue
mail[:from].value
end
- else
- nil
end
end
@@ -121,8 +119,6 @@ def get_from_address(mail)
else
first_from.address
end
- else
- nil
end
end
@@ -135,8 +131,6 @@ def get_from_name(mail)
else
(first_from.display_name || nil)
end
- else
- nil
end
end
From 0b58c5dee04fbf707c29e1fd53aedf266ded2edd Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:57:15 +0000
Subject: [PATCH 201/289] Style: IdenticalConditionalBranches (RuboCop)
---
app/controllers/admin_request_controller.rb | 4 +---
app/controllers/user_controller.rb | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 78d54a45fa..309c09dee3 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -104,7 +104,6 @@ def move
flash[:error] = "Couldn't find user '#{params[:user_url_name]}'"
end
- redirect_to admin_request_url(@info_request)
elsif params[:commit] == 'Move request to authority' && !params[:public_body_url_name].blank?
destination_body = PublicBody.find_by_url_name(
params[:public_body_url_name]
@@ -116,11 +115,10 @@ def move
flash[:error] = "Couldn't find public body '#{ params[:public_body_url_name] }'"
end
- redirect_to admin_request_url(@info_request)
else
flash[:error] = "Please enter the user or authority to move the request to"
- redirect_to admin_request_url(@info_request)
end
+ redirect_to admin_request_url(@info_request)
end
def generate_upload_url
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 1ea409b5c2..6334deca0c 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -152,7 +152,6 @@ def signup
else
if user_alreadyexists
already_registered_mail user_alreadyexists
- nil
else
# New unconfirmed user
@@ -180,8 +179,8 @@ def signup
@user_signup.email_confirmed = false
@user_signup.save!
send_confirmation_mail @user_signup
- nil
end
+ nil
end
rescue ActionController::ParameterMissing
flash[:error] = _('Invalid form submission')
From 09f1f2cc0568f5edc7dc2892ef56c90c283fd985 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:58:16 +0000
Subject: [PATCH 202/289] Style: Not (RuboCop)
---
app/controllers/user_controller.rb | 2 +-
lib/mail_handler.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 6334deca0c..3ce02d1561 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -247,7 +247,7 @@ def signchangeemail
# if not already, send a confirmation link to the new email address which logs
# them into the old email's user account, but with special user_circumstance
- if (not session[:user_circumstance]) or (session[:user_circumstance] != "change_email")
+ if (!(session[:user_circumstance])) or (session[:user_circumstance] != "change_email")
# don't store the password in the db
params[:signchangeemail].delete(:password)
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index 66a665b9ac..dec6cb8c0e 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -81,7 +81,7 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
AlaveteliExternalCommand.run("wvText", tempfile.path, tempfile.path + ".txt",
{ memory_limit: 536_870_912, timeout: 120 } )
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
- if not File.exist?(tempfile.path + ".txt")
+ if !File.exist?(tempfile.path + ".txt")
AlaveteliExternalCommand.run("catdoc", tempfile.path, default_params)
else
text += File.read(tempfile.path + ".txt") + "\n\n"
From daa63c4cb356dfef84e150766213d65c50d0b3ee Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 17:59:40 +0000
Subject: [PATCH 203/289] Style: Proc (RuboCop)
---
app/models/alaveteli_pro/embargo.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index 950ca5ca63..385b05d676 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -43,9 +43,9 @@ class Embargo < ApplicationRecord
TWELVE_MONTHS = 364.days
DURATIONS = {
- "3_months" => Proc.new { THREE_MONTHS },
- "6_months" => Proc.new { SIX_MONTHS },
- "12_months" => Proc.new { TWELVE_MONTHS }
+ "3_months" => proc { THREE_MONTHS },
+ "6_months" => proc { SIX_MONTHS },
+ "12_months" => proc { TWELVE_MONTHS }
}.freeze
scope :expiring, -> { where("publish_at <= ?", expiring_soon_time) }
From 6cfaf686509c23fa6623e6049b8e441df37f62d6 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 18:01:42 +0000
Subject: [PATCH 204/289] Style: RedundantInterpolation (RuboCop)
---
app/models/holiday_import.rb | 2 +-
app/models/info_request.rb | 2 +-
lib/tasks/stats.rake | 2 +-
spec/factories/post_redirects.rb | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index bb2b954a6c..603ff53417 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -38,7 +38,7 @@ def suggestions_country_name
end
def period
- start_year == end_year ? "#{start_year}" : "#{start_year}-#{end_year}"
+ start_year == end_year ? start_year.to_s : "#{start_year}-#{end_year}"
end
def save
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 1be1ab511a..8f0c8ab8a0 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -509,7 +509,7 @@ def self.where_old_unclassified(age_in_days=nil)
end
def self.download_zip_dir
- File.join(Rails.root, "cache", "zips", "#{Rails.env}")
+ File.join(Rails.root, "cache", "zips", Rails.env)
end
def self.reject_incoming_at_mta(options)
diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake
index 48cea8aefd..ae2fef4f77 100644
--- a/lib/tasks/stats.rake
+++ b/lib/tasks/stats.rake
@@ -293,7 +293,7 @@ namespace :stats do
unless list.empty?
puts "\n#{title}\n"
list.each do |request|
- request_line = "#{admin_request_url(request, host: AlaveteliConfiguration.domain)}"
+ request_line = admin_request_url(request, host: AlaveteliConfiguration.domain)
if %w[vexatious not_foi].include? request.described_state
request_line << "\t#{request.described_state}"
end
diff --git a/spec/factories/post_redirects.rb b/spec/factories/post_redirects.rb
index 73bf58f36b..2a06c0f8ff 100644
--- a/spec/factories/post_redirects.rb
+++ b/spec/factories/post_redirects.rb
@@ -38,7 +38,7 @@
},
"info_request" => {
"title" => "Testing the post redirect to pro things",
- "public_body_id" => "#{public_body.id}"
+ "public_body_id" => public_body.id.to_s
},
"submitted_new_request" => "1",
"preview" => "0",
From 0468dc060129f53b1ab1764e77d82e0860a89785 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 10:36:23 +0000
Subject: [PATCH 205/289] Style: InfiniteLoop (RuboCop)
---
app/mailers/notification_mailer.rb | 2 +-
app/mailers/track_mailer.rb | 2 +-
lib/alaveteli_mail_poller.rb | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb
index 3a51979ff4..f4c61a33fc 100644
--- a/app/mailers/notification_mailer.rb
+++ b/app/mailers/notification_mailer.rb
@@ -61,7 +61,7 @@ def self.send_notifications
def self.send_notifications_loop
# Run send_notifications in an endless loop, sleeping when there is
# nothing to do
- while true
+ loop do
sleep_seconds = 1
until send_notifications
sleep sleep_seconds
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index 42599fb283..1641b74b9b 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -136,7 +136,7 @@ def self.alert_tracks
def self.alert_tracks_loop
# Run alert_tracks in an endless loop, sleeping when there is nothing to do
- while true
+ loop do
sleep_seconds = 1
until alert_tracks
sleep sleep_seconds
diff --git a/lib/alaveteli_mail_poller.rb b/lib/alaveteli_mail_poller.rb
index 713f48c94d..b7e3b2462f 100644
--- a/lib/alaveteli_mail_poller.rb
+++ b/lib/alaveteli_mail_poller.rb
@@ -35,7 +35,7 @@ def self.poll_for_incoming_loop
if AlaveteliConfiguration.production_mailer_retriever_method == 'pop'
poller = new
Rails.logger.info "Starting #{ poller } polling loop"
- while true
+ loop do
sleep_seconds = 1
until poller.poll_for_incoming
Rails.logger.debug "#{ poller } sleeping for #{ sleep_seconds }"
From 738bc4c187191896e80cd815028223adb67dbca1 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 10:40:02 +0000
Subject: [PATCH 206/289] Style: RedundantException (RuboCop)
---
config/preinitializer.rb | 7 +++----
lib/confidence_intervals.rb | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/config/preinitializer.rb b/config/preinitializer.rb
index 954a00c77f..beca9f5ac4 100644
--- a/config/preinitializer.rb
+++ b/config/preinitializer.rb
@@ -6,8 +6,8 @@
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
- raise RuntimeError, "Your bundler version is too old for Rails 2.3." \
- "Run `gem install bundler` to upgrade."
+ raise "Your bundler version is too old for Rails 2.3. Run `gem install " \
+ "bundler` to upgrade."
end
begin
@@ -15,6 +15,5 @@
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
- raise RuntimeError, "Bundler couldn't find some gems." \
- "Did you run `bundle install`?"
+ raise "Bundler couldn't find some gems. Did you run `bundle install`?"
end
diff --git a/lib/confidence_intervals.rb b/lib/confidence_intervals.rb
index 84ea930a73..5ddfa20cde 100644
--- a/lib/confidence_intervals.rb
+++ b/lib/confidence_intervals.rb
@@ -19,7 +19,7 @@
require 'statistics2'
def ci_bounds(successes, total, power)
- raise RuntimeError, "Can't calculate the CI for 0 observations" if total == 0
+ raise "Can't calculate the CI for 0 observations" if total == 0
z = Statistics2.pnormaldist(1 - power/2)
phat = successes.to_f/total
offset = z*Math.sqrt((phat*(1 - phat) + z*z/(4*total))/total)
From 7fdeae56dada70d21f8c009d4c593cf8f35fd02c Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 10:42:23 +0000
Subject: [PATCH 207/289] Style: RedundantParentheses (RuboCop)
---
app/controllers/general_controller.rb | 6 +++---
app/controllers/user_controller.rb | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index b6f20db005..992a1aa6ce 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -89,7 +89,7 @@ def search
combined = params[:combined].split("/")
@sortby = nil
@bodies = @requests = @users = true
- if combined.size > 0 && (['advanced'].include?(combined[-1]))
+ if combined.size > 0 && ['advanced'].include?(combined[-1])
combined.pop
@advanced = true
else
@@ -97,12 +97,12 @@ def search
end
# TODO: currently /described isn't linked to anywhere, just used in RSS and for /list/successful
# This is because it's confusingly different from /newest - but still useful for power users.
- if combined.size > 0 && (%w[newest described relevant].include?(combined[-1]))
+ if combined.size > 0 && %w[newest described relevant].include?(combined[-1])
@sort_postfix = combined.pop
@sortby = @sort_postfix
end
combined += [params[:view]] unless params[:view].nil?
- if combined.size > 0 && (%w[bodies requests users all].include?(combined[-1]))
+ if combined.size > 0 && %w[bodies requests users all].include?(combined[-1])
@variety_postfix = combined.pop
case @variety_postfix
when 'bodies'
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 3ce02d1561..24857e9b28 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -247,7 +247,7 @@ def signchangeemail
# if not already, send a confirmation link to the new email address which logs
# them into the old email's user account, but with special user_circumstance
- if (!(session[:user_circumstance])) or (session[:user_circumstance] != "change_email")
+ if !session[:user_circumstance] or (session[:user_circumstance] != "change_email")
# don't store the password in the db
params[:signchangeemail].delete(:password)
From 6a5360029963dacccd062397156fd6c212dd7594 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 10:44:59 +0000
Subject: [PATCH 208/289] Style: TrailingCommaInArguments (RuboCop)
---
.../alaveteli_pro/draft_info_request_batches_controller.rb | 2 +-
spec/controllers/admin_raw_email_controller_spec.rb | 2 +-
spec/lib/alaveteli_pro/metrics_report_spec.rb | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
index 1550c296dc..5a6a36419c 100644
--- a/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
+++ b/app/controllers/alaveteli_pro/draft_info_request_batches_controller.rb
@@ -85,7 +85,7 @@ def respond_with_partial(draft, query, page)
# different params.
def draft_params
params.require(:alaveteli_pro_draft_info_request_batch).
- permit(:title, :body, :embargo_duration, :public_body_ids, )
+ permit(:title, :body, :embargo_duration, :public_body_ids )
end
def draft_params_multiple_bodies
diff --git a/spec/controllers/admin_raw_email_controller_spec.rb b/spec/controllers/admin_raw_email_controller_spec.rb
index 0c0ee7af1d..095c21aa41 100644
--- a/spec/controllers/admin_raw_email_controller_spec.rb
+++ b/spec/controllers/admin_raw_email_controller_spec.rb
@@ -39,7 +39,7 @@
let(:incoming_message) do
incoming_message = FactoryBot.create(
:plain_incoming_message,
- info_request: InfoRequest.holding_pen_request,
+ info_request: InfoRequest.holding_pen_request
)
incoming_message.raw_email.data = raw_email_data
incoming_message.raw_email.save!
diff --git a/spec/lib/alaveteli_pro/metrics_report_spec.rb b/spec/lib/alaveteli_pro/metrics_report_spec.rb
index 8587c98597..7d07514455 100644
--- a/spec/lib/alaveteli_pro/metrics_report_spec.rb
+++ b/spec/lib/alaveteli_pro/metrics_report_spec.rb
@@ -160,7 +160,7 @@
let!(:past_due_sub) do
subscription = Stripe::Subscription.create(customer: customer,
- plan: pro_plan.id,)
+ plan: pro_plan.id)
StripeMock.mark_subscription_as_past_due(subscription)
subscription
end
From 9b7b3fa24a0622912aea2169d4f40775c4f075f2 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 13:14:28 +0000
Subject: [PATCH 209/289] Style: IfUnlessModifier (RuboCop)
---
app/controllers/api_controller.rb | 4 +---
app/controllers/application_controller.rb | 4 +---
app/controllers/track_controller.rb | 4 +---
app/models/incoming_message.rb | 4 +---
4 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 2f646996b2..d5d9521d98 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -270,9 +270,7 @@ def body_request_events
protected
def check_api_key
- if params[:k].nil?
- raise PermissionDenied, "Missing required parameter 'k'"
- end
+ raise PermissionDenied, "Missing required parameter 'k'" if params[:k].nil?
@public_body = PublicBody.find_by_api_key(params[:k].gsub(' ', '+'))
raise PermissionDenied if @public_body.nil?
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 19a678595a..ddc80c855d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -471,9 +471,7 @@ def user_ip
#
# Returns a Hash
def sanitize_path(params)
- if params.key?(:path)
- params.merge!(path: Rack::Utils.escape(params[:path]))
- end
+ params.merge!(path: Rack::Utils.escape(params[:path])) if params.key?(:path)
end
# Collect the current and available locales for the locale switcher
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index d26d9bd087..29c161db27 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -81,9 +81,7 @@ def track_user
return atom_feed_internal if params[:feed] == 'feed'
- if track_set || @track_thing.errors.any?
- redirect_to user_url(@track_user)
- end
+ redirect_to user_url(@track_user) if track_set || @track_thing.errors.any?
end
# Track a search term
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index cff47e7cb5..e4cc0ea360 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -167,9 +167,7 @@ def self.get_attachment_by_url_part_number_and_filename(attachments, found_url_p
attachments_by_filename = attachments.select { |a|
a.display_filename == display_filename
}
- if attachments_by_filename.length == 1
- attachments_by_filename[0]
- end
+ attachments_by_filename[0] if attachments_by_filename.length == 1
end
end
From 60cf97143163fdf75b756b9b0f4f7ee72856f153 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 13:16:20 +0000
Subject: [PATCH 210/289] Style: MethodDefParentheses (RuboCop)
---
lib/tasks/usage.rb | 2 +-
script/switch-theme.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/usage.rb b/lib/tasks/usage.rb
index e2d9eee48c..8f760df83e 100644
--- a/lib/tasks/usage.rb
+++ b/lib/tasks/usage.rb
@@ -1,6 +1,6 @@
module Usage
- def usage_message message
+ def usage_message(message)
puts ''
puts message
puts ''
diff --git a/script/switch-theme.rb b/script/switch-theme.rb
index 18ba015f10..f000178310 100755
--- a/script/switch-theme.rb
+++ b/script/switch-theme.rb
@@ -100,7 +100,7 @@ def show_themes
exit 1
end
-def symlink target, link_directory, link_name
+def symlink(target, link_directory, link_name)
tmp = Tempfile.new link_name, link_directory
full_link_name = File.join(link_directory, link_name)
target = Pathname.new(target).relative_path_from(File.dirname(full_link_name))
From 76fa9fbd006fce8b15611dc1548e0e02d9b08bad Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 13:21:15 +0000
Subject: [PATCH 211/289] Style: TrivialAccessors (RuboCop)
---
lib/attachment_to_html/view.rb | 4 ++--
spec/support/mock_pop_mail.rb | 4 +---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/attachment_to_html/view.rb b/lib/attachment_to_html/view.rb
index 1785e605aa..7bc4a64db0 100644
--- a/lib/attachment_to_html/view.rb
+++ b/lib/attachment_to_html/view.rb
@@ -5,8 +5,8 @@ def self.template
@template || "#{ File.dirname(__FILE__) }/template.html.erb"
end
- def self.template=(path)
- @template = path
+ class << self
+ attr_writer :template
end
attr_accessor :title, :body, :template, :wrapper
diff --git a/spec/support/mock_pop_mail.rb b/spec/support/mock_pop_mail.rb
index 0abbce5f6e..5c9d08d746 100644
--- a/spec/support/mock_pop_mail.rb
+++ b/spec/support/mock_pop_mail.rb
@@ -9,9 +9,7 @@ def pop
@rfc2822
end
- def number
- @number
- end
+ attr_reader :number
def to_s
"#{number}: #{pop}"
From c7898e427ede81d4872fc4c0702d96cceaaadf9a Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 13:25:18 +0000
Subject: [PATCH 212/289] Style: WhileUntilModifier (RuboCop)
---
app/models/holiday.rb | 4 +---
lib/alaveteli_gettext/fuzzy_cleaner.rb | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 964cd2f302..b1fbcd33e3 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -82,9 +82,7 @@ def self.due_date_from_calendar_days(start_date, days)
start_date = start_date.to_date
response_required_by = start_date + days
- while weekend_or_holiday?(response_required_by)
- response_required_by += 1
- end
+ response_required_by += 1 while weekend_or_holiday?(response_required_by)
response_required_by
end
end
diff --git a/lib/alaveteli_gettext/fuzzy_cleaner.rb b/lib/alaveteli_gettext/fuzzy_cleaner.rb
index 59071cece1..34ecebbf6f 100644
--- a/lib/alaveteli_gettext/fuzzy_cleaner.rb
+++ b/lib/alaveteli_gettext/fuzzy_cleaner.rb
@@ -14,9 +14,7 @@ def clean_po(input)
end
# multiline msgstr
if /^msgstr ""/.match(lines[index+1])
- while /^".+"/.match(lines[index+2])
- lines.delete_at(index+2)
- end
+ lines.delete_at(index+2) while /^".+"/.match(lines[index+2])
lines.delete_at(index-1)
end
# plural msgstr
From eae1ba82afbbc62156a292e0bf57fd5d8427f660 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 14:51:50 +0000
Subject: [PATCH 213/289] Style: MultilineTernaryOperator (RuboCop)
---
app/controllers/user_controller.rb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 24857e9b28..73769a8cb3 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -285,9 +285,13 @@ def signchangeemail
# River of News: What's happening with your tracked things
def river
- @results = @user.nil? ? [] : @user.track_things.collect { |thing|
+ @results = if @user.nil?
+ []
+else
+ @user.track_things.collect { |thing|
perform_search([InfoRequestEvent], thing.track_query, thing.params[:feed_sortby], nil).results
}.flatten.sort { |a,b| b[:model].created_at <=> a[:model].created_at }.first(20)
+end
end
def set_profile_photo
From 3a34bf79a59e98410d6a406a2bb7ea41e623a87d Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 14:52:55 +0000
Subject: [PATCH 214/289] Style: RedundantFreeze (RuboCop)
---
app/validators/reply_to_address_validator.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/validators/reply_to_address_validator.rb b/app/validators/reply_to_address_validator.rb
index d3b49fdef6..2fb2e3a40c 100644
--- a/app/validators/reply_to_address_validator.rb
+++ b/app/validators/reply_to_address_validator.rb
@@ -1,7 +1,7 @@
# Public: Validates that we can reply to a ReplyTo address.
class ReplyToAddressValidator
DEFAULT_NO_REPLY_REGEXP =
- /^(postmaster|mailer-daemon|auto_reply|do.?not.?reply|no.?reply)$/.freeze
+ /^(postmaster|mailer-daemon|auto_reply|do.?not.?reply|no.?reply)$/
DEFAULT_INVALID_REPLY_ADDRESSES = [].freeze
From 87e166e3e7e37cc15aaceeb071b0159759276c7c Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 15:53:27 +0000
Subject: [PATCH 215/289] Style: MultilineBlockChain (RuboCop)
Not an ideal solution due to line lengths,
but the refactoring required to fix that is
beyond the scope of this commit
---
app/controllers/user_controller.rb | 15 +++++++++------
app/models/concerns/translatable.rb | 8 +++-----
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 73769a8cb3..cfd31f948d 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -286,12 +286,15 @@ def signchangeemail
# River of News: What's happening with your tracked things
def river
@results = if @user.nil?
- []
-else
- @user.track_things.collect { |thing|
- perform_search([InfoRequestEvent], thing.track_query, thing.params[:feed_sortby], nil).results
- }.flatten.sort { |a,b| b[:model].created_at <=> a[:model].created_at }.first(20)
-end
+ []
+ else
+ @user.
+ track_things.
+ collect { |thing| perform_search([InfoRequestEvent], thing.track_query, thing.params[:feed_sortby], nil).results }.
+ flatten.
+ sort { |a,b| b[:model].created_at <=> a[:model].created_at }.
+ first(20)
+ end
end
def set_profile_photo
diff --git a/app/models/concerns/translatable.rb b/app/models/concerns/translatable.rb
index 47a040ade9..6bd303e2d2 100644
--- a/app/models/concerns/translatable.rb
+++ b/app/models/concerns/translatable.rb
@@ -14,11 +14,9 @@ def translated_versions
end
def ordered_translations
- translations.select do |translation|
- AlaveteliLocalization.available_locales.include?(translation.locale.to_s)
- end.sort_by do |translation|
- AlaveteliLocalization.available_locales.index(translation.locale.to_s)
- end
+ translations.
+ select { |translation| AlaveteliLocalization.available_locales.include?(translation.locale.to_s) }.
+ sort_by { |translation| AlaveteliLocalization.available_locales.index(translation.locale.to_s) }
end
def build_all_translations
From e7224b23cc1eeefa56cdf7dd970c038fb945028a Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 16:06:37 +0000
Subject: [PATCH 216/289] Style: CaseEquality (RuboCop)
---
app/helpers/highlight_helper.rb | 2 +-
spec/controllers/public_body_controller_spec.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/highlight_helper.rb b/app/helpers/highlight_helper.rb
index ec1c77179d..8258337f30 100644
--- a/app/helpers/highlight_helper.rb
+++ b/app/helpers/highlight_helper.rb
@@ -13,7 +13,7 @@ def highlight_matches(text, phrases, options = {})
text
else
match = Array(phrases).map do |p|
- Regexp === p ? p.to_s : Regexp.escape(p)
+ p.is_a?(Regexp) ? p.to_s : Regexp.escape(p)
end.join('|')
if block_given?
diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb
index ba9dfafb2b..a7fd6a011c 100644
--- a/spec/controllers/public_body_controller_spec.rb
+++ b/spec/controllers/public_body_controller_spec.rb
@@ -158,7 +158,7 @@ def make_single_language_example(locale)
get :list, params: { locale: 'es' }
pb_ids = assigns[:public_bodies].map(&:id)
unique_pb_ids = pb_ids.uniq
- expect(pb_ids.sort).to be === unique_pb_ids.sort
+ expect(pb_ids.sort).to eq(unique_pb_ids.sort)
end
it 'should show public body names in the selected locale language if present' do
From 96634969cd4fc0c9f7818dc4a38e456089212ae8 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 16:31:42 +0000
Subject: [PATCH 217/289] Style: SpecialGlobalVars (RuboCop)
---
config/initializers/alaveteli.rb | 2 +-
gems/alaveteli_features/alaveteli_features.gemspec | 3 ++-
lib/acts_as_xapian/acts_as_xapian.rb | 3 ++-
lib/mail_handler.rb | 9 +++++----
script/switch-theme.rb | 2 +-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index b1f3c38dcc..3965f98998 100644
--- a/config/initializers/alaveteli.rb
+++ b/config/initializers/alaveteli.rb
@@ -1,5 +1,5 @@
# MySociety specific helper functions
-$:.push(File.join(File.dirname(__FILE__), '../../commonlib/rblib'))
+$LOAD_PATH.push(File.join(File.dirname(__FILE__), '../../commonlib/rblib'))
# ... if these fail to include, you need the commonlib submodule from git
# (type "git submodule update --init" in the whatdotheyknow directory)
diff --git a/gems/alaveteli_features/alaveteli_features.gemspec b/gems/alaveteli_features/alaveteli_features.gemspec
index da07c0c89d..68a338bdb3 100644
--- a/gems/alaveteli_features/alaveteli_features.gemspec
+++ b/gems/alaveteli_features/alaveteli_features.gemspec
@@ -1,3 +1,4 @@
+require 'English'
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'alaveteli_features/version'
@@ -12,7 +13,7 @@ Gem::Specification.new do |spec|
spec.homepage = "https://alaveteli.org"
spec.license = "MIT"
- spec.files = `git ls-files`.split($/)
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 25fb93248b..22d6b82d5b 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -12,6 +12,7 @@
# Make it so if Xapian isn't installed, the Rails app doesn't fail completely,
# just when somebody does a search.
+require 'English'
begin
require 'xapian'
$acts_as_xapian_bindings_available = true
@@ -908,7 +909,7 @@ def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values
pid = Process.fork # TODO: this will only work on Unix, tough
if pid
Process.waitpid(pid)
- raise "batch fork child failed, exiting also" unless $?.success?
+ raise "batch fork child failed, exiting also" unless $CHILD_STATUS.success?
# database connection doesn't survive a fork, rebuild it
else
# fully reopen the database each time (with a new object)
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index dec6cb8c0e..18cc6f4042 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -1,4 +1,5 @@
# Handles the parsing of email
+require 'English'
require 'tmpdir'
module MailHandler
@@ -20,9 +21,9 @@ def tnef_attachments(content)
IO.popen("tnef -K -C #{dir} 2> /dev/null", "wb") do |f|
f.write(content)
f.close
- raise IOError, "tnef exited with signal #{$?.termsig}" if $?.signaled?
- if $?.exited? && $?.exitstatus != 0
- raise TNEFParsingError, "tnef exited with status #{$?.exitstatus}"
+ raise IOError, "tnef exited with signal #{$CHILD_STATUS.termsig}" if $CHILD_STATUS.signaled?
+ if $CHILD_STATUS.exited? && $CHILD_STATUS.exitstatus != 0
+ raise TNEFParsingError, "tnef exited with status #{$CHILD_STATUS.exitstatus}"
end
end
found = 0
@@ -131,7 +132,7 @@ def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
text += get_attachment_text_from_zip_file(zip_file)
zip_file.close
rescue
- $stderr.puts("Error processing zip file: #{$!.inspect}")
+ $stderr.puts("Error processing zip file: #{$ERROR_INFO.inspect}")
end
end
tempfile.close
diff --git a/script/switch-theme.rb b/script/switch-theme.rb
index f000178310..a93ae2bc96 100755
--- a/script/switch-theme.rb
+++ b/script/switch-theme.rb
@@ -72,7 +72,7 @@ def show_themes
if ARGV.length == 1
requested_theme = ARGV[0]
else
- STDERR.puts "Usage: #{$0} "
+ STDERR.puts "Usage: #{$PROGRAM_NAME} "
show_themes
exit 1
end
From d93b868d513a91a1947dbb9cf7e3ff3449cdf548 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 10:34:09 +0000
Subject: [PATCH 218/289] Style: AndOr RuboCop refactor
---
app/controllers/admin_public_body_controller.rb | 2 +-
app/controllers/followups_controller.rb | 2 +-
app/controllers/user_controller.rb | 2 +-
app/mailers/application_mailer.rb | 2 +-
app/models/holiday_import.rb | 2 +-
app/models/incoming_message.rb | 2 +-
app/models/info_request_event.rb | 2 +-
app/models/public_body.rb | 4 ++--
lib/acts_as_xapian/acts_as_xapian.rb | 8 ++++----
lib/mail_handler.rb | 8 ++++----
lib/memory_profiler.rb | 2 +-
lib/tasks/cleanup.rake | 2 +-
lib/tasks/graphs.rake | 4 ++--
lib/tasks/themes.rake | 2 +-
14 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 58f0a13c50..5e35c6225c 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -127,7 +127,7 @@ def destroy
def mass_tag
lookup_query
- if params[:tag] and params[:tag] != ""
+ if params[:tag] && (params[:tag] != "")
if params[:table_name] == 'exact'
bodies = @public_bodies_by_tag
elsif params[:table_name] == 'substring'
diff --git a/app/controllers/followups_controller.rb b/app/controllers/followups_controller.rb
index dd1135d3b6..e5278ae283 100644
--- a/app/controllers/followups_controller.rb
+++ b/app/controllers/followups_controller.rb
@@ -63,7 +63,7 @@ def check_reedit
end
def check_request_matches_incoming_message
- if @incoming_message and @info_request != @incoming_message.info_request
+ if @incoming_message && (@info_request != @incoming_message.info_request)
raise ActiveRecord::RecordNotFound, "Incoming message #{@incoming_message.id} does not belong " \
"to request #{@info_request.id}"
end
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index cfd31f948d..04091e9d27 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -247,7 +247,7 @@ def signchangeemail
# if not already, send a confirmation link to the new email address which logs
# them into the old email's user account, but with special user_circumstance
- if !session[:user_circumstance] or (session[:user_circumstance] != "change_email")
+ if !session[:user_circumstance] || (session[:user_circumstance] != "change_email")
# don't store the password in the db
params[:signchangeemail].delete(:password)
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 3379f5ab58..b89fee8b6e 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -39,7 +39,7 @@ def mail_user(user, subject, opts = {})
end
def contact_for_user(user = nil)
- if feature_enabled?(:alaveteli_pro) and user and user.is_pro?
+ if feature_enabled?(:alaveteli_pro) && user && user.is_pro?
pro_contact_from_name_and_email
else
contact_from_name_and_email
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index 603ff53417..f566427781 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -88,7 +88,7 @@ def populate_from_ical_feed
end
def populate_from_ical_event(cal_event)
- if cal_event.dtstart >= start_date and cal_event.dtstart <= end_date
+ if (cal_event.dtstart >= start_date) && (cal_event.dtstart <= end_date)
holidays << Holiday.new(description: cal_event.summary,
day: cal_event.dtstart)
end
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index e4cc0ea360..e5e6450ef4 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -388,7 +388,7 @@ def get_main_body_text_part(leaves=[])
# instead use the first text attachment
# e.g. http://www.whatdotheyknow.com/request/list_of_public_authorties)
leaves.each do |p|
- if p.content_type == 'text/plain' or p.content_type == 'text/html'
+ if (p.content_type == 'text/plain') || (p.content_type == 'text/html')
return p
end
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 0cf7211a12..492bb3a4a2 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -102,7 +102,7 @@ class InfoRequestEvent < ApplicationRecord
end
def must_be_valid_state
- if described_state and !InfoRequest::State.all.include?(described_state)
+ if described_state && !InfoRequest::State.all.include?(described_state)
errors.add(:described_state, "is not a valid state")
end
end
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index f14d2426be..fd97ebbf18 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -509,7 +509,7 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
line += 1
# Parse the first line as a field list if it starts with '#'
- if line==1 and row.first.to_s =~ /^#(.*)$/
+ if (line==1) && row.first.to_s =~(/^#(.*)$/)
row[0] = row[0][1..-1] # Remove the # sign on first field
row.each_with_index { |field, i| field_names[field] = i }
next
@@ -547,7 +547,7 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
end
# Rollback if a dry run, or we had errors
- raise ImportCSVDryRun if dry_run or errors.size > 0
+ raise ImportCSVDryRun if dry_run || (errors.size > 0)
end
rescue ImportCSVDryRun
# Ignore
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index 22d6b82d5b..e40894b073 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -951,7 +951,7 @@ def xapian_document_term
def xapian_value(field, type = nil, index_translations = false)
if index_translations && respond_to?("translations")
- if type == :date or type == :boolean
+ if (type == :date) || (type == :boolean)
value = single_xapian_value(field, type = type)
else
values = []
@@ -1024,7 +1024,7 @@ def xapian_index(terms = true, values = true, texts = true)
# 1. Which terms to index? We allow the user to specify particular ones
terms_to_index = []
drop_all_terms = false
- if terms and xapian_options[:terms]
+ if terms && xapian_options[:terms]
terms_to_index = xapian_options[:terms].dup
if terms.is_a?(String)
terms_to_index.reject! { |term| !terms.include?(term[1]) }
@@ -1037,12 +1037,12 @@ def xapian_index(terms = true, values = true, texts = true)
end
# 2. Texts to index? Currently, it's all or nothing
texts_to_index = []
- if texts and xapian_options[:texts]
+ if texts && xapian_options[:texts]
texts_to_index = xapian_options[:texts]
end
# 3. Values to index? Currently, it's all or nothing
values_to_index = []
- if values and xapian_options[:values]
+ if values && xapian_options[:values]
values_to_index = xapian_options[:values]
end
diff --git a/lib/mail_handler.rb b/lib/mail_handler.rb
index 18cc6f4042..7694f2f12a 100644
--- a/lib/mail_handler.rb
+++ b/lib/mail_handler.rb
@@ -42,13 +42,13 @@ def tnef_attachments(content)
def normalise_content_type(content_type)
# e.g. http://www.whatdotheyknow.com/request/93/response/250
- if content_type == 'application/excel' or content_type == 'application/msexcel' or content_type == 'application/x-ms-excel'
+ if (content_type == 'application/excel') || (content_type == 'application/msexcel') || (content_type == 'application/x-ms-excel')
content_type = 'application/vnd.ms-excel'
end
- if content_type == 'application/mspowerpoint' or content_type == 'application/x-ms-powerpoint'
+ if (content_type == 'application/mspowerpoint') || (content_type == 'application/x-ms-powerpoint')
content_type = 'application/vnd.ms-powerpoint'
end
- if content_type == 'application/msword' or content_type == 'application/x-ms-word'
+ if (content_type == 'application/msword') || (content_type == 'application/x-ms-word')
content_type = 'application/vnd.ms-word'
end
if content_type == 'application/x-zip-compressed'
@@ -56,7 +56,7 @@ def normalise_content_type(content_type)
end
# e.g. http://www.whatdotheyknow.com/request/copy_of_current_swessex_scr_opt#incoming-9928
- if content_type == 'application/acrobat' or content_type == 'document/pdf'
+ if (content_type == 'application/acrobat') || (content_type == 'document/pdf')
content_type = 'application/pdf'
end
diff --git a/lib/memory_profiler.rb b/lib/memory_profiler.rb
index b7bd56bb78..bc01745edc 100644
--- a/lib/memory_profiler.rb
+++ b/lib/memory_profiler.rb
@@ -35,7 +35,7 @@ def self.start(opt={})
ObjectSpace.each_object do |o|
curr[o.class] += 1 #Marshal.dump(o).size rescue 1
- curr_strings.push o if opt[:string_debug] and o.class == String
+ curr_strings.push o if opt[:string_debug] && (o.class == String)
end
if opt[:string_debug]
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 5239dc8234..863bb70733 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -8,7 +8,7 @@ namespace :cleanup do
holding_pen.info_request_events.
where(event_type: %w(redeliver_incoming destroy_incoming)).
find_each do |event|
- $stderr.puts event.inspect if verbose or dryrun
+ $stderr.puts event.inspect if verbose || dryrun
event.destroy unless dryrun
end
end
diff --git a/lib/tasks/graphs.rake b/lib/tasks/graphs.rake
index f7acb33215..bd0511ca7a 100644
--- a/lib/tasks/graphs.rake
+++ b/lib/tasks/graphs.rake
@@ -94,7 +94,7 @@ namespace :graphs do
all_users = select_as_columns(aggregate_signups)
# nothing to do, bail
- unless all_users and all_users[0].size >= minimum_data_size
+ unless all_users && (all_users[0].size >= minimum_data_size)
if verbose
exit "warning: no request data to graph, skipping task"
else
@@ -219,7 +219,7 @@ namespace :graphs do
# nothing to do, bail
# (both nil and a single datapoint will result in an undrawable graph)
- unless all_requests and all_requests[0].size >= minimum_data_size
+ unless all_requests && (all_requests[0].size >= minimum_data_size)
if verbose
abort "warning: no request data to graph, skipping task"
else
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index c23f6e6d33..3df338b827 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -84,7 +84,7 @@ namespace :themes do
puts "Failed to find #{committish}; skipping..." if verbose
end
end
- puts "Falling to using HEAD instead" if all_failed and verbose
+ puts "Falling to using HEAD instead" if all_failed && verbose
end
def install_theme(theme_url, verbose, deprecated=false)
From 67f9db7ac3ace68808ba36cf2a5b38d8dc159463 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 10:39:07 +0000
Subject: [PATCH 219/289] Style: TrailingCommaInArrayLiteral RuboCop
---
app/controllers/admin_general_controller.rb | 2 +-
app/models/foi_attachment.rb | 4 ++--
app/models/info_request_event.rb | 2 +-
app/models/public_body.rb | 2 +-
lib/tasks/cleanup.rake | 2 +-
lib/world_foi_websites.rb | 2 +-
spec/controllers/general_controller_spec.rb | 4 ++--
spec/lib/typeahead_search_spec.rb | 2 +-
spec/models/incoming_message_spec.rb | 8 ++++----
spec/models/mail_server_log_spec.rb | 2 +-
spec/models/public_body_spec.rb | 14 +++++++-------
11 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 9a31fd3e36..ba9a506f79 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -81,7 +81,7 @@ def index
@embargoed_request_tasks = [
@embargoed_requires_admin_requests,
@embargoed_error_message_requests,
- @embargoed_attention_requests,
+ @embargoed_attention_requests
].any? { |to_do_list| ! to_do_list.empty? }
@embargoed_attention_comments = Comment.
diff --git a/app/models/foi_attachment.rb b/app/models/foi_attachment.rb
index 3529801460..f67986eed4 100644
--- a/app/models/foi_attachment.rb
+++ b/app/models/foi_attachment.rb
@@ -256,7 +256,7 @@ def has_google_docs_viewer?
"application/vnd.openxmlformats-officedocument.presentationml.presentation", # .pptx
"application/vnd.ms-excel", # .xls
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", # .xlsx
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" # .xlsx
].include?(content_type)
end
@@ -264,7 +264,7 @@ def has_google_docs_viewer?
def has_body_as_html?
[
"text/plain",
- "application/rtf",
+ "application/rtf"
].include?(content_type) || has_google_docs_viewer?
end
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 492bb3a4a2..9fffd50cd7 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -116,7 +116,7 @@ def must_be_valid_state
[ :created_at_numeric, 1, "created_at", :number ], # for sorting
[ :described_at_numeric, 2, "described_at", :number ], # TODO: using :number for lack of :datetime support in Xapian values
[ :request, 3, "request_collapse", :string ],
- [ :request_title_collapse, 4, "request_title_collapse", :string ],
+ [ :request_title_collapse, 4, "request_title_collapse", :string ]
],
terms: [ [ :calculated_state, 'S', "status" ],
[ :requested_by, 'B', "requested_by" ],
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index fd97ebbf18..c1d862d2cf 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -56,7 +56,7 @@ def self.admin_title
['publication_scheme', '(i18n)'],
['disclosure_log', '(i18n)'],
['home_page', ''],
- ['tag_string', '(tags separated by spaces)'],
+ ['tag_string', '(tags separated by spaces)']
]
end
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake
index 863bb70733..b62367d4fb 100644
--- a/lib/tasks/cleanup.rake
+++ b/lib/tasks/cleanup.rake
@@ -81,7 +81,7 @@ namespace :cleanup do
request.public_body_id,
request.public_body.name,
request.public_body.request_email,
- request.created_at.to_s,
+ request.created_at.to_s
]
end
end
diff --git a/lib/world_foi_websites.rb b/lib/world_foi_websites.rb
index 349bbf31a5..822d66de8f 100644
--- a/lib/world_foi_websites.rb
+++ b/lib/world_foi_websites.rb
@@ -140,7 +140,7 @@ def self.world_foi_websites
{ name: 'Derecho al Dato',
country_name: 'Argentina',
country_iso_code: 'AR',
- url: 'https://derechoaldato.com.ar/' },
+ url: 'https://derechoaldato.com.ar/' }
]
world_foi_websites
end
diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb
index d16cc5ad27..1960f63347 100644
--- a/spec/controllers/general_controller_spec.rb
+++ b/spec/controllers/general_controller_spec.rb
@@ -259,7 +259,7 @@
info_request_events(:useless_outgoing_message_event),
info_request_events(:silly_outgoing_message_event),
info_request_events(:useful_incoming_message_event),
- info_request_events(:another_useful_incoming_message_event),
+ info_request_events(:another_useful_incoming_message_event)
])
expect(assigns[:xapian_users].results.map { |x| x[:model] }).to eq([users(:bob_smith_user)])
expect(assigns[:xapian_bodies].results).to eq([])
@@ -289,7 +289,7 @@
info_request_events(:useless_outgoing_message_event),
info_request_events(:silly_outgoing_message_event),
info_request_events(:useful_incoming_message_event),
- info_request_events(:another_useful_incoming_message_event),
+ info_request_events(:another_useful_incoming_message_event)
])
expect(assigns[:xapian_users]).to eq(nil)
expect(assigns[:xapian_bodies]).to eq(nil)
diff --git a/spec/lib/typeahead_search_spec.rb b/spec/lib/typeahead_search_spec.rb
index e68d35cb15..2c5f00eb80 100644
--- a/spec/lib/typeahead_search_spec.rb
+++ b/spec/lib/typeahead_search_spec.rb
@@ -133,7 +133,7 @@ def search_bodies(xapian_search)
expect(search_info_requests(search)).to match_array([
info_requests(:fancy_dog_request),
info_requests(:naughty_chicken_request),
- info_requests(:another_boring_request),
+ info_requests(:another_boring_request)
])
end
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 217ac3279d..cd5f967caf 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -899,7 +899,7 @@ def populate_raw_email(fixture)
im.extract_attachments!
expect(im.get_attachments_for_display.map(&:display_filename)).to eq([
- 'bah.txt',
+ 'bah.txt'
])
end
@@ -946,7 +946,7 @@ def populate_raw_email(fixture)
expect(attachments.map(&:display_filename)).to eq([
'Same attachment twice.txt',
'hello.txt',
- 'hello.txt',
+ 'hello.txt'
])
end
@@ -985,7 +985,7 @@ def populate_raw_email(fixture)
expect(im.get_attachments_for_display.map(&:display_filename)).to eq([
'test.html', # picks HTML rather than text by default, as likely to render better
- 'attach.txt',
+ 'attach.txt'
])
end
end
@@ -1011,7 +1011,7 @@ def populate_raw_email(fixture)
expect(im.get_attachments_for_display.map(&:display_filename)).to eq([
'FOI 09 02976i.doc',
- 'FOI 09 02976iii.doc',
+ 'FOI 09 02976iii.doc'
])
end
diff --git a/spec/models/mail_server_log_spec.rb b/spec/models/mail_server_log_spec.rb
index 85e160f7f3..4a90d64790 100644
--- a/spec/models/mail_server_log_spec.rb
+++ b/spec/models/mail_server_log_spec.rb
@@ -215,7 +215,7 @@
"Oct 3 16:39:35 host postfix/qmgr[15615]: CB55836EE58C: from=, size=1695, nrcpt=1 (queue active)",
"Oct 3 16:39:38 host postfix/smtp[7676]: CB55836EE58C: to=, relay=aspmx.l.google.com[74.125.25.27]:25, delay=2.5, delays=0.13/0.02/1.7/0.59, dsn=2.0.0, status=sent (250 2.0.0 OK 1349246383 j9si1676296paw.328)",
"Oct 3 16:39:38 host postfix/smtp[1681]: 9634B16F7F7: to=, relay=none, delay=46, status=deferred (connect to 216.150.150.131[216.150.150.131]: No route to host)",
- "Oct 3 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed",
+ "Oct 3 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed"
]}
describe ".load_postfix_log_data" do
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index c18e12ec92..c273f81236 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1397,7 +1397,7 @@ def set_default_attributes(public_body)
expect(notes[0..2]).to eq([
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t\{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"\}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t\{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"\}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"\}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t\{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"\}"
])
expect(notes[3]).to match(/Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/)
@@ -1723,7 +1723,7 @@ def set_default_attributes(public_body)
"line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: es):\n\t{\"name\":\"Autoridad Escocesa\"}",
"line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: es):\n\t{\"name\":\"Autoridad Irlandesa\"}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: es):\n\t{\"name\":\"Autoridad Irlandesa\"}"
])
expect(notes[6]).to match(/Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/)
@@ -1749,7 +1749,7 @@ def set_default_attributes(public_body)
expect(notes[0..2]).to eq([
"line 2: creating new authority 'North West Fake Authority' (locale: en):\n\t{\"name\":\"North West Fake Authority\",\"request_email\":\"north_west_foi@localhost\",\"home_page\":\"http://northwest.org\"}",
"line 3: creating new authority 'Scottish Fake Authority' (locale: en):\n\t{\"name\":\"Scottish Fake Authority\",\"request_email\":\"scottish_foi@localhost\",\"home_page\":\"http://scottish.org\",\"tag_string\":\"scottish\"}",
- "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}",
+ "line 4: creating new authority 'Fake Authority of Northern Ireland' (locale: en):\n\t{\"name\":\"Fake Authority of Northern Ireland\",\"request_email\":\"ni_foi@localhost\",\"tag_string\":\"fake aTag\"}"
])
expect(notes[3]).to match(/Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/)
@@ -1819,7 +1819,7 @@ def set_default_attributes(public_body)
['publication_scheme', '(i18n)'],
['disclosure_log', '(i18n)'],
['home_page', ''],
- ['tag_string', '(tags separated by spaces)'],
+ ['tag_string', '(tags separated by spaces)']
]
expect(PublicBody.csv_import_fields).to eq(expected_fields)
@@ -1829,7 +1829,7 @@ def set_default_attributes(public_body)
old_csv_import_fields = PublicBody.csv_import_fields.clone
expected_fields = [
['name', '(i18n)Existing records cannot be renamed'],
- ['short_name', '(i18n)'],
+ ['short_name', '(i18n)']
]
PublicBody.csv_import_fields = expected_fields
@@ -1850,7 +1850,7 @@ def set_default_attributes(public_body)
['disclosure_log', '(i18n)'],
['home_page', ''],
['tag_string', '(tags separated by spaces)'],
- ['a_new_field', ''],
+ ['a_new_field', '']
]
PublicBody.csv_import_fields << ['a_new_field', '']
@@ -1871,7 +1871,7 @@ def set_default_attributes(public_body)
expect(notes.size).to eq(3)
expect(notes[0..1]).to eq([
"line 2: creating new authority 'Test' (locale: en):\n\t{\"name\":\"Test\",\"request_email\":\"test@test.es\",\"home_page\":\"http://www.test.es/\",\"tag_string\":\"37\"}",
- "line 2: creating new authority 'Test' (locale: es):\n\t{\"name\":\"Test\"}",
+ "line 2: creating new authority 'Test' (locale: es):\n\t{\"name\":\"Test\"}"
])
expect(notes[2]).to match(/Notes: Some bodies are in database, but not in CSV file:\n( .+\n)*You may want to delete them manually.\n/)
From b42ed65c96fbee6f32cb44c951a12573ed17a18e Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 10:44:07 +0000
Subject: [PATCH 220/289] Style: IfInsideElse RuboCop
---
app/controllers/admin_controller.rb | 52 +++++++++----------
app/controllers/application_controller.rb | 8 ++-
.../password_changes_controller.rb | 14 +++--
app/controllers/request_controller.rb | 12 ++---
app/controllers/user_controller.rb | 40 +++++++-------
app/controllers/users/messages_controller.rb | 24 ++++-----
app/controllers/users/sessions_controller.rb | 27 +++++-----
app/helpers/info_request_helper.rb | 12 ++---
app/models/ability.rb | 4 +-
app/models/incoming_message.rb | 6 +--
app/models/info_request.rb | 8 ++-
.../info_request/response_rejection/bounce.rb | 12 ++---
lib/acts_as_xapian/acts_as_xapian.rb | 10 ++--
lib/alaveteli_external_command.rb | 8 ++-
lib/mail_handler/backends/mail_backend.rb | 28 +++++-----
lib/tasks/themes.rake | 4 +-
16 files changed, 119 insertions(+), 150 deletions(-)
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 1672a3b709..ba1eeab5c4 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -41,35 +41,31 @@ def authenticate
if AlaveteliConfiguration.skip_admin_auth
session[:using_admin] = 1
nil
- else
- if session[:using_admin].nil? || session[:admin_name].nil?
- if params[:emergency].nil? || AlaveteliConfiguration.disable_emergency_user
- if !authenticated?
- ask_to_login(
- web: _('To log into the administrative interface'),
- email: _('Then you can log into the administrative interface'),
- email_subject: _('Log into the admin interface'),
- user_name: 'a superuser'
- )
- else
- if !@user.nil? && @user.is_admin?
- session[:using_admin] = 1
- session[:admin_name] = @user.url_name
- else
- session[:using_admin] = nil
- session[:user_id] = nil
- session[:admin_name] = nil
- authenticate
- end
- end
+ elsif session[:using_admin].nil? || session[:admin_name].nil?
+ if params[:emergency].nil? || AlaveteliConfiguration.disable_emergency_user
+ if !authenticated?
+ ask_to_login(
+ web: _('To log into the administrative interface'),
+ email: _('Then you can log into the administrative interface'),
+ email_subject: _('Log into the admin interface'),
+ user_name: 'a superuser'
+ )
+ elsif !@user.nil? && @user.is_admin?
+ session[:using_admin] = 1
+ session[:admin_name] = @user.url_name
else
- authenticate_or_request_with_http_basic do |user_name, password|
- if user_name == AlaveteliConfiguration.admin_username && password == AlaveteliConfiguration.admin_password
- session[:using_admin] = 1
- session[:admin_name] = user_name
- else
- request_http_basic_authentication
- end
+ session[:using_admin] = nil
+ session[:user_id] = nil
+ session[:admin_name] = nil
+ authenticate
+ end
+ else
+ authenticate_or_request_with_http_basic do |user_name, password|
+ if user_name == AlaveteliConfiguration.admin_username && password == AlaveteliConfiguration.admin_password
+ session[:using_admin] = 1
+ session[:admin_name] = user_name
+ else
+ request_http_basic_authentication
end
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ddc80c855d..674952c1a2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -318,12 +318,10 @@ def add_post_redirect_param_to_uri(uri)
else
uri += "&post_redirect=1"
end
+ elsif uri.include?("#")
+ uri.sub!("#", "?post_redirect=1#")
else
- if uri.include?("#")
- uri.sub!("#", "?post_redirect=1#")
- else
- uri += "?post_redirect=1"
- end
+ uri += "?post_redirect=1"
end
uri
end
diff --git a/app/controllers/password_changes_controller.rb b/app/controllers/password_changes_controller.rb
index 78a3882671..2aa2878148 100644
--- a/app/controllers/password_changes_controller.rb
+++ b/app/controllers/password_changes_controller.rb
@@ -94,17 +94,15 @@ def update
redirect_to SafeRedirect.new(@pretoken_redirect.uri).path,
notice: _('Your password has been changed.')
end
- else
- if otp_enabled?(@password_change_user)
- msg = _("Your password has been changed. " \
+ elsif otp_enabled?(@password_change_user)
+ msg = _("Your password has been changed. " \
"You also have a new one time passcode which you'll " \
"need next time you want to change your password")
redirect_to one_time_password_path, notice: msg
- else
- msg = _('Your password has been changed.')
- redirect_to show_user_profile_path(@password_change_user.url_name),
- notice: msg
- end
+ else
+ msg = _('Your password has been changed.')
+ redirect_to show_user_profile_path(@password_change_user.url_name),
+ notice: msg
end
else
render :edit
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index aaf7f12a8a..e4692be147 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -671,14 +671,12 @@ def render_new_compose
if @info_request.public_body.is_requestable?
render action: 'new'
+ elsif @info_request.public_body.not_requestable_reason == 'bad_contact'
+ render action: 'new_bad_contact'
else
- if @info_request.public_body.not_requestable_reason == 'bad_contact'
- render action: 'new_bad_contact'
- else
- # if not requestable because defunct or not_apply, redirect to main page
- # (which doesn't link to the /new/ URL)
- redirect_to public_body_url(@info_request.public_body)
- end
+ # if not requestable because defunct or not_apply, redirect to main page
+ # (which doesn't link to the /new/ URL)
+ redirect_to public_body_url(@info_request.public_body)
end
nil
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index 04091e9d27..f64373a247 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -155,26 +155,26 @@ def signup
else
# New unconfirmed user
- # Block signups from suspicious countries
- # TODO: Add specs (see RequestController#create)
- # TODO: Extract to UserSpamScorer?
- if blocked_ip?(country_from_ip, @user_signup)
- handle_blocked_ip(@user_signup) && return
- end
-
- # Rate limit signups
- ip_rate_limiter.record(user_ip)
-
- if ip_rate_limiter.limit?(user_ip)
- handle_rate_limited_signup(user_ip, @user_signup.email) && return
- end
-
- # Prevent signups from potential spammers
- if spam_user?(@user_signup)
- handle_spam_user(@user_signup) do
- render action: 'sign'
- end && return
- end
+ # Block signups from suspicious countries
+ # TODO: Add specs (see RequestController#create)
+ # TODO: Extract to UserSpamScorer?
+ if blocked_ip?(country_from_ip, @user_signup)
+ handle_blocked_ip(@user_signup) && return
+ end
+
+ # Rate limit signups
+ ip_rate_limiter.record(user_ip)
+
+ if ip_rate_limiter.limit?(user_ip)
+ handle_rate_limited_signup(user_ip, @user_signup.email) && return
+ end
+
+ # Prevent signups from potential spammers
+ if spam_user?(@user_signup)
+ handle_spam_user(@user_signup) do
+ render action: 'sign'
+ end && return
+ end
@user_signup.email_confirmed = false
@user_signup.save!
diff --git a/app/controllers/users/messages_controller.rb b/app/controllers/users/messages_controller.rb
index 4a6af1c9c0..93a66ffdfd 100644
--- a/app/controllers/users/messages_controller.rb
+++ b/app/controllers/users/messages_controller.rb
@@ -15,20 +15,18 @@ def contact
if @recaptcha_required && !verify_recaptcha
flash.now[:error] = _('There was an error with the reCAPTCHA. ' \
'Please try again.')
- else
- if @contact.valid?
- if spam_user_message?(params[:contact][:message], @user)
- handle_spam_user_message(@user) && return
- end
-
- send_message(@user, @recipient_user)
- @user.user_messages.create
-
- flash[:notice] = _('Your message to {{recipient_user_name}} has ' \
- 'been sent!',
- recipient_user_name: @recipient_user.name.html_safe)
- redirect_to user_url(@recipient_user)
+ elsif @contact.valid?
+ if spam_user_message?(params[:contact][:message], @user)
+ handle_spam_user_message(@user) && return
end
+
+ send_message(@user, @recipient_user)
+ @user.user_messages.create
+
+ flash[:notice] = _('Your message to {{recipient_user_name}} has ' \
+ 'been sent!',
+ recipient_user_name: @recipient_user.name.html_safe)
+ redirect_to user_url(@recipient_user)
end
end
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb
index 1b8f0252c7..c5e1fe1e03 100644
--- a/app/controllers/users/sessions_controller.rb
+++ b/app/controllers/users/sessions_controller.rb
@@ -33,27 +33,24 @@ def create
# Failed to authenticate
clear_session_credentials
render template: 'user/sign'
- else
+ elsif @user_signin.email_confirmed
# Successful login
- if @user_signin.email_confirmed
-
+ if spam_user?(@user_signin)
# Prevent signins from potential spammers
- if spam_user?(@user_signin)
- handle_spam_user(@user_signin) do
- render template: 'user/sign'
- end && return
- end
+ handle_spam_user(@user_signin) do
+ render template: 'user/sign'
+ end && return
+ end
- sign_in(@user_signin, remember_me: params[:remember_me].present?)
+ sign_in(@user_signin, remember_me: params[:remember_me].present?)
- if is_modal_dialog
- render template: 'users/sessions/show'
- else
- do_post_redirect @post_redirect, @user_signin
- end
+ if is_modal_dialog
+ render template: 'users/sessions/show'
else
- send_confirmation_mail @user_signin
+ do_post_redirect @post_redirect, @user_signin
end
+ else
+ send_confirmation_mail @user_signin
end
rescue ActionController::ParameterMissing
flash[:error] = _('Invalid form submission')
diff --git a/app/helpers/info_request_helper.rb b/app/helpers/info_request_helper.rb
index 1ef7a7cd9b..3954b2814b 100644
--- a/app/helpers/info_request_helper.rb
+++ b/app/helpers/info_request_helper.rb
@@ -42,14 +42,12 @@ def status_text_awaiting_description(info_request, opts = {})
if is_owning_user && !info_request.is_external? && !render_to_file
status_text_awaiting_description_owner_please_answer(
new_responses_count)
+ elsif old_unclassified
+ status_text_awaiting_description_old_unclassified(
+ new_responses_count)
else
- if old_unclassified
- status_text_awaiting_description_old_unclassified(
- new_responses_count)
- else
- status_text_awaiting_description_other(info_request,
- new_responses_count)
- end
+ status_text_awaiting_description_other(info_request,
+ new_responses_count)
end
end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 645fad5da5..03422dea5c 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -209,8 +209,8 @@ def initialize(user, project: nil, public_token: false)
if feature_enabled? :alaveteli_pro
can :read, :api_key if user && user.is_pro_admin?
- else
- can :read, :api_key if user && user.is_admin?
+ elsif user && user.is_admin?
+ can :read, :api_key
end
if feature_enabled? :projects
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index e5e6450ef4..f91eda86a3 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -522,10 +522,8 @@ def get_body_for_html_display(collapse_quoted_sections = true)
end
# and display link for quoted stuff
text = text.gsub(/FOLDED_QUOTED_SECTION/, "\n\n" + ''+_("show quoted sections")+'' + "\n\n")
- else
- if folded_quoted_text.include?('FOLDED_QUOTED_SECTION')
- text = text + "\n\n" + ''+_("hide quoted sections")+''
- end
+ elsif folded_quoted_text.include?('FOLDED_QUOTED_SECTION')
+ text = text + "\n\n" + ''+_("hide quoted sections")+''
end
text.strip!
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 8f0c8ab8a0..6df03f08f9 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -858,12 +858,10 @@ def email_subject_followup(opts = {})
html = opts.fetch(:html, true)
if incoming_message.nil? || !incoming_message.valid_to_reply_to? || !incoming_message.subject
'Re: ' + email_subject_request(html: html)
+ elsif incoming_message.subject.match(/^Re:/i)
+ incoming_message.subject
else
- if incoming_message.subject.match(/^Re:/i)
- incoming_message.subject
- else
- 'Re: ' + incoming_message.subject
- end
+ 'Re: ' + incoming_message.subject
end
end
diff --git a/app/models/info_request/response_rejection/bounce.rb b/app/models/info_request/response_rejection/bounce.rb
index 93b4651f23..0649d91452 100644
--- a/app/models/info_request/response_rejection/bounce.rb
+++ b/app/models/info_request/response_rejection/bounce.rb
@@ -8,14 +8,12 @@ def reject(_reason = nil)
# to, or the mail is spoofing the request address, and we'll end up
# in a loop if we bounce it.
true
+ elsif info_request.is_external?
+ true
else
- if info_request.is_external?
- true
- else
- RequestMailer.
- stopped_responses(info_request, email, raw_email_data).
- deliver_now
- end
+ RequestMailer.
+ stopped_responses(info_request, email, raw_email_data).
+ deliver_now
end
end
end
diff --git a/lib/acts_as_xapian/acts_as_xapian.rb b/lib/acts_as_xapian/acts_as_xapian.rb
index e40894b073..fd572e2444 100644
--- a/lib/acts_as_xapian/acts_as_xapian.rb
+++ b/lib/acts_as_xapian/acts_as_xapian.rb
@@ -987,13 +987,11 @@ def single_xapian_value(field, type = nil)
end
elsif type == :boolean
value ? true : false
- else
+ elsif value.kind_of?(Array)
# Arrays are for terms which require multiple of them, e.g. tags
- if value.is_a?(Array)
- value.map(&:to_s)
- else
- value.to_s
- end
+ value.map(&:to_s)
+ else
+ value.to_s
end
end
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index 67c13a9f39..c6f7e3e91e 100644
--- a/lib/alaveteli_external_command.rb
+++ b/lib/alaveteli_external_command.rb
@@ -62,13 +62,11 @@ def run(*args)
$stderr.puts(%Q[External Command: Error from command "#{program_name} #{args.join(' ')}":])
$stderr.print(xc.err)
nil
+ elsif opts.has_key? :append_to
+ opts[:append_to] << "\n\n"
else
- if opts.has_key? :append_to
- opts[:append_to] << "\n\n"
- else
- xc.out
- end
+ xc.out
end
end
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index 13c2115cc5..e5830afa07 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -260,13 +260,11 @@ def expand_and_normalize_parts(part, parent_mail)
def count_parts(part, parent_mail)
if part.multipart?
part.parts.each { |p| count_parts(p, parent_mail) }
+ elsif part.rfc822_attachment
+ count_parts(part.rfc822_attachment, parent_mail)
else
- if part.rfc822_attachment
- count_parts(part.rfc822_attachment, parent_mail)
- else
- parent_mail.count_parts_count += 1
- part.url_part_number = parent_mail.count_parts_count
- end
+ parent_mail.count_parts_count += 1
+ part.url_part_number = parent_mail.count_parts_count
end
parent_mail.count_first_uudecode_count = parent_mail.count_parts_count
end
@@ -321,17 +319,15 @@ def _get_attachment_leaves_recursive(part, within_rfc822_attachment, parent_mail
parent_mail)
end
end
- else
+ elsif part.rfc822_attachment
# Add all the parts of a decoded attached message
- if part.rfc822_attachment
- leaves_found += _get_attachment_leaves_recursive(part.rfc822_attachment,
- part.rfc822_attachment,
- parent_mail)
- else
- # Store leaf
- part.within_rfc822_attachment = within_rfc822_attachment
- leaves_found += [part]
- end
+ leaves_found += _get_attachment_leaves_recursive(part.rfc822_attachment,
+ part.rfc822_attachment,
+ parent_mail)
+ else
+ # Store leaf
+ part.within_rfc822_attachment = within_rfc822_attachment
+ leaves_found += [part]
end
leaves_found
end
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 3df338b827..572b1702da 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -80,8 +80,8 @@ namespace :themes do
Git.checkout theme_directory, committish
all_failed = false
break
- else
- puts "Failed to find #{committish}; skipping..." if verbose
+ elsif verbose
+ puts "Failed to find #{committish}; skipping..."
end
end
puts "Falling to using HEAD instead" if all_failed && verbose
From d4cc0ee77e687576c6ab292a23129f239f1c62f6 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 11:02:22 +0000
Subject: [PATCH 221/289] Style: PreferredHashMethods RuboCop
---
app/helpers/admin_helper.rb | 2 +-
app/models/mail_server_log.rb | 4 ++--
.../outgoing_message/template/incoming_message_followup.rb | 2 +-
app/models/outgoing_message/template/initial_request.rb | 2 +-
app/models/outgoing_message/template/internal_review.rb | 2 +-
lib/alaveteli_external_command.rb | 2 +-
lib/configuration.rb | 2 +-
lib/xapian_queries.rb | 6 +++---
script/runner | 4 ++--
spec/models/statistics_spec.rb | 4 ++--
10 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index b844f11cc8..b8fe71a8a3 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -50,7 +50,7 @@ def event_params_description(event)
if can?(:admin, AlaveteliPro::Embargo) || !event.info_request.embargo
diff = event.params_diff
significant_event_params(event).each do |key|
- if diff[:new].has_key? key
+ if diff[:new].key? key
text += "Changed #{key} from '#{diff[:old][key]}' to '#{diff[:new][key]}'. "
end
end
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index a3266b1635..9cc35e3109 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -92,7 +92,7 @@ def self.load_postfix_log_data(f, done)
sanitised_line = scrub(line)
order += 1
queue_id = extract_postfix_queue_id_from_syslog_line(sanitised_line)
- if emails.has_key?(queue_id)
+ if emails.key?(queue_id)
create_mail_server_logs(emails[queue_id], sanitised_line, order, done)
end
end
@@ -103,7 +103,7 @@ def self.scan_for_postfix_queue_ids(f)
f.each do |line|
emails = email_addresses_on_line(line)
queue_id = extract_postfix_queue_id_from_syslog_line(line)
- result[queue_id] = [] unless result.has_key?(queue_id)
+ result[queue_id] = [] unless result.key?(queue_id)
result[queue_id] = (result[queue_id] + emails).uniq
end
result
diff --git a/app/models/outgoing_message/template/incoming_message_followup.rb b/app/models/outgoing_message/template/incoming_message_followup.rb
index 20f37b946e..7a66eac326 100644
--- a/app/models/outgoing_message/template/incoming_message_followup.rb
+++ b/app/models/outgoing_message/template/incoming_message_followup.rb
@@ -34,7 +34,7 @@ def template_string(replacements)
def assert_required_keys(hash, *required_keys)
required_keys.each do |required_key|
- unless hash.has_key?(required_key)
+ unless hash.key?(required_key)
raise ArgumentError, "Missing required key: #{required_key}"
end
end
diff --git a/app/models/outgoing_message/template/initial_request.rb b/app/models/outgoing_message/template/initial_request.rb
index eec008f877..fbc9d44ba4 100644
--- a/app/models/outgoing_message/template/initial_request.rb
+++ b/app/models/outgoing_message/template/initial_request.rb
@@ -49,7 +49,7 @@ def template_string(replacements)
def assert_required_keys(hash, *required_keys)
required_keys.each do |required_key|
- unless hash.has_key?(required_key)
+ unless hash.key?(required_key)
raise ArgumentError, "Missing required key: #{required_key}"
end
end
diff --git a/app/models/outgoing_message/template/internal_review.rb b/app/models/outgoing_message/template/internal_review.rb
index 83f4d11948..b0d9f140e5 100644
--- a/app/models/outgoing_message/template/internal_review.rb
+++ b/app/models/outgoing_message/template/internal_review.rb
@@ -56,7 +56,7 @@ def template_string(replacements)
def assert_required_keys(hash, *required_keys)
required_keys.each do |required_key|
- unless hash.has_key?(required_key)
+ unless hash.key?(required_key)
raise ArgumentError, "Missing required key: #{required_key}"
end
end
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index c6f7e3e91e..1dd1e1b9c1 100644
--- a/lib/alaveteli_external_command.rb
+++ b/lib/alaveteli_external_command.rb
@@ -62,7 +62,7 @@ def run(*args)
$stderr.puts(%Q[External Command: Error from command "#{program_name} #{args.join(' ')}":])
$stderr.print(xc.err)
nil
- elsif opts.has_key? :append_to
+ elsif opts.key? :append_to
opts[:append_to] << "\n\n"
else
diff --git a/lib/configuration.rb b/lib/configuration.rb
index 84b57c13fb..14532ef8fc 100644
--- a/lib/configuration.rb
+++ b/lib/configuration.rb
@@ -144,7 +144,7 @@ def self.background_jobs
def self.method_missing(name)
key = name.to_s.upcase
- if DEFAULTS.has_key?(key.to_sym)
+ if DEFAULTS.key?(key.to_sym)
MySociety::Config.get(key, DEFAULTS[key.to_sym])
else
super
diff --git a/lib/xapian_queries.rb b/lib/xapian_queries.rb
index 7c973bbc74..958df79191 100644
--- a/lib/xapian_queries.rb
+++ b/lib/xapian_queries.rb
@@ -59,13 +59,13 @@ def get_status_from_params(params)
def get_date_range_from_params(params)
query = ""
- if params.has_key?(:request_date_after) && !params.has_key?(:request_date_before)
+ if params.key?(:request_date_after) && !params.key?(:request_date_before)
params[:request_date_before] = Time.zone.now.strftime("%d/%m/%Y")
query += " #{params[:request_date_after]}..#{params[:request_date_before]}"
- elsif !params.has_key?(:request_date_after) && params.has_key?(:request_date_before)
+ elsif !params.key?(:request_date_after) && params.key?(:request_date_before)
params[:request_date_after] = "01/01/2001"
end
- if params.has_key?(:request_date_after)
+ if params.key?(:request_date_after)
query = " #{params[:request_date_after]}..#{params[:request_date_before]}"
end
query
diff --git a/script/runner b/script/runner
index bdbc1dbba4..1579046450 100755
--- a/script/runner
+++ b/script/runner
@@ -11,7 +11,7 @@ Dir.chdir(alaveteli_dir) do
# If the environment variable LOGFILE is present,
# redirect STDERR and STDOUT to that file.
- if ENV.has_key? "LOGFILE"
+ if ENV.key? "LOGFILE"
STDERR.reopen(STDOUT.reopen(ENV["LOGFILE"], "a"))
STDOUT.sync=true
puts "Daemon starting at #{Time.new}"
@@ -26,7 +26,7 @@ Dir.chdir(alaveteli_dir) do
# If the environment variable PIDFILE is present,
# write the pid of the daemon process to that file.
- if ENV.has_key? "PIDFILE"
+ if ENV.key? "PIDFILE"
File.open(ENV["PIDFILE"], 'w') do |fh|
fh.puts pid
end
diff --git a/spec/models/statistics_spec.rb b/spec/models/statistics_spec.rb
index 8ef875dfe0..830d40ecd4 100644
--- a/spec/models/statistics_spec.rb
+++ b/spec/models/statistics_spec.rb
@@ -25,7 +25,7 @@
percentages=false,
{} )
expect(to_draw['public_bodies'][0].class).to eq(Hash)
- expect(to_draw['public_bodies'][0].has_key?('request_email')).to be false
+ expect(to_draw['public_bodies'][0].key?('request_email')).to be false
end
it "should generate the expected id" do
@@ -76,7 +76,7 @@
y_values]
# These should be all be arrays with one element per public body:
per_pb_keys.each do |key|
- if to_draw.has_key? key
+ if to_draw.key? key
expect(to_draw[key].class).to eq(Array)
expect(to_draw[key].length).to eq(3), "for key #{key}"
end
From 679e311b3fc5a867bd4f4dbcec49ad1e35c83a87 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 11:16:52 +0000
Subject: [PATCH 222/289] Style: ZeroLengthPredicate RuboCop
---
app/controllers/admin_public_body_controller.rb | 4 ++--
app/controllers/users/sessions_controller.rb | 2 +-
app/mailers/request_mailer.rb | 2 +-
app/mailers/track_mailer.rb | 4 ++--
app/models/info_request.rb | 4 ++--
app/models/public_body.rb | 4 ++--
app/models/raw_email.rb | 2 +-
lib/mail_handler/backends/mail_backend.rb | 2 +-
lib/tasks/import.rake | 2 +-
9 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/app/controllers/admin_public_body_controller.rb b/app/controllers/admin_public_body_controller.rb
index 5e35c6225c..ff59aec23c 100644
--- a/app/controllers/admin_public_body_controller.rb
+++ b/app/controllers/admin_public_body_controller.rb
@@ -175,7 +175,7 @@ def import_csv
admin_current_user,
AlaveteliLocalization.available_locales)
- if errors.size == 0
+ if errors.empty?
if dry_run_only
notes.push("Dry run was successful, real run would do as above.")
# Store the csv file for ease of performing the real run
@@ -190,7 +190,7 @@ def import_csv
admin_current_user,
AlaveteliLocalization.
available_locales)
- raise "dry run mismatched real run" if errors.size != 0
+ raise "dry run mismatched real run" if !errors.empty?
notes.push("Import was successful.")
end
end
diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb
index c5e1fe1e03..fa1cf15dd8 100644
--- a/app/controllers/users/sessions_controller.rb
+++ b/app/controllers/users/sessions_controller.rb
@@ -29,7 +29,7 @@ def create
User.authenticate_from_form(user_signin_params,
@post_redirect.reason_params[:user_name])
end
- if @post_redirect.nil? || @user_signin.errors.size > 0
+ if @post_redirect.nil? || !@user_signin.errors.empty?
# Failed to authenticate
clear_session_credentials
render template: 'user/sign'
diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb
index be8825ea84..a256c71e52 100644
--- a/app/mailers/request_mailer.rb
+++ b/app/mailers/request_mailer.rb
@@ -245,7 +245,7 @@ def receive(email, raw_email, source = :mailin)
reply_info_requests = requests_matching_email(email)
# Nothing found, so save in holding pen
- if reply_info_requests.size == 0
+ if reply_info_requests.empty?
opts[:rejected_reason] =
_("Could not identify the request from the email address")
request = InfoRequest.holding_pen_request
diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb
index 1641b74b9b..72dc5b891c 100644
--- a/app/mailers/track_mailer.rb
+++ b/app/mailers/track_mailer.rb
@@ -99,13 +99,13 @@ def self.alert_tracks
alert_results.push(result)
end
# If there were more alerts for this track, then store them
- if alert_results.size > 0
+ if !alert_results.empty?
email_about_things.push([track_thing, alert_results, xapian_object])
end
end
# If we have anything to send, then send everything for the user in one mail
- if email_about_things.size > 0
+ if !email_about_things.empty?
# Send the email
AlaveteliLocalization.with_locale(user.locale) do
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 6df03f08f9..2caf2e100b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1365,7 +1365,7 @@ def is_followupable?(incoming_message)
end
def postal_email
- if who_can_followup_to.size == 0
+ if who_can_followup_to.empty?
public_body.request_email
else
who_can_followup_to[-1][1]
@@ -1373,7 +1373,7 @@ def postal_email
end
def postal_email_name
- if who_can_followup_to.size == 0
+ if who_can_followup_to.empty?
public_body.name
else
who_can_followup_to[-1][0]
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index c1d862d2cf..fd6dc3adcf 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -542,12 +542,12 @@ def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor,
# Give an error listing ones that are to be deleted
deleted_ones = set_of_existing - set_of_importing
- if deleted_ones.size > 0
+ if !deleted_ones.empty?
notes.push "Notes: Some " + tag + " bodies are in database, but not in CSV file:\n " + Array(deleted_ones).sort.join("\n ") + "\nYou may want to delete them manually.\n"
end
# Rollback if a dry run, or we had errors
- raise ImportCSVDryRun if dry_run || (errors.size > 0)
+ raise ImportCSVDryRun if dry_run || (!errors.empty?)
end
rescue ImportCSVDryRun
# Ignore
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index 8167f697a6..e428acb02c 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -64,7 +64,7 @@ def valid_to_reply_to?
end
def empty_from_field?
- mail.from_addrs.nil? || mail.from_addrs.size == 0
+ mail.from_addrs.nil? || mail.from_addrs.empty?
end
def mail
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index e5830afa07..8dc5e2336a 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -298,7 +298,7 @@ def get_attachment_leaves(mail)
def _get_attachment_leaves_recursive(part, within_rfc822_attachment, parent_mail)
leaves_found = []
if part.multipart?
- if part.parts.size == 0
+ if part.parts.empty?
# This is typically caused by a missing final
# MIME boundary, in which case the text of the
# message (including the opening MIME
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index 8b0531799d..24d94f4a68 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -65,7 +65,7 @@ namespace :import do
STDERR.puts "(#{percent_complete}% complete)"
end
- if errors.length > 0
+ if !errors.empty?
STDERR.puts 'Import failed, with the following errors:'
errors.each do |error|
From d2c582e4012a3f0fcfa308fc8b5e3587159a8ccb Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 20 Feb 2023 14:18:44 +0000
Subject: [PATCH 223/289] Style: Lambda RuboCop
---
app/controllers/track_controller.rb | 2 +-
app/models/alaveteli_pro/embargo.rb | 2 +-
app/models/comment.rb | 6 +++---
app/models/outgoing_message/snippet.rb | 2 +-
app/models/user/authentication.rb | 2 +-
lib/data_export.rb | 4 ++--
spec/lib/strip_empty_sessions_spec.rb | 2 +-
spec/models/public_body_spec.rb | 2 +-
8 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index 29c161db27..61dddb443a 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -176,7 +176,7 @@ def atom_feed_internal
request.format = params[:format] || 'xml'
respond_to do |format|
format.json { render json: @xapian_object.results.map { |r| r[:model].json_for_api(true,
- lambda do |t|
+ ->(t) do
view_context.highlight_and_excerpt(
t,
@xapian_object.words_to_highlight(
diff --git a/app/models/alaveteli_pro/embargo.rb b/app/models/alaveteli_pro/embargo.rb
index 385b05d676..6e06e65715 100644
--- a/app/models/alaveteli_pro/embargo.rb
+++ b/app/models/alaveteli_pro/embargo.rb
@@ -25,7 +25,7 @@ class Embargo < ApplicationRecord
validates_presence_of :info_request
validates_presence_of :publish_at
validates_inclusion_of :embargo_duration,
- in: lambda { |e| e.allowed_durations },
+ in: ->(e) { e.allowed_durations },
allow_nil: true
after_initialize :set_default_duration,
:set_publish_at_from_duration,
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 4b4c540d1f..07b295d271 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -54,19 +54,19 @@ class Comment < ApplicationRecord
validate :check_body_has_content,
:check_body_uses_mixed_capitals
- scope :visible, lambda {
+ scope :visible, -> {
joins(:info_request).
merge(InfoRequest.is_searchable.except(:select)).
where(visible: true)
}
- scope :embargoed, lambda {
+ scope :embargoed, -> {
joins(info_request: :embargo).
where('embargoes.id IS NOT NULL').
references(:embargoes)
}
- scope :not_embargoed, lambda {
+ scope :not_embargoed, -> {
joins(:info_request).
select('comments.*').
joins('LEFT OUTER JOIN embargoes
diff --git a/app/models/outgoing_message/snippet.rb b/app/models/outgoing_message/snippet.rb
index 7b7bc68b83..51dabd3fbe 100644
--- a/app/models/outgoing_message/snippet.rb
+++ b/app/models/outgoing_message/snippet.rb
@@ -29,7 +29,7 @@ def self.admin_title
end
OutgoingMessage::Snippet::Translation.class_eval do
- with_options if: lambda { |t| !t.default_locale? && t.required_attribute_submitted? } do |required|
+ with_options if: ->(t) { !t.default_locale? && t.required_attribute_submitted? } do |required|
required.validates :name, :body, presence: true
end
diff --git a/app/models/user/authentication.rb b/app/models/user/authentication.rb
index b58b543ecf..9554ba860d 100644
--- a/app/models/user/authentication.rb
+++ b/app/models/user/authentication.rb
@@ -8,7 +8,7 @@ module User::Authentication
attr_reader :password
attr_accessor :password_confirmation
- scope :sha1, lambda {
+ scope :sha1, -> {
where("users.salt IS NOT NULL AND users.hashed_password NOT LIKE '$2a$%'")
}
diff --git a/lib/data_export.rb b/lib/data_export.rb
index 085fca6cab..71eee643ed 100644
--- a/lib/data_export.rb
+++ b/lib/data_export.rb
@@ -58,7 +58,7 @@ def self.detects_gender(name)
end
def self.gender_lambda
- lambda { |x| detects_gender(x.name) }
+ ->(x) { detects_gender(x.name) }
end
# Remove all instances of user's name (if there is a user), otherwise
@@ -78,7 +78,7 @@ def self.case_insensitive_user_censor(text, user)
# Returns a lambda to pass to export function that censors x.property
def self.name_censor_lambda(property)
- lambda do |x|
+ ->(x) do
if x.respond_to?(:info_request)
case_insensitive_user_censor(x.send(property), x.info_request.user)
else
diff --git a/spec/lib/strip_empty_sessions_spec.rb b/spec/lib/strip_empty_sessions_spec.rb
index 8cecdce874..2ad1273211 100644
--- a/spec/lib/strip_empty_sessions_spec.rb
+++ b/spec/lib/strip_empty_sessions_spec.rb
@@ -2,7 +2,7 @@
RSpec.describe StripEmptySessions do
def make_response(session_data, response_headers)
- app = lambda do |env|
+ app = ->(env) do
env['rack.session'] = session_data
return [200, response_headers, ['content']]
end
diff --git a/spec/models/public_body_spec.rb b/spec/models/public_body_spec.rb
index c273f81236..6d708f06d2 100644
--- a/spec/models/public_body_spec.rb
+++ b/spec/models/public_body_spec.rb
@@ -1066,7 +1066,7 @@
expect(@public_body.get_tag_values('cheese')).to eq(['green'])
expect(@public_body.get_tag_values('wondrous')).to eq([])
- lambda {
+ -> {
expect(@public_body.get_tag_values('notthere')).to raise_error(PublicBody::TagNotFound)
}
end
From 8d22f36263f28402775a0ab4cb91036818381250 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 24 Feb 2023 14:43:16 +0000
Subject: [PATCH 224/289] Style: RedundantBegin RuboCop
---
.../admin_incoming_message_controller.rb | 18 ++--
.../alaveteli_pro/subscriptions_controller.rb | 84 +++++++++----------
app/controllers/application_controller.rb | 8 +-
app/models/censor_rule.rb | 8 +-
app/models/holiday_import.rb | 48 +++++------
app/models/info_request.rb | 10 +--
.../legislation/reference_collection.rb | 12 ++-
app/models/mail_server_log.rb | 44 +++++-----
.../lib/alaveteli_features.rb | 10 +--
lib/alaveteli_pro/metrics_report.rb | 22 +++--
lib/normalize_string.rb | 12 ++-
lib/tasks/geoip.rake | 24 +++---
12 files changed, 137 insertions(+), 163 deletions(-)
diff --git a/app/controllers/admin_incoming_message_controller.rb b/app/controllers/admin_incoming_message_controller.rb
index 01a02c0e52..e70d3f9990 100644
--- a/app/controllers/admin_incoming_message_controller.rb
+++ b/app/controllers/admin_incoming_message_controller.rb
@@ -54,16 +54,14 @@ def bulk_destroy
errors = []
info_request = InfoRequest.find(params[:request_id])
@incoming_messages.each do |message|
- begin
- message.destroy
- info_request.log_event(
- 'destroy_incoming',
- editor: admin_current_user,
- deleted_incoming_message_id: message.id
- )
- rescue
- errors << message.id
- end
+ message.destroy
+ info_request.log_event(
+ 'destroy_incoming',
+ editor: admin_current_user,
+ deleted_incoming_message_id: message.id
+ )
+ rescue
+ errors << message.id
end
info_request.expire(preserve_database_cache: true)
if errors.empty?
diff --git a/app/controllers/alaveteli_pro/subscriptions_controller.rb b/app/controllers/alaveteli_pro/subscriptions_controller.rb
index 234a9efc3e..927f527318 100644
--- a/app/controllers/alaveteli_pro/subscriptions_controller.rb
+++ b/app/controllers/alaveteli_pro/subscriptions_controller.rb
@@ -93,59 +93,57 @@ def create
end
def authorise
- begin
- @subscription = current_user.pro_account.subscriptions.
- retrieve(params.require(:id))
-
- if !@subscription
- head :not_found
-
- elsif @subscription.require_authorisation?
- respond_to do |format|
- format.json do
- render json: {
- payment_intent: @subscription.payment_intent.client_secret,
- callback_url: authorise_subscription_path(@subscription.id)
- }
- end
+ @subscription = current_user.pro_account.subscriptions.
+ retrieve(params.require(:id))
+
+ if !@subscription
+ head :not_found
+
+ elsif @subscription.require_authorisation?
+ respond_to do |format|
+ format.json do
+ render json: {
+ payment_intent: @subscription.payment_intent.client_secret,
+ callback_url: authorise_subscription_path(@subscription.id)
+ }
end
+ end
- elsif @subscription.invoice_open?
- flash[:error] = _('There was a problem authorising your payment. You ' \
- 'have not been charged. Please try again.')
+ elsif @subscription.invoice_open?
+ flash[:error] = _('There was a problem authorising your payment. You ' \
+ 'have not been charged. Please try again.')
- json_redirect_to plan_path(
- remove_stripe_namespace(@subscription.plan.id)
- )
+ json_redirect_to plan_path(
+ remove_stripe_namespace(@subscription.plan.id)
+ )
- elsif @subscription.active?
- current_user.add_role(:pro)
+ elsif @subscription.active?
+ current_user.add_role(:pro)
- flash[:notice] = {
- partial: 'alaveteli_pro/subscriptions/signup_message'
- }
- flash[:new_pro_user] = true
+ flash[:notice] = {
+ partial: 'alaveteli_pro/subscriptions/signup_message'
+ }
+ flash[:new_pro_user] = true
- json_redirect_to alaveteli_pro_dashboard_path
+ json_redirect_to alaveteli_pro_dashboard_path
- else
- head :ok
- end
+ else
+ head :ok
+ end
- rescue Stripe::RateLimitError,
- Stripe::InvalidRequestError,
- Stripe::AuthenticationError,
- Stripe::APIConnectionError,
- Stripe::StripeError => e
- if send_exception_notifications?
- ExceptionNotifier.notify_exception(e, env: request.env)
- end
+ rescue Stripe::RateLimitError,
+ Stripe::InvalidRequestError,
+ Stripe::AuthenticationError,
+ Stripe::APIConnectionError,
+ Stripe::StripeError => e
+ if send_exception_notifications?
+ ExceptionNotifier.notify_exception(e, env: request.env)
+ end
- flash[:error] = _('There was a problem submitting your payment. You ' \
- 'have not been charged. Please try again later.')
+ flash[:error] = _('There was a problem submitting your payment. You ' \
+ 'have not been charged. Please try again later.')
- json_redirect_to plan_path('pro')
- end
+ json_redirect_to plan_path('pro')
end
def destroy
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 674952c1a2..24f422e993 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -456,11 +456,9 @@ def country_from_ip
end
def user_ip
- begin
- request.remote_ip
- rescue ActionDispatch::RemoteIp::IpSpoofAttackError
- nil
- end
+ request.remote_ip
+ rescue ActionDispatch::RemoteIp::IpSpoofAttackError
+ nil
end
# URL Encode the path parameter for use in render_exception
diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb
index 0e42ce3ea5..a3704e9b6c 100644
--- a/app/models/censor_rule.rb
+++ b/app/models/censor_rule.rb
@@ -109,11 +109,9 @@ def single_char_regexp
end
def require_valid_regexp
- begin
- make_regexp('UTF-8')
- rescue RegexpError => e
- errors.add(:text, e.message)
- end
+ make_regexp('UTF-8')
+ rescue RegexpError => e
+ errors.add(:text, e.message)
end
def to_replace(encoding)
diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb
index f566427781..782c949d01 100644
--- a/app/models/holiday_import.rb
+++ b/app/models/holiday_import.rb
@@ -66,24 +66,22 @@ def all_holidays_valid
end
def populate_from_ical_feed
- begin
- cal_file = open(ical_feed_url)
- cal_parser = Icalendar::Parser.new(cal_file)
- cals = cal_parser.parse
- cal = cals.first
- unless cal
- errors.add(:ical_feed_url, "Sorry, there's a problem with the format of that feed.")
- return
- end
- cal.events.each { |cal_event| populate_from_ical_event(cal_event) }
- rescue Errno::ENOENT, Exception => e
- if e.message == 'Invalid line in calendar string!'
- errors.add(:ical_feed_url, "Sorry, there's a problem with the format of that feed.")
- elsif e.message =~ /^No such file or directory/
- errors.add(:ical_feed_url, "Sorry we couldn't find that feed.")
- else
- raise e
- end
+ cal_file = open(ical_feed_url)
+ cal_parser = Icalendar::Parser.new(cal_file)
+ cals = cal_parser.parse
+ cal = cals.first
+ unless cal
+ errors.add(:ical_feed_url, "Sorry, there's a problem with the format of that feed.")
+ return
+ end
+ cal.events.each { |cal_event| populate_from_ical_event(cal_event) }
+ rescue Errno::ENOENT, Exception => e
+ if e.message == 'Invalid line in calendar string!'
+ errors.add(:ical_feed_url, "Sorry, there's a problem with the format of that feed.")
+ elsif e.message =~ /^No such file or directory/
+ errors.add(:ical_feed_url, "Sorry we couldn't find that feed.")
+ else
+ raise e
end
end
@@ -95,14 +93,12 @@ def populate_from_ical_event(cal_event)
end
def populate_from_suggestions
- begin
- holiday_info = Holidays.between(start_date, end_date, @country_code.to_sym, :observed)
- holiday_info.each do |holiday_info_hash|
- holidays << Holiday.new(description: holiday_info_hash[:name],
- day: holiday_info_hash[:date])
- end
- rescue Holidays::InvalidRegion
- []
+ holiday_info = Holidays.between(start_date, end_date, @country_code.to_sym, :observed)
+ holiday_info.each do |holiday_info_hash|
+ holidays << Holiday.new(description: holiday_info_hash[:name],
+ day: holiday_info_hash[:date])
end
+ rescue Holidays::InvalidRegion
+ []
end
end
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 2caf2e100b..57e37d0c98 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1852,12 +1852,10 @@ def index_of_last_described_event
end
def set_defaults
- begin
- self.described_state = 'waiting_response' if described_state.nil?
- rescue ActiveModel::MissingAttributeError
- # this should only happen on Model.exists? call. It can be safely ignored.
- # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/
- end
+ self.described_state = 'waiting_response' if described_state.nil?
+ rescue ActiveModel::MissingAttributeError
+ # this should only happen on Model.exists? call. It can be safely ignored.
+ # See http://www.tatvartha.com/2011/03/activerecordmissingattributeerror-missing-attribute-a-bug-or-a-features/
end
def set_law_used
diff --git a/app/models/legislation/reference_collection.rb b/app/models/legislation/reference_collection.rb
index 32644c34c0..d1a1ab79ac 100644
--- a/app/models/legislation/reference_collection.rb
+++ b/app/models/legislation/reference_collection.rb
@@ -30,13 +30,11 @@ def match(text)
type = capture[0]
parse_matches(capture[1]).each do |reference|
- begin
- references << Legislation::Reference.new(
- legislation: legislation, reference: "#{type} #{reference}"
- )
- rescue Legislation::InvalidReferenceType
- # noop
- end
+ references << Legislation::Reference.new(
+ legislation: legislation, reference: "#{type} #{reference}"
+ )
+ rescue Legislation::InvalidReferenceType
+ # noop
end
references
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index 9cc35e3109..f8854e6018 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -232,30 +232,28 @@ def line(opts = {})
end
def delivery_status
- begin
- unless attributes['delivery_status'].present?
- # attempt to parse the status from the log line and store if successful
- set_delivery_status
- end
-
- DeliveryStatusSerializer.load(read_attribute(:delivery_status))
- # TODO: This rescue can be removed when there are no more cached
- # MTA-specific statuses
- rescue ArgumentError
- warn %q(MailServerLog#delivery_status rescuing from invalid delivery
- status. Run bundle exec rake temp:cache_delivery_status to update
- cached values. This error handling will be removed soon.).
- squish unless Rails.env.test?
-
- # re-try setting the delivery status, forcing the write by avoiding the
- # Rails 4.2 call to old_attribute_value hidden inside write_attribute as
- # that will re-raise the 'Invalid delivery status' ArgumentError we're
- # attempting to rescue
- # https://apidock.com/rails/v4.2.7/ActiveRecord/AttributeMethods/Dirty/write_attribute
- set_delivery_status(true)
- save!
- DeliveryStatusSerializer.load(read_attribute(:delivery_status))
+ unless attributes['delivery_status'].present?
+ # attempt to parse the status from the log line and store if successful
+ set_delivery_status
end
+
+ DeliveryStatusSerializer.load(read_attribute(:delivery_status))
+ # TODO: This rescue can be removed when there are no more cached
+ # MTA-specific statuses
+ rescue ArgumentError
+ warn %q(MailServerLog#delivery_status rescuing from invalid delivery
+ status. Run bundle exec rake temp:cache_delivery_status to update
+ cached values. This error handling will be removed soon.).
+ squish unless Rails.env.test?
+
+ # re-try setting the delivery status, forcing the write by avoiding the
+ # Rails 4.2 call to old_attribute_value hidden inside write_attribute as
+ # that will re-raise the 'Invalid delivery status' ArgumentError we're
+ # attempting to rescue
+ # https://apidock.com/rails/v4.2.7/ActiveRecord/AttributeMethods/Dirty/write_attribute
+ set_delivery_status(true)
+ save!
+ DeliveryStatusSerializer.load(read_attribute(:delivery_status))
end
private
diff --git a/gems/alaveteli_features/lib/alaveteli_features.rb b/gems/alaveteli_features/lib/alaveteli_features.rb
index 1f634aa94b..66860937bb 100644
--- a/gems/alaveteli_features/lib/alaveteli_features.rb
+++ b/gems/alaveteli_features/lib/alaveteli_features.rb
@@ -43,11 +43,9 @@ def self.backend=(backend)
# We just want to know if our tables exist, but we can't do that without
# risking an error
def self.tables_exist?
- begin
- ActiveRecord::Base.establish_connection
- ActiveRecord::Base.connection.data_source_exists?(:flipper_features)
- rescue
- false
- end
+ ActiveRecord::Base.establish_connection
+ ActiveRecord::Base.connection.data_source_exists?(:flipper_features)
+ rescue
+ false
end
end
diff --git a/lib/alaveteli_pro/metrics_report.rb b/lib/alaveteli_pro/metrics_report.rb
index 40546dd5d5..77c755a6af 100644
--- a/lib/alaveteli_pro/metrics_report.rb
+++ b/lib/alaveteli_pro/metrics_report.rb
@@ -120,20 +120,18 @@ def new_stripe_users
count = 0
sub_ids = []
stripe_plans.each do |plan_id|
- begin
- Stripe::Subscription.list(
- 'created[gte]': report_start.to_i,
- 'created[lte]': report_end.to_i,
- plan: plan_id
- ).auto_paging_each do |item|
- if item.plan.id == plan_id
- count += 1
- sub_ids << item.id
- end
+ Stripe::Subscription.list(
+ 'created[gte]': report_start.to_i,
+ 'created[lte]': report_end.to_i,
+ plan: plan_id
+ ).auto_paging_each do |item|
+ if item.plan.id == plan_id
+ count += 1
+ sub_ids << item.id
end
- rescue Stripe::InvalidRequestError
- # tried to fetch a plan that's not set up
end
+ rescue Stripe::InvalidRequestError
+ # tried to fetch a plan that's not set up
end
{ new_and_returning_users: { count: count, subs: sub_ids } }
end
diff --git a/lib/normalize_string.rb b/lib/normalize_string.rb
index 48530f0e4a..a1e42ddda7 100644
--- a/lib/normalize_string.rb
+++ b/lib/normalize_string.rb
@@ -76,13 +76,11 @@ def convert_string_to_utf8_or_binary(s, suggested_character_encoding=nil)
end
def convert_string_to_utf8(s, suggested_character_encoding=nil)
- begin
- result = normalize_string_to_utf8 s, suggested_character_encoding
- StringConversionResult.new(result, false)
- rescue EncodingNormalizationError
- result = scrub(s)
- StringConversionResult.new(result, true)
- end
+ result = normalize_string_to_utf8 s, suggested_character_encoding
+ StringConversionResult.new(result, false)
+rescue EncodingNormalizationError
+ result = scrub(s)
+ StringConversionResult.new(result, true)
end
def scrub(string)
diff --git a/lib/tasks/geoip.rake b/lib/tasks/geoip.rake
index 42fda379c8..dade426ee2 100644
--- a/lib/tasks/geoip.rake
+++ b/lib/tasks/geoip.rake
@@ -38,22 +38,20 @@ namespace :geoip do
downloaded_location = File.join(tmp_dir, 'geodata.tar.gz')
File.open(downloaded_location, "wb") do |saved_file|
- begin
- URI.open(link, "rb") do |read_file|
- saved_file.write(read_file.read)
- end
-
- rescue OpenURI::HTTPError => ex
- log 'Error downloading MaxMind geoip data file'
- log " #{ex.message}"
+ URI.open(link, "rb") do |read_file|
+ saved_file.write(read_file.read)
+ end
- if ex.message == '401 Unauthorized'
- log 'Please check the MAXMIND_LICENSE_KEY setting in ' \
- 'config/general.yml'
- end
+ rescue OpenURI::HTTPError => ex
+ log 'Error downloading MaxMind geoip data file'
+ log " #{ex.message}"
- exit
+ if ex.message == '401 Unauthorized'
+ log 'Please check the MAXMIND_LICENSE_KEY setting in ' \
+ 'config/general.yml'
end
+
+ exit
end
`tar -xzf #{downloaded_location} -C #{tmp_dir}`
From 1e145721478c29d24d99584fd7478a6af21e553a Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Mon, 27 Feb 2023 16:51:43 +0000
Subject: [PATCH 225/289] Disable NumericLiterals cop
---
.ruby-style.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 9277f8c0ac..83122370ba 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -1882,7 +1882,7 @@ Style/NumericLiteralPrefix:
Enabled: true
Style/NumericLiterals:
- Enabled: true
+ Enabled: false
Style/NumericPredicate:
Enabled: false
From 2980fb575aeffc767def739d41f0a7712ecbe9ad Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 20 Mar 2023 05:00:31 +0000
Subject: [PATCH 226/289] Build(deps): Bump rails from 7.0.4.2 to 7.0.4.3
Bumps [rails](https://github.com/rails/rails) from 7.0.4.2 to 7.0.4.3.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v7.0.4.2...v7.0.4.3)
---
updated-dependencies:
- dependency-name: rails
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 114 +++++++++++++++++++++++++--------------------------
1 file changed, 57 insertions(+), 57 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 6dd3671a86..5f1ace3395 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -45,47 +45,47 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- actioncable (7.0.4.2)
- actionpack (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ actioncable (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (7.0.4.2)
- actionpack (= 7.0.4.2)
- activejob (= 7.0.4.2)
- activerecord (= 7.0.4.2)
- activestorage (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ actionmailbox (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ activejob (= 7.0.4.3)
+ activerecord (= 7.0.4.3)
+ activestorage (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
- actionmailer (7.0.4.2)
- actionpack (= 7.0.4.2)
- actionview (= 7.0.4.2)
- activejob (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ actionmailer (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ actionview (= 7.0.4.3)
+ activejob (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
- actionpack (7.0.4.2)
- actionview (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ actionpack (7.0.4.3)
+ actionview (= 7.0.4.3)
+ activesupport (= 7.0.4.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 (7.0.4.2)
- actionpack (= 7.0.4.2)
- activerecord (= 7.0.4.2)
- activestorage (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ actiontext (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ activerecord (= 7.0.4.3)
+ activestorage (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (7.0.4.2)
- activesupport (= 7.0.4.2)
+ actionview (7.0.4.3)
+ activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@@ -93,22 +93,22 @@ GEM
active_model_otp (2.3.1)
activemodel
rotp (~> 6.2.0)
- activejob (7.0.4.2)
- activesupport (= 7.0.4.2)
+ activejob (7.0.4.3)
+ activesupport (= 7.0.4.3)
globalid (>= 0.3.6)
- activemodel (7.0.4.2)
- activesupport (= 7.0.4.2)
- activerecord (7.0.4.2)
- activemodel (= 7.0.4.2)
- activesupport (= 7.0.4.2)
- activestorage (7.0.4.2)
- actionpack (= 7.0.4.2)
- activejob (= 7.0.4.2)
- activerecord (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ activemodel (7.0.4.3)
+ activesupport (= 7.0.4.3)
+ activerecord (7.0.4.3)
+ activemodel (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
+ activestorage (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ activejob (= 7.0.4.3)
+ activerecord (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
- activesupport (7.0.4.2)
+ activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -310,7 +310,7 @@ GEM
mini_portile2 (2.8.1)
mini_racer (0.6.3)
libv8-node (~> 16.10.0.0)
- minitest (5.17.0)
+ minitest (5.18.0)
money (6.16.0)
i18n (>= 0.6.4, <= 2)
multi_json (1.15.0)
@@ -361,24 +361,24 @@ GEM
public_suffix (5.0.1)
racc (1.6.2)
rack (2.2.6.2)
- rack-test (2.0.2)
+ rack-test (2.1.0)
rack (>= 1.3)
rack-utf8_sanitizer (1.8.0)
rack (>= 1.0, < 4.0)
- rails (7.0.4.2)
- actioncable (= 7.0.4.2)
- actionmailbox (= 7.0.4.2)
- actionmailer (= 7.0.4.2)
- actionpack (= 7.0.4.2)
- actiontext (= 7.0.4.2)
- actionview (= 7.0.4.2)
- activejob (= 7.0.4.2)
- activemodel (= 7.0.4.2)
- activerecord (= 7.0.4.2)
- activestorage (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ rails (7.0.4.3)
+ actioncable (= 7.0.4.3)
+ actionmailbox (= 7.0.4.3)
+ actionmailer (= 7.0.4.3)
+ actionpack (= 7.0.4.3)
+ actiontext (= 7.0.4.3)
+ actionview (= 7.0.4.3)
+ activejob (= 7.0.4.3)
+ activemodel (= 7.0.4.3)
+ activerecord (= 7.0.4.3)
+ activestorage (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
bundler (>= 1.15.0)
- railties (= 7.0.4.2)
+ railties (= 7.0.4.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -391,9 +391,9 @@ GEM
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
- railties (7.0.4.2)
- actionpack (= 7.0.4.2)
- activesupport (= 7.0.4.2)
+ railties (7.0.4.3)
+ actionpack (= 7.0.4.3)
+ activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
@@ -506,7 +506,7 @@ GEM
rack (>= 1, < 3)
thor (1.2.1)
tilt (2.0.10)
- timeout (0.3.1)
+ timeout (0.3.2)
trailblazer-option (0.1.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
@@ -537,7 +537,7 @@ GEM
rexml
xpath (3.2.0)
nokogiri (~> 1.8)
- zeitwerk (2.6.6)
+ zeitwerk (2.6.7)
zip_tricks (5.6.0)
PLATFORMS
From c9ee7036aa87c254a48d98e47ebebeeecf7b738d Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 20 Mar 2023 05:04:50 +0000
Subject: [PATCH 227/289] Build(deps-dev): Bump rubocop from 1.48.0 to 1.48.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.48.0 to 1.48.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.48.0...v1.48.1)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Gemfile b/Gemfile
index 657a313781..8f890af555 100644
--- a/Gemfile
+++ b/Gemfile
@@ -190,7 +190,7 @@ group :development do
gem 'launchy', '< 2.6.0'
gem 'listen', '>= 3.0.5', '< 3.8.1'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.48.0', require: false
+ gem 'rubocop', '~> 1.48.1', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 6dd3671a86..2e5ffaf562 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -349,7 +349,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.2.1.0)
+ parser (3.2.1.1)
ast (~> 2.4.1)
pg (1.4.5)
prime (0.1.2)
@@ -441,7 +441,7 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.48.0)
+ rubocop (1.48.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@@ -610,7 +610,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.48.0)
+ rubocop (~> 1.48.1)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From f94e3393ac8f593752658cef5aeec90480887741 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 17 Mar 2023 17:06:01 +0000
Subject: [PATCH 228/289] Add check before removing old params_yaml column
Check for content in InfoRequestEvent#params_yaml column.
If a re-user skips 0.42.0.0 upgrade notes then they could lose data. Add
a check to ensure we prevent this.
---
...9_remove_info_request_event_params_yaml.rb | 21 +++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb b/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb
index 8793b2115f..765b34aca2 100644
--- a/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb
+++ b/db/migrate/20230127132719_remove_info_request_event_params_yaml.rb
@@ -1,5 +1,22 @@
class RemoveInfoRequestEventParamsYaml < ActiveRecord::Migration[7.0]
- def change
- remove_column :info_request_events, :params_yaml, :text
+ def up
+ if InfoRequestEvent.where(params: nil).any?
+ raise <<~TXT
+ We can't run the RemoveInfoRequestEventParamsYaml database migration.
+
+ We have dectected InfoRequestEvent objects which haven't been migrated
+ to the new JSONB params column.
+
+ Please deploy Alaveteli 0.42.0.0 and run the upgrade tasks:
+ https://github.com/mysociety/alaveteli/blob/0.42.0.0/doc/CHANGES.md#upgrade-notes
+
+ TXT
+ end
+
+ remove_column :info_request_events, :params_yaml
+ end
+
+ def down
+ add_column :info_request_events, :params_yaml, :text
end
end
From 031bdcdf8dedbc42587ef4fe6600369f52c0a767 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 17 Mar 2023 19:01:30 +0000
Subject: [PATCH 229/289] Add check before removing old notes column
Check for content in PublicBody::Translation#notes column.
If a re-user skips 0.42.0.0 upgrade notes then they could lose data. Add
a check to ensure we prevent this.
---
...20220902112339_remove_public_body_notes.rb | 27 ++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/db/migrate/20220902112339_remove_public_body_notes.rb b/db/migrate/20220902112339_remove_public_body_notes.rb
index 90491f35c0..09d3f72b04 100644
--- a/db/migrate/20220902112339_remove_public_body_notes.rb
+++ b/db/migrate/20220902112339_remove_public_body_notes.rb
@@ -1,13 +1,22 @@
class RemovePublicBodyNotes < ActiveRecord::Migration[6.1]
- def change
- reversible do |dir|
- dir.up do
- remove_column :public_body_translations, :notes
- end
-
- dir.down do
- PublicBody.add_translation_fields! notes: :text
- end
+ def up
+ if PublicBody::Translation.where.not(notes: nil).any?
+ raise <<~TXT
+ We can't run the RemovePublicBodyNotes database migration.
+
+ We have dectected PublicBody::Translation objects which haven't been
+ migrated to the new Note model.
+
+ Please deploy Alaveteli 0.42.0.0 and run the upgrade tasks:
+ https://github.com/mysociety/alaveteli/blob/0.42.0.0/doc/CHANGES.md#upgrade-notes
+
+ TXT
end
+
+ remove_column :public_body_translations, :notes
+ end
+
+ def down
+ PublicBody.add_translation_fields! notes: :text
end
end
From 6566933b9166b09db9fae620e23303819092f15d Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 14 Mar 2023 12:04:36 +0000
Subject: [PATCH 230/289] Rename blog items to posts
---
app/models/blog.rb | 2 +-
app/views/general/blog.html.erb | 26 ++++++++++++------------
spec/models/blog_spec.rb | 8 ++++----
spec/views/general/blog.html.erb_spec.rb | 8 ++++----
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/app/models/blog.rb b/app/models/blog.rb
index 66869228f9..90b68fced5 100644
--- a/app/models/blog.rb
+++ b/app/models/blog.rb
@@ -13,7 +13,7 @@ def self.enabled?
AlaveteliConfiguration.blog_feed.present?
end
- def items
+ def posts
return [] if content.empty?
data = XmlSimple.xml_in(content)
diff --git a/app/views/general/blog.html.erb b/app/views/general/blog.html.erb
index 8c24cbdbea..e86cb25e02 100644
--- a/app/views/general/blog.html.erb
+++ b/app/views/general/blog.html.erb
@@ -4,18 +4,18 @@
<%=@title %>
- <% @blog.items.each do |item| %>
+ <% @blog.posts.each do |post| %>
- <% date = Time.zone.parse(item['pubDate'][0]) %>
+ <% date = Time.zone.parse(post['pubDate'][0]) %>
<% end %>
diff --git a/spec/controllers/admin/blog_posts_controller_spec.rb b/spec/controllers/admin/blog_posts_controller_spec.rb
index ff1c035575..d02aabd3f9 100644
--- a/spec/controllers/admin/blog_posts_controller_spec.rb
+++ b/spec/controllers/admin/blog_posts_controller_spec.rb
@@ -70,6 +70,7 @@
describe 'PATCH #update' do
let(:blog_post) { FactoryBot.build(:blog_post, id: 1) }
+ let(:params) { { tag_string: 'foo' } }
before do
allow(Blog::Post).to receive(:find).and_return(blog_post)
@@ -81,17 +82,17 @@
end
it 'assigns the blog post' do
- patch :update, params: { id: blog_post.id }
+ patch :update, params: { id: blog_post.id, blog_post: params }
expect(assigns[:blog_post]).to eq(blog_post)
end
it 'sets a notice' do
- patch :update, params: { id: blog_post.id }
+ patch :update, params: { id: blog_post.id, blog_post: params }
expect(flash[:notice]).to eq('Blog Post successfully updated.')
end
it 'redirects to the blog posts admin' do
- patch :update, params: { id: blog_post.id }
+ patch :update, params: { id: blog_post.id, blog_post: params }
expect(response).to redirect_to(admin_blog_posts_path)
end
end
@@ -102,12 +103,12 @@
end
it 'assigns the blog post' do
- patch :update, params: { id: blog_post.id }
+ patch :update, params: { id: blog_post.id, blog_post: params }
expect(assigns[:blog_post]).to eq(blog_post)
end
it 'renders the form again' do
- patch :update, params: { id: blog_post.id }
+ patch :update, params: { id: blog_post.id, blog_post: params }
expect(response).to render_template(:edit)
end
end
diff --git a/spec/models/blog/post_spec.rb b/spec/models/blog/post_spec.rb
index efe539ff07..0f03a3db2b 100644
--- a/spec/models/blog/post_spec.rb
+++ b/spec/models/blog/post_spec.rb
@@ -11,8 +11,11 @@
# updated_at :datetime not null
#
require 'spec_helper'
+require 'models/concerns/taggable'
RSpec.describe Blog::Post, type: :model do
+ it_behaves_like 'concerns/taggable', :blog_post
+
let(:post) { FactoryBot.build(:blog_post) }
describe 'validations' do
From f6827e1e9ebb401a80782a53bad7bb5e566d4f05 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 23 Mar 2023 10:15:45 +0000
Subject: [PATCH 239/289] Fix blog post ordering
The blog page should have the latest post at the top, this is the same
order as the external feed.
This was changed in #7642 to ensure the `Blog::Post#id` incremented
correctly so posts could be sorted in SQL queries without extracting the
published date.
---
app/models/blog.rb | 2 +-
spec/fixtures/files/blog_feed.atom | 17 +++++++++++++++++
spec/models/blog_spec.rb | 7 ++++++-
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/app/models/blog.rb b/app/models/blog.rb
index feb3b41ded..6148ab0fc0 100644
--- a/app/models/blog.rb
+++ b/app/models/blog.rb
@@ -25,7 +25,7 @@ def posts
Blog::Post.find_or_initialize_by(url: data['link'][0]).tap do |post|
post.update(title: data['title'][0], data: data)
end
- end
+ end.reverse
end
def feeds
diff --git a/spec/fixtures/files/blog_feed.atom b/spec/fixtures/files/blog_feed.atom
index a831243b4c..ea47477e7b 100644
--- a/spec/fixtures/files/blog_feed.atom
+++ b/spec/fixtures/files/blog_feed.atom
@@ -33,6 +33,23 @@
]]>
http://www.example.com/feed/2
+
+
+
+ Other Post
+ http://www.example.com/other-post
+ http://www.example.com/other-post#comments
+ Mon, 01 Mar 2013 12:00:00 +0000
+ Example Blogger
+
+
+ http://www.example.com/?id=332
+
+ A blog post
+
Another example post
+]]>
+ http://www.example.com/feed/
+ 0
diff --git a/spec/models/blog_spec.rb b/spec/models/blog_spec.rb
index 6407fe21b6..6df1fb241e 100644
--- a/spec/models/blog_spec.rb
+++ b/spec/models/blog_spec.rb
@@ -36,7 +36,7 @@
end
it 'parses an item from an example feed' do
- expect(posts.count).to eq(1)
+ expect(posts.count).to eq(2)
end
it 'returns Blog::Post objects' do
@@ -70,6 +70,11 @@
from('My fancy blog post').
to('Example Post')
end
+
+ it 'returns BLog::Post in the same order as the feed' do
+ expect(posts.first.title).to eq('Example Post')
+ expect(posts.second.title).to eq('Other Post')
+ end
end
context 'when feed returns an error' do
From 6ac2552c9d6854204bf2984dc8a697c06c35d44e Mon Sep 17 00:00:00 2001
From: Miroslav
Date: Thu, 9 Mar 2023 23:16:07 +0100
Subject: [PATCH 240/289] Adding localisation to resent notice
---
.../_resent_outgoing_correspondence.html.erb | 21 +++++++++++++------
.../_resent_outgoing_correspondence.text.erb | 19 ++++++++++++++++-
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/app/views/request/_resent_outgoing_correspondence.html.erb b/app/views/request/_resent_outgoing_correspondence.html.erb
index 00ccd5f5df..2410819f67 100644
--- a/app/views/request/_resent_outgoing_correspondence.html.erb
+++ b/app/views/request/_resent_outgoing_correspondence.html.erb
@@ -4,14 +4,23 @@
- Sent
- <% if outgoing_message.message_type == 'initial_request' %>
- request
- <% elsif outgoing_message.message_type == 'followup' %>
- a follow up
+ <% case [outgoing_message.message_type, info_request_event.same_email_as_previous_send?] %>
+ <% in ['initial_request', true] %>
+ <%= _('Sent request to {{public_body_link}} again.',
+ public_body_link: public_body_link(@info_request.public_body)) %>
+ <% in ['initial_request', false] %>
+ <%= _('Sent request to {{public_body_link}} again, using a new contact ' \
+ 'address.',
+ public_body_link: public_body_link(@info_request.public_body)) %>
+ <% in ['followup', true] %>
+ <%= _('Sent a follow up to {{public_body_link}} again.',
+ public_body_link: public_body_link(@info_request.public_body)) %>
+ <% in ['followup', false] %>
+ <%= _('Sent a follow up to {{public_body_link}} again, using a new ' \
+ 'contact address.',
+ public_body_link: public_body_link(@info_request.public_body)) %>
<% else %>
<% raise "unknown message_type" %>
<% end %>
- to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.
diff --git a/app/views/request/_resent_outgoing_correspondence.text.erb b/app/views/request/_resent_outgoing_correspondence.text.erb
index d39f8395b2..d226fab559 100644
--- a/app/views/request/_resent_outgoing_correspondence.text.erb
+++ b/app/views/request/_resent_outgoing_correspondence.text.erb
@@ -1,2 +1,19 @@
<%= _('Date:') %> <%= simple_date(info_request_event.created_at, :format => :text) %>
-Sent <% if outgoing_message.message_type == 'initial_request' %> request <% elsif outgoing_message.message_type == 'followup' %> a follow up <% else %> <% raise "unknown message_type" %><% end %> to <%= public_body_link(@info_request.public_body) %> again<% if not info_request_event.same_email_as_previous_send? %>, using a new contact address<% end %>.
+<% case [outgoing_message.message_type, info_request_event.same_email_as_previous_send?] %>
+<% in ['initial_request', true] %>
+<%= _('Sent request to {{public_body_name}} again.',
+ public_body_name: @info_request.public_body.name) %>
+<% in ['initial_request', false] %>
+<%= _('Sent request to {{public_body_name}} again, using a new contact ' \
+ 'address.',
+ public_body_name: @info_request.public_body.name) %>
+<% in ['followup', true] %>
+<%= _('Sent a follow up to {{public_body_name}} again.',
+ public_body_name: @info_request.public_body.name) %>
+<% in ['followup', false] %>
+<%= _('Sent a follow up to {{public_body_name}} again, using a new contact ' \
+ 'address.',
+ public_body_name: @info_request.public_body.name) %>
+<% else %>
+<% raise "unknown message_type" %>
+<% end %>
From 191de38dedbc814d2ab3d07234f6da3b222b492e Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Tue, 21 Mar 2023 09:10:32 +0000
Subject: [PATCH 241/289] Reduce prominence of defunct bodies in lists
The small "Defunct" label at the bottom of the authority listing is
easily missable. This adds all tags as CSS classes to hook off, and
applies styling to the case where an authority is defunct to make it
clearer that it's "gone".
Not a "fix", but mitigates:
* https://github.com/mysociety/alaveteli/issues/721
* https://github.com/mysociety/alaveteli/issues/7107
* https://github.com/mysociety/alaveteli/issues/7651
---
.../stylesheets/responsive/_lists_style.scss | 8 ++++++
app/helpers/taggable_helper.rb | 7 +++++
.../public_body/_body_listing_single.html.erb | 2 +-
doc/CHANGES.md | 1 +
spec/helpers/taggable_helper_spec.rb | 26 +++++++++++++++++++
5 files changed, 43 insertions(+), 1 deletion(-)
create mode 100644 app/helpers/taggable_helper.rb
create mode 100644 spec/helpers/taggable_helper_spec.rb
diff --git a/app/assets/stylesheets/responsive/_lists_style.scss b/app/assets/stylesheets/responsive/_lists_style.scss
index 0e59a74eb6..1ca93ae848 100644
--- a/app/assets/stylesheets/responsive/_lists_style.scss
+++ b/app/assets/stylesheets/responsive/_lists_style.scss
@@ -15,6 +15,14 @@
}
}
+.body_listing.tag--defunct {
+ color: grey;
+
+ a {
+ color: grey;
+ }
+}
+
.request_listing{
.bottomline {
background-position:top left;
diff --git a/app/helpers/taggable_helper.rb b/app/helpers/taggable_helper.rb
new file mode 100644
index 0000000000..3ab8a75a63
--- /dev/null
+++ b/app/helpers/taggable_helper.rb
@@ -0,0 +1,7 @@
+# Helpers for Taggable records
+module TaggableHelper
+ # Generate CSS classes for each tag of a given Taggable
+ def tags_css(taggable)
+ taggable.tags.map { |tag| "tag--#{tag.name}" }.join(' ')
+ end
+end
diff --git a/app/views/public_body/_body_listing_single.html.erb b/app/views/public_body/_body_listing_single.html.erb
index 35208b9b81..48610a8931 100644
--- a/app/views/public_body/_body_listing_single.html.erb
+++ b/app/views/public_body/_body_listing_single.html.erb
@@ -6,7 +6,7 @@
request_link = false unless defined?(request_link)
%>
-
<%=state%>
From b06a4b7cdfb1b946ea75e7a37571f0878c2b7f0b Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 7 Dec 2022 10:19:12 +0000
Subject: [PATCH 251/289] Tidy InfoRequestEvent acts_as_xapian configuration
* Quote Style
* Line Length
* Array padding
Also move `if` key to the end as it reads better to say "do all this
config, _if_ the event is `indexed_by_search?`"
---
app/models/info_request_event.rb | 57 ++++++++++++++++++++------------
1 file changed, 35 insertions(+), 22 deletions(-)
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 9fffd50cd7..576c22c482 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -110,28 +110,41 @@ def must_be_valid_state
attr_accessor :no_xapian_reindex
# Full text search indexing
- acts_as_xapian texts: [ :search_text_main, :title ],
- values: [
- [ :created_at, 0, "range_search", :date ], # for QueryParser range searches e.g. 01/01/2008..14/01/2008
- [ :created_at_numeric, 1, "created_at", :number ], # for sorting
- [ :described_at_numeric, 2, "described_at", :number ], # TODO: using :number for lack of :datetime support in Xapian values
- [ :request, 3, "request_collapse", :string ],
- [ :request_title_collapse, 4, "request_title_collapse", :string ]
- ],
- terms: [ [ :calculated_state, 'S', "status" ],
- [ :requested_by, 'B', "requested_by" ],
- [ :requested_from, 'F', "requested_from" ],
- [ :commented_by, 'C', "commented_by" ],
- [ :request, 'R', "request" ],
- [ :variety, 'V', "variety" ],
- [ :latest_variety, 'K', "latest_variety" ],
- [ :latest_status, 'L', "latest_status" ],
- [ :waiting_classification, 'W', "waiting_classification" ],
- [ :filetype, 'T', "filetype" ],
- [ :tags, 'U', "tag" ],
- [ :request_public_body_tags, 'X', "request_public_body_tag" ] ],
- if: :indexed_by_search?,
- eager_load: [ :outgoing_message, :comment, { info_request: [ :user, :public_body, :censor_rules ] } ]
+ acts_as_xapian \
+ texts: [
+ :search_text_main,
+ :title
+ ],
+ values: [
+ # for QueryParser range searches e.g. 01/01/2008..14/01/2008:
+ [:created_at, 0, 'range_search', :date],
+ # for sorting:
+ [:created_at_numeric, 1, 'created_at', :number],
+ # TODO: using :number for lack of :datetime support in Xapian values:
+ [:described_at_numeric, 2, 'described_at', :number],
+ [:request, 3, 'request_collapse', :string],
+ [:request_title_collapse, 4, 'request_title_collapse', :string]
+ ],
+ terms: [
+ [:calculated_state, 'S', 'status'],
+ [:requested_by, 'B', 'requested_by'],
+ [:requested_from, 'F', 'requested_from'],
+ [:commented_by, 'C', 'commented_by'],
+ [:request, 'R', 'request'],
+ [:variety, 'V', 'variety'],
+ [:latest_variety, 'K', 'latest_variety'],
+ [:latest_status, 'L', 'latest_status'],
+ [:waiting_classification, 'W', 'waiting_classification'],
+ [:filetype, 'T', 'filetype'],
+ [:tags, 'U', 'tag'],
+ [:request_public_body_tags, 'X', 'request_public_body_tag']
+ ],
+ eager_load: [
+ :outgoing_message,
+ :comment,
+ { info_request: [:user, :public_body, :censor_rules] }
+ ],
+ if: :indexed_by_search?
def self.count_of_hides_by_week
where(event_type: "hide").group("date(date_trunc('week', created_at))").count.sort
From a98e90241838038f1cd993fe48c8e5abe8520490 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Wed, 7 Dec 2022 10:30:19 +0000
Subject: [PATCH 252/289] Privatise InfoRequestEvent methods
With the exception of `get_clipped_response_efficiently` and
`must_be_valid_state`, all the newly-private methods are only used as
helpers for the `acts_as_xapian` configuration, so can be made private
to reduce the public surface area of the object.
`get_clipped_response_efficiently` is only called in `search_text_main`,
which again is a helper for the `acts_as_xapian` configuration (though
is also called elsewhere to render search result snippets).
`must_be_valid_state` is only called via a `validate` call so there's no
need for it to be public.
`variety` is a slightly special case in that it's called on sibling
events via `#latest_variety`, so it's made `protected` instead of
`private`.
I thought it worth preserving the specs to ensure we're populating the
search index with correct data, though it does mean using `#send` to
call the methods. I imagine we can improve this down the line. It seems
more valuable to add clarity over internal vs external methods at this
point.
---
app/models/info_request_event.rb | 241 +++++------
spec/models/info_request_event_spec.rb | 528 +++++++++++++------------
2 files changed, 394 insertions(+), 375 deletions(-)
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 576c22c482..3226561ba7 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -101,12 +101,6 @@ class InfoRequestEvent < ApplicationRecord
scope "#{event_type}_events", -> { where(event_type: event_type) }
end
- def must_be_valid_state
- if described_state && !InfoRequest::State.all.include?(described_state)
- errors.add(:described_state, "is not a valid state")
- end
- end
-
attr_accessor :no_xapian_reindex
# Full text search indexing
@@ -150,51 +144,11 @@ def self.count_of_hides_by_week
where(event_type: "hide").group("date(date_trunc('week', created_at))").count.sort
end
- def requested_by
- info_request.user_name_slug
- end
-
- def requested_from
- # acts_as_xapian will detect translated fields via Globalize and add all the
- # available locales to the index. But 'requested_from' is not translated directly,
- # although it relies on a translated field in PublicBody. Hence, we need to
- # manually add all the localized values to the index (Xapian can handle a list
- # of values in a term, btw)
- info_request.public_body.translations.map(&:url_name)
- end
-
- def commented_by
- if event_type == 'comment'
- comment.user.url_name
- else
- ''
- end
- end
-
+ # TODO: Can possibly be made private
def request
info_request.url_title
end
- def latest_variety
- sibling_events(reverse: true).each do |event|
- return event.variety unless event.variety.blank?
- end
- end
-
- def latest_status
- sibling_events(reverse: true).each do |event|
- return event.calculated_state unless event.calculated_state.blank?
- end
- end
-
- def waiting_classification
- info_request.awaiting_description == true ? "yes" : "no"
- end
-
- def request_title_collapse
- info_request.url_title(collapse: true)
- end
-
def described_at
# For responses, people might have RSS feeds on searches for type of
# response (e.g. successful) in which case we want to date sort by
@@ -203,16 +157,6 @@ def described_at
last_described_at || created_at
end
- def described_at_numeric
- # format it here as no datetime support in Xapian's value ranges
- described_at.strftime("%Y%m%d%H%M%S")
- end
-
- def created_at_numeric
- # format it here as no datetime support in Xapian's value ranges
- created_at.strftime("%Y%m%d%H%M%S")
- end
-
def incoming_message_selective_columns(fields)
message = IncomingMessage.select("#{ fields }, incoming_messages.info_request_id").
joins('INNER JOIN info_request_events ON incoming_messages.id = incoming_message_id').
@@ -223,26 +167,6 @@ def incoming_message_selective_columns(fields)
message
end
- def get_clipped_response_efficiently
- # TODO: this ugly code is an attempt to not always load all the
- # columns for an incoming message, which can be *very* large
- # (due to all the cached text). We care particularly in this
- # case because it's called for every search result on a page
- # (to show the search snippet). Actually, we should review if we
- # need all this data to be cached in the database at all, and
- # then we won't need this horrid workaround.
- message = incoming_message_selective_columns("cached_attachment_text_clipped, cached_main_body_text_folded")
- clipped_body = message.cached_main_body_text_folded
- clipped_attachment = message.cached_attachment_text_clipped
- if clipped_body.nil? || clipped_attachment.nil?
- # we're going to have to load it anyway
- text = incoming_message.get_text_for_indexing_clipped
- else
- text = clipped_body.gsub("FOLDED_QUOTED_SECTION", " ").strip + "\n\n" + clipped_attachment
- end
- text + "\n\n"
- end
-
# clipped = true - means return shorter text. It is used for snippets fore
# performance reasons. Xapian will take the full text.
def search_text_main(clipped = false)
@@ -263,6 +187,7 @@ def search_text_main(clipped = false)
text
end
+ # TODO: Can possibly be made private
def title
if event_type == 'sent'
info_request.title
@@ -271,42 +196,12 @@ def title
end
end
- def filetype
- if event_type == 'response'
- unless incoming_message
- raise "event type is 'response' but no incoming message for event id #{id}"
- end
-
- incoming_message.get_present_file_extensions
- else
- ''
- end
- end
-
+ # TODO: Can possibly be made private
def tags
# this returns an array of strings, each gets indexed as separate term by acts_as_xapian
info_request.tag_array_for_search
end
- def request_public_body_tags
- info_request.public_body.tag_array_for_search
- end
-
- def indexed_by_search?
- if %w[sent followup_sent response comment].include?(event_type)
- return false unless info_request.indexed_by_search?
- if event_type == 'response' && !incoming_message.indexed_by_search?
- return false
- end
- if %w[sent followup_sent].include?(event_type) && !outgoing_message.indexed_by_search?
- return false
- end
- return false if event_type == 'comment' && !comment.visible
- return true
- end
- false
- end
-
def variety
event_type
end
@@ -457,13 +352,6 @@ def response?
event_type == 'response'
end
- def only_editing_prominence_to_hide?
- event_type == 'edit' &&
- params_diff[:new].keys == [:prominence] &&
- params_diff[:old][:prominence] == "normal" &&
- %w(hidden requester_only backpage).include?(params_diff[:new][:prominence])
- end
-
# This method updates the cached column of the InfoRequest that
# stores the last created_at date of relevant events
# when saving or destroying an InfoRequestEvent associated with the request
@@ -522,6 +410,12 @@ def set_calculated_state!(state)
end
end
+ protected
+
+ def variety
+ event_type
+ end
+
private
def previous_events(opts = {})
@@ -586,4 +480,121 @@ def params_for_jsonb(params)
memo
end
end
+
+ def only_editing_prominence_to_hide?
+ event_type == 'edit' &&
+ params_diff[:new].keys == [:prominence] &&
+ params_diff[:old][:prominence] == "normal" &&
+ %w(hidden requester_only backpage).include?(params_diff[:new][:prominence])
+ end
+
+ def get_clipped_response_efficiently
+ # TODO: this ugly code is an attempt to not always load all the
+ # columns for an incoming message, which can be *very* large
+ # (due to all the cached text). We care particularly in this
+ # case because it's called for every search result on a page
+ # (to show the search snippet). Actually, we should review if we
+ # need all this data to be cached in the database at all, and
+ # then we won't need this horrid workaround.
+ message = incoming_message_selective_columns("cached_attachment_text_clipped, cached_main_body_text_folded")
+ clipped_body = message.cached_main_body_text_folded
+ clipped_attachment = message.cached_attachment_text_clipped
+ if clipped_body.nil? || clipped_attachment.nil?
+ # we're going to have to load it anyway
+ text = incoming_message.get_text_for_indexing_clipped
+ else
+ text = clipped_body.gsub("FOLDED_QUOTED_SECTION", " ").strip + "\n\n" + clipped_attachment
+ end
+ text + "\n\n"
+ end
+
+ def must_be_valid_state
+ if described_state && !InfoRequest::State.all.include?(described_state)
+ errors.add(:described_state, "is not a valid state")
+ end
+ end
+
+ # INDEXING HELPERS
+
+ def indexed_by_search?
+ if %w[sent followup_sent response comment].include?(event_type)
+ return false unless info_request.indexed_by_search?
+ if event_type == 'response' && !incoming_message.indexed_by_search?
+ return false
+ end
+ if %w[sent followup_sent].include?(event_type) && !outgoing_message.indexed_by_search?
+ return false
+ end
+ return false if event_type == 'comment' && !comment.visible
+ return true
+ end
+ false
+ end
+
+ def requested_by
+ info_request.user_name_slug
+ end
+
+ def requested_from
+ # acts_as_xapian will detect translated fields via Globalize and add all the
+ # available locales to the index. But 'requested_from' is not translated directly,
+ # although it relies on a translated field in PublicBody. Hence, we need to
+ # manually add all the localized values to the index (Xapian can handle a list
+ # of values in a term, btw)
+ info_request.public_body.translations.map(&:url_name)
+ end
+
+ def commented_by
+ if event_type == 'comment'
+ comment.user.url_name
+ else
+ ''
+ end
+ end
+
+ def request_title_collapse
+ info_request.url_title(collapse: true)
+ end
+
+ def described_at_numeric
+ # format it here as no datetime support in Xapian's value ranges
+ described_at.strftime("%Y%m%d%H%M%S")
+ end
+
+ def created_at_numeric
+ # format it here as no datetime support in Xapian's value ranges
+ created_at.strftime("%Y%m%d%H%M%S")
+ end
+
+ def waiting_classification
+ info_request.awaiting_description == true ? "yes" : "no"
+ end
+
+ def latest_variety
+ sibling_events(reverse: true).each do |event|
+ return event.variety unless event.variety.blank?
+ end
+ end
+
+ def latest_status
+ sibling_events(reverse: true).each do |event|
+ return event.calculated_state unless event.calculated_state.blank?
+ end
+ end
+
+ def filetype
+ if event_type == 'response'
+ unless incoming_message
+ raise "event type is 'response' but no incoming message for event id #{id}"
+ end
+
+ incoming_message.get_present_file_extensions
+ else
+ ''
+ end
+ end
+
+ def request_public_body_tags
+ info_request.public_body.tag_array_for_search
+ end
end
diff --git a/spec/models/info_request_event_spec.rb b/spec/models/info_request_event_spec.rb
index aa91c48e32..94549ccacf 100644
--- a/spec/models/info_request_event_spec.rb
+++ b/spec/models/info_request_event_spec.rb
@@ -93,64 +93,6 @@
end
end
- describe 'when deciding if it is indexed by search' do
-
- it 'returns a falsey value for a comment that is not visible' do
- comment = FactoryBot.create(:hidden_comment)
- comment_event = FactoryBot.build(:comment_event, comment: comment)
- expect(comment_event.indexed_by_search?).to be_falsey
- end
-
- it 'returns a truthy value for a comment that is visible' do
- comment = FactoryBot.create(:comment)
- comment_event = FactoryBot.build(:comment_event, comment: comment)
- expect(comment_event.indexed_by_search?).to be_truthy
- end
-
- it 'returns a falsey value for an incoming message that is not indexed by search' do
- incoming_message = FactoryBot.create(:incoming_message, :hidden)
- response_event = FactoryBot.build(:response_event,
- incoming_message: incoming_message)
- expect(response_event.indexed_by_search?).to be_falsey
- end
-
- it 'returns a truthy value for an incoming message that is indexed by search' do
- incoming_message = FactoryBot.create(:incoming_message)
- response_event = FactoryBot.build(:response_event,
- incoming_message: incoming_message)
- expect(response_event.indexed_by_search?).to be_truthy
- end
-
- it 'returns a falsey value for an outgoing message that is not indexed by search' do
- outgoing_message = FactoryBot.create(:hidden_followup)
- followup_event = FactoryBot.build(:followup_sent_event,
- outgoing_message: outgoing_message)
- expect(followup_event.indexed_by_search?).to be_falsey
- end
-
- it 'returns a truthy value for an outgoing message that is indexed by search' do
- outgoing_message = FactoryBot.create(:new_information_followup)
- followup_event = FactoryBot.build(:followup_sent_event,
- outgoing_message: outgoing_message)
- expect(followup_event.indexed_by_search?).to be_truthy
- end
-
- it 'returns a falsey value for an overdue event' do
- overdue_event = FactoryBot.build(:overdue_event)
- expect(overdue_event.indexed_by_search?).to be_falsey
- end
-
- it 'returns a falsey value for a very overdue event' do
- very_overdue_event = FactoryBot.build(:very_overdue_event)
- expect(very_overdue_event.indexed_by_search?).to be_falsey
- end
-
- it 'returns a falsey value for an embargo expiry event' do
- expire_embargo_event = FactoryBot.build(:expire_embargo_event)
- expect(expire_embargo_event.indexed_by_search?).to be_falsey
- end
- end
-
describe '.count_of_hides_by_week' do
it 'counts hide events by week' do
FactoryBot.create(:hide_event, created_at: Time.utc(2016, 1, 24))
@@ -181,73 +123,6 @@
end
end
- describe '#requested_by' do
- it "should return the slug of the associated request's user" do
- ire = FactoryBot.create(:info_request_event)
- expect(ire.requested_by).to eq(ire.info_request.user_name_slug)
- end
- end
-
- describe '#requested_from' do
- it "should return an array of translated public body url_name values" do
- ire = FactoryBot.create(:info_request_event)
- public_body = ire.info_request.public_body
- expect(ire.requested_from).to eq([public_body.url_name])
- end
- end
-
- describe '#commented_by' do
- context 'if it is a comment event' do
- it "should return the commenter's url_name" do
- user = FactoryBot.create(:user)
- comment = FactoryBot.create(:comment, user: user)
- ire = FactoryBot.create(:info_request_event,
- event_type: 'comment',
- comment: comment)
- expect(ire.commented_by).to eq(user.url_name)
- end
- end
-
- context 'if it is not a comment event' do
- it 'should return a blank string' do
- ire = FactoryBot.create(:info_request_event)
- expect(ire.commented_by).to eq('')
- end
- end
- end
-
- describe '#variety' do
- it 'should be an alias for event_type' do
- ire = FactoryBot.create(:info_request_event)
- expect(ire.variety).to eq(ire.event_type)
- end
- end
-
- describe '#latest_variety' do
- it 'should return the variety for the most recent event of the related request' do
- ire = FactoryBot.create(:info_request_event)
- request = ire.info_request
- new_event = FactoryBot.create(:info_request_event,
- event_type: 'comment',
- info_request: request)
- request.reload
- expect(ire.latest_variety).to eq('comment')
- end
- end
-
- describe '#latest_status' do
- it 'should return the calculated_state of the most recent event of the related request' do
- ire = FactoryBot.create(:info_request_event)
- request = ire.info_request
- new_event = FactoryBot.create(:info_request_event,
- event_type: 'comment',
- info_request: request)
- new_event.set_calculated_state!('internal_review')
- request.reload
- expect(ire.latest_status).to eq('internal_review')
- end
- end
-
describe '#title' do
context 'a sent event' do
it 'should return the related info_request title' do
@@ -268,38 +143,6 @@
end
end
- describe '#filetype' do
- context 'a response event' do
- let(:ire) { ire = FactoryBot.create(:response_event) }
-
- it 'should raise an error if there is not incoming_message' do
- ire.incoming_message = nil
- expect { ire.filetype }.to raise_error.
- with_message(/event type is 'response' but no incoming message for event/)
- end
-
- it 'should return a blank string if there are no attachments' do
- info_request = ire.info_request
- expect(ire.filetype).to eq('')
- end
-
- it 'should return a space separated list of the attachment file types' do
- info_request = ire.info_request
- incoming = FactoryBot.create(:incoming_message_with_attachments,
- info_request: info_request)
- ire.incoming_message = incoming
- expect(ire.filetype).to eq('pdf')
- end
- end
-
- context 'not a response event' do
- it 'should return a blank string' do
- ire = FactoryBot.create(:info_request_event, event_type: 'comment')
- expect(ire.filetype).to eq('')
- end
- end
- end
-
describe '#visible' do
context 'is a comment' do
it 'should return the visibility of the comment' do
@@ -614,109 +457,6 @@
end
end
- describe "#only_editing_prominence_to_hide?" do
- let(:unchanged_params) do
- { editor: "henare",
- old_title: "How much wood does a woodpecker peck?",
- title: "How much wood does a woodpecker peck?",
- old_described_state: "rejected",
- described_state: "rejected",
- old_awaiting_description: false,
- awaiting_description: false,
- old_allow_new_responses_from: "anybody",
- allow_new_responses_from: "anybody",
- old_handle_rejected_responses: "bounce",
- handle_rejected_responses: "bounce",
- old_tag_string: "",
- tag_string: "",
- old_comments_allowed: true,
- comments_allowed: true }
- end
-
- it "should be false if it's not an edit" do
- ire = InfoRequestEvent.new(event_type: "resent")
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
-
- it "should be false if it's already a hide event" do
- ire = InfoRequestEvent.new(event_type: "hide")
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
-
- it "should be false if editing multiple conditions" do
- params = unchanged_params.merge({ old_prominence: "normal",
- prominence: "backpage",
- old_comments_allowed: true,
- comments_allowed: false })
-
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
-
- context "when only editing prominence to hidden" do
- let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "hidden"}) }
-
- it do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be true
- end
- end
-
- context "when only editing prominence to requester_only" do
- let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "requester_only"}) }
-
- it "should be true if only editing prominence to requester_only" do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be true
- end
- end
-
- context "when only editing prominence to backpage" do
- let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "backpage"}) }
-
- it "should be true if only editing prominence to backpage" do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be true
- end
- end
-
- context "when the old prominence was hidden" do
- let(:params) { unchanged_params.merge({old_prominence: "hidden", prominence: "requester_only"}) }
-
- it do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
- end
-
- context "when the old prominence was requester_only" do
- let(:params) { unchanged_params.merge({old_prominence: "requester_only", prominence: "hidden"}) }
-
- it do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
- end
-
- context "when the old prominence was backpage" do
- let(:params) { unchanged_params.merge({old_prominence: "backpage", prominence: "hidden"}) }
-
- it do
- ire = InfoRequestEvent.new(event_type: "edit", params: params)
-
- expect(ire.only_editing_prominence_to_hide?).to be false
- end
- end
- end
-
describe '#resets_due_dates?' do
it 'returns true if the event is a sending of the request' do
@@ -871,4 +611,272 @@
end
+ # Testing a private callback helper
+ describe "#only_editing_prominence_to_hide?" do
+ let(:unchanged_params) do
+ { editor: "henare",
+ old_title: "How much wood does a woodpecker peck?",
+ title: "How much wood does a woodpecker peck?",
+ old_described_state: "rejected",
+ described_state: "rejected",
+ old_awaiting_description: false,
+ awaiting_description: false,
+ old_allow_new_responses_from: "anybody",
+ allow_new_responses_from: "anybody",
+ old_handle_rejected_responses: "bounce",
+ handle_rejected_responses: "bounce",
+ old_tag_string: "",
+ tag_string: "",
+ old_comments_allowed: true,
+ comments_allowed: true }
+ end
+
+ it "should be false if it's not an edit" do
+ ire = InfoRequestEvent.new(event_type: "resent")
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+
+ it "should be false if it's already a hide event" do
+ ire = InfoRequestEvent.new(event_type: "hide")
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+
+ it "should be false if editing multiple conditions" do
+ params = unchanged_params.merge({ old_prominence: "normal",
+ prominence: "backpage",
+ old_comments_allowed: true,
+ comments_allowed: false })
+
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+
+ context "when only editing prominence to hidden" do
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "hidden"}) }
+
+ it do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be true
+ end
+ end
+
+ context "when only editing prominence to requester_only" do
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "requester_only"}) }
+
+ it "should be true if only editing prominence to requester_only" do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be true
+ end
+ end
+
+ context "when only editing prominence to backpage" do
+ let(:params) { unchanged_params.merge({old_prominence: "normal", prominence: "backpage"}) }
+
+ it "should be true if only editing prominence to backpage" do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be true
+ end
+ end
+
+ context "when the old prominence was hidden" do
+ let(:params) { unchanged_params.merge({old_prominence: "hidden", prominence: "requester_only"}) }
+
+ it do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+ end
+
+ context "when the old prominence was requester_only" do
+ let(:params) { unchanged_params.merge({old_prominence: "requester_only", prominence: "hidden"}) }
+
+ it do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+ end
+
+ context "when the old prominence was backpage" do
+ let(:params) { unchanged_params.merge({old_prominence: "backpage", prominence: "hidden"}) }
+
+ it do
+ ire = InfoRequestEvent.new(event_type: "edit", params: params)
+
+ expect(ire.send(:only_editing_prominence_to_hide?)).to be false
+ end
+ end
+ end
+
+
+ # INDEXING HELPERS
+ #
+ # Technically don't need to test because these are private, but we want to
+ # ensure we're populating the search index with the correct values so these
+ # currently call the method via `send`.
+
+ describe 'when deciding if it is indexed by search' do
+ it 'returns a falsey value for a comment that is not visible' do
+ comment = FactoryBot.create(:hidden_comment)
+ comment_event = FactoryBot.build(:comment_event, comment: comment)
+ expect(comment_event.send(:indexed_by_search?)).to be_falsey
+ end
+
+ it 'returns a truthy value for a comment that is visible' do
+ comment = FactoryBot.create(:comment)
+ comment_event = FactoryBot.build(:comment_event, comment: comment)
+ expect(comment_event.send(:indexed_by_search?)).to be_truthy
+ end
+
+ it 'returns a falsey value for an incoming message that is not indexed by search' do
+ incoming_message = FactoryBot.create(:incoming_message, :hidden)
+ response_event = FactoryBot.build(:response_event,
+ incoming_message: incoming_message)
+ expect(response_event.send(:indexed_by_search?)).to be_falsey
+ end
+
+ it 'returns a truthy value for an incoming message that is indexed by search' do
+ incoming_message = FactoryBot.create(:incoming_message)
+ response_event = FactoryBot.build(:response_event,
+ incoming_message: incoming_message)
+ expect(response_event.send(:indexed_by_search?)).to be_truthy
+ end
+
+ it 'returns a falsey value for an outgoing message that is not indexed by search' do
+ outgoing_message = FactoryBot.create(:hidden_followup)
+ followup_event = FactoryBot.build(:followup_sent_event,
+ outgoing_message: outgoing_message)
+ expect(followup_event.send(:indexed_by_search?)).to be_falsey
+ end
+
+ it 'returns a truthy value for an outgoing message that is indexed by search' do
+ outgoing_message = FactoryBot.create(:new_information_followup)
+ followup_event = FactoryBot.build(:followup_sent_event,
+ outgoing_message: outgoing_message)
+ expect(followup_event.send(:indexed_by_search?)).to be_truthy
+ end
+
+ it 'returns a falsey value for an overdue event' do
+ overdue_event = FactoryBot.build(:overdue_event)
+ expect(overdue_event.send(:indexed_by_search?)).to be_falsey
+ end
+
+ it 'returns a falsey value for a very overdue event' do
+ very_overdue_event = FactoryBot.build(:very_overdue_event)
+ expect(very_overdue_event.send(:indexed_by_search?)).to be_falsey
+ end
+
+ it 'returns a falsey value for an embargo expiry event' do
+ expire_embargo_event = FactoryBot.build(:expire_embargo_event)
+ expect(expire_embargo_event.send(:indexed_by_search?)).to be_falsey
+ end
+ end
+
+ describe '#requested_by' do
+ it "should return the slug of the associated request's user" do
+ ire = FactoryBot.create(:info_request_event)
+ expect(ire.send(:requested_by)).to eq(ire.info_request.user_name_slug)
+ end
+ end
+
+
+ describe '#requested_from' do
+ it "should return an array of translated public body url_name values" do
+ ire = FactoryBot.create(:info_request_event)
+ public_body = ire.info_request.public_body
+ expect(ire.send(:requested_from)).to eq([public_body.url_name])
+ end
+ end
+
+ describe '#commented_by' do
+ context 'if it is a comment event' do
+ it "should return the commenter's url_name" do
+ user = FactoryBot.create(:user)
+ comment = FactoryBot.create(:comment, user: user)
+ ire = FactoryBot.create(:info_request_event,
+ event_type: 'comment',
+ comment: comment)
+ expect(ire.send(:commented_by)).to eq(user.url_name)
+ end
+ end
+
+ context 'if it is not a comment event' do
+ it 'should return a blank string' do
+ ire = FactoryBot.create(:info_request_event)
+ expect(ire.send(:commented_by)).to eq('')
+ end
+ end
+ end
+
+ describe '#variety' do
+ it 'should be an alias for event_type' do
+ ire = FactoryBot.create(:info_request_event)
+ expect(ire.send(:variety)).to eq(ire.event_type)
+ end
+ end
+
+ describe '#latest_variety' do
+ it 'should return the variety for the most recent event of the related request' do
+ ire = FactoryBot.create(:info_request_event)
+ request = ire.info_request
+ new_event = FactoryBot.create(:info_request_event,
+ event_type: 'comment',
+ info_request: request)
+ request.reload
+ expect(ire.send(:latest_variety)).to eq('comment')
+ end
+ end
+
+ describe '#latest_status' do
+ it 'should return the calculated_state of the most recent event of the related request' do
+ ire = FactoryBot.create(:info_request_event)
+ request = ire.info_request
+ new_event = FactoryBot.create(:info_request_event,
+ event_type: 'comment',
+ info_request: request)
+ new_event.set_calculated_state!('internal_review')
+ request.reload
+ expect(ire.send(:latest_status)).to eq('internal_review')
+ end
+ end
+
+ describe '#filetype' do
+ context 'a response event' do
+ let(:ire) { ire = FactoryBot.create(:response_event) }
+
+ it 'should raise an error if there is not incoming_message' do
+ ire.incoming_message = nil
+ expect { ire.send(:filetype) }.to raise_error.
+ with_message(/event type is 'response' but no incoming message for event/)
+ end
+
+ it 'should return a blank string if there are no attachments' do
+ info_request = ire.info_request
+ expect(ire.send(:filetype)).to eq('')
+ end
+
+ it 'should return a space separated list of the attachment file types' do
+ info_request = ire.info_request
+ incoming = FactoryBot.create(:incoming_message_with_attachments,
+ info_request: info_request)
+ ire.incoming_message = incoming
+ expect(ire.send(:filetype)).to eq('pdf')
+ end
+ end
+
+ context 'not a response event' do
+ it 'should return a blank string' do
+ ire = FactoryBot.create(:info_request_event, event_type: 'comment')
+ expect(ire.send(:filetype)).to eq('')
+ end
+ end
+ end
+
end
From 0cd59efca67a13d188be43f7cb1f081a1ecad709 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 3 Apr 2023 04:59:34 +0000
Subject: [PATCH 253/289] Build(deps): Bump aws-sdk-s3 from 1.119.2 to 1.120.0
Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.119.2 to 1.120.0.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)
---
updated-dependencies:
- dependency-name: aws-sdk-s3
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 737a379004..4326e097ba 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -120,7 +120,7 @@ GEM
rake (>= 10.4, < 14.0)
ast (2.4.2)
aws-eventstream (1.2.0)
- aws-partitions (1.735.0)
+ aws-partitions (1.739.0)
aws-sdk-core (3.171.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
@@ -129,7 +129,7 @@ GEM
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.119.2)
+ aws-sdk-s3 (1.120.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
From 90f0c9025e668828dbfb17202ec15ebea2fa6389 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 3 Apr 2023 05:03:25 +0000
Subject: [PATCH 254/289] Build(deps): Bump thin from 1.8.1 to 1.8.2
Bumps [thin](https://github.com/macournoyer/thin) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/macournoyer/thin/releases)
- [Changelog](https://github.com/macournoyer/thin/blob/master/CHANGELOG)
- [Commits](https://github.com/macournoyer/thin/compare/v1.8.1...v1.8.2)
---
updated-dependencies:
- dependency-name: thin
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Gemfile b/Gemfile
index 7a87eb5a12..de73285d40 100644
--- a/Gemfile
+++ b/Gemfile
@@ -122,7 +122,7 @@ gem 'strip_attributes', git: 'https://github.com/mysociety/strip_attributes.git'
gem 'stripe', '~> 5.55.0'
gem 'syck', '~> 1.4.1', require: false
gem 'syslog_protocol', '~> 0.9.0'
-gem 'thin', '~> 1.8.1'
+gem 'thin', '~> 1.8.2'
gem 'vpim', '~> 13.11.11'
gem 'will_paginate', '~> 3.3.1'
gem 'xapian-full-alaveteli', '~> 1.4.22.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 737a379004..7525b1b56c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -175,7 +175,7 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
- daemons (1.4.0)
+ daemons (1.4.1)
dalli (3.2.4)
dante (0.2.0)
date (3.3.3)
@@ -500,7 +500,7 @@ GEM
syck (1.4.1)
syslog_protocol (0.9.2)
text (1.3.1)
- thin (1.8.1)
+ thin (1.8.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
@@ -628,7 +628,7 @@ DEPENDENCIES
stripe-ruby-mock!
syck (~> 1.4.1)
syslog_protocol (~> 0.9.0)
- thin (~> 1.8.1)
+ thin (~> 1.8.2)
uglifier (~> 4.2.0)
unicode (~> 0.4.4)
unidecoder (~> 1.1.0)
From a55e9c2523f242964678d4428e7910581263d233 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Mon, 3 Apr 2023 11:13:47 +0100
Subject: [PATCH 255/289] Update integration specs
These specs are either outdated with our current implementation or just
broken but the errors are hidden due to an issue upstream in Capybara.
Depending on the block notation used Capybara will return different
results:
```
# will fail
expect(page).to have_selector("input") { false }
# will pass
expect(page).to have_selector("input") do
false
end
```
This has been fixed in Capybara v3.39.0
See: https://github.com/teamcapybara/capybara/issues/2616
---
spec/controllers/request_controller_spec.rb | 8 ++++----
.../request/_after_actions.html.erb_spec.rb | 17 +++++++----------
spec/views/request/show.html.erb_spec.rb | 8 ++++----
3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb
index a7ffcfe862..d1fef1160e 100644
--- a/spec/controllers/request_controller_spec.rb
+++ b/spec/controllers/request_controller_spec.rb
@@ -1732,8 +1732,8 @@ def send_request
sign_in users(:bob_smith_user)
get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
- expect(s).to contain(/Silly.*left an annotation/m)
- expect(s).not_to contain(/You.*left an annotation/m)
+ expect(s).to have_text(/Silly.*left an annotation/m)
+ expect(s).not_to have_text(/You.*left an annotation/m)
end
end
@@ -1741,8 +1741,8 @@ def send_request
sign_in users(:silly_name_user)
get :show, params: { url_title: 'why_do_you_have_such_a_fancy_dog' }
expect(response.body).to have_css("div#comment-1 h2") do |s|
- expect(s).to contain(/Silly.*left an annotation/m)
- expect(s).not_to contain(/You.*left an annotation/m)
+ expect(s).to have_text(/Silly.*left an annotation/m)
+ expect(s).not_to have_text(/You.*left an annotation/m)
end
end
diff --git a/spec/views/request/_after_actions.html.erb_spec.rb b/spec/views/request/_after_actions.html.erb_spec.rb
index c7d42fac5f..567a65c66e 100644
--- a/spec/views/request/_after_actions.html.erb_spec.rb
+++ b/spec/views/request/_after_actions.html.erb_spec.rb
@@ -18,7 +18,7 @@
end
context 'if show_owner_update_status_action is true' do
- before { locals.merge(show_owner_update_status_action: true) }
+ before { locals.merge!(show_owner_update_status_action: true) }
it 'displays a link for the request owner to update the status of the request' do
render partial: 'request/after_actions', locals: locals
@@ -30,7 +30,7 @@
end
context 'if show_owner_update_status_action is false' do
- before { locals.merge(show_owner_update_status_action: false) }
+ before { locals.merge!(show_owner_update_status_action: false) }
it 'does not display a link for the request owner to update the status of the request' do
render partial: 'request/after_actions', locals: locals
@@ -43,7 +43,7 @@
end
context 'if show_other_user_update_status_action is true' do
- before { locals.merge(show_other_user_update_status_action: true) }
+ before { locals.merge!(show_other_user_update_status_action: true) }
it 'displays a link for anyone to update the status of the request' do
render partial: 'request/after_actions', locals: locals
@@ -55,7 +55,7 @@
end
context 'if show_other_user_update_status_action is false' do
- before { locals.merge(show_other_user_update_status_action: false) }
+ before { locals.merge!(show_other_user_update_status_action: false) }
it 'does not display a link for anyone to update the status of the request' do
render partial: 'request/after_actions', locals: locals
@@ -90,8 +90,7 @@
render partial: 'request/after_actions', locals: locals
expect(response.body).to have_css('ul.anyone_actions') do |div|
- text = 'Add an annotation (to help the requester or others)'
- expect(div).to have_css('a', text: text)
+ expect(div).to have_css('a', text: 'Add an annotation')
end
end
end
@@ -103,8 +102,7 @@
render partial: 'request/after_actions', locals: locals
expect(response.body).to have_css('ul.anyone_actions') do |div|
- text = 'Add an annotation (to help the requester or others)'
- expect(div).not_to have_css('a', text: text)
+ expect(div).not_to have_css('a', text: 'Add an annotation')
end
end
end
@@ -114,8 +112,7 @@
render partial: 'request/after_actions', locals: locals
expect(response.body).to have_css('ul.anyone_actions') do |div|
- text = 'Add an annotation (to help the requester or others)'
- expect(div).not_to have_css('a', text: text)
+ expect(div).not_to have_css('a', text: 'Add an annotation')
end
end
end
diff --git a/spec/views/request/show.html.erb_spec.rb b/spec/views/request/show.html.erb_spec.rb
index 3c52f840e3..5e94b0cac0 100644
--- a/spec/views/request/show.html.erb_spec.rb
+++ b/spec/views/request/show.html.erb_spec.rb
@@ -277,7 +277,7 @@ def request_page
assign :track_thing, TrackThing.create_track_for_request(request_with_attachment)
render
expect(rendered).to have_css(".attachment .attachment__name") do |s|
- expect(s).to contain(/interesting.pdf/m)
+ expect(s).to have_text(/interesting.html/m)
end
end
end
@@ -285,8 +285,8 @@ def request_page
context "when there is a censor rule" do
it "should replace the attachment name" do
request_with_attachment.censor_rules.create!(
- text: "interesting.pdf",
- replacement: "Mouse.pdf",
+ text: "interesting.html",
+ replacement: "Mouse.html",
last_edit_editor: "unknown",
last_edit_comment: "none")
assign :info_request, request_with_attachment
@@ -300,7 +300,7 @@ def request_page
# Note that the censor rule applies to the original filename,
# not the display_filename:
expect(rendered).to have_css(".attachment .attachment__name") do |s|
- expect(s).to contain(/Mouse.pdf/m)
+ expect(s).to have_text(/Mouse.html/m)
end
end
end
From f961164bae86d5090a855176fa63ccf7c8c0ba23 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 3 Apr 2023 05:05:13 +0000
Subject: [PATCH 256/289] Build(deps-dev): Bump capybara from 3.38.0 to 3.39.0
Bumps [capybara](https://github.com/teamcapybara/capybara) from 3.38.0 to 3.39.0.
- [Release notes](https://github.com/teamcapybara/capybara/releases)
- [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md)
- [Commits](https://github.com/teamcapybara/capybara/compare/3.38.0...3.39.0)
---
updated-dependencies:
- dependency-name: capybara
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Gemfile b/Gemfile
index 7a87eb5a12..f344165362 100644
--- a/Gemfile
+++ b/Gemfile
@@ -167,7 +167,7 @@ group :test do
gem 'webmock', '~> 3.18.1'
gem 'simplecov', '~> 0.22.0'
gem 'simplecov-lcov', '~> 0.7.0'
- gem 'capybara', '~> 3.38.0'
+ gem 'capybara', '~> 3.39.0'
gem 'stripe-ruby-mock', git: 'https://github.com/stripe-ruby-mock/stripe-ruby-mock',
ref: '6ceea96'
gem 'rails-controller-testing'
diff --git a/Gemfile.lock b/Gemfile.lock
index 737a379004..b7eefab34c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -113,7 +113,7 @@ GEM
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
- addressable (2.8.1)
+ addressable (2.8.2)
public_suffix (>= 2.0.2, < 6.0)
annotate (3.2.0)
activerecord (>= 3.2, < 8.0)
@@ -159,7 +159,7 @@ GEM
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
- capybara (3.38.0)
+ capybara (3.39.0)
addressable
matrix
mini_mime (>= 0.1.3)
@@ -561,7 +561,7 @@ DEPENDENCIES
bullet (~> 7.0.7)
cancancan (~> 3.5.0)
capistrano (~> 2.15.0, < 3.0.0)
- capybara (~> 3.38.0)
+ capybara (~> 3.39.0)
charlock_holmes (~> 0.7.7)
dalli (~> 3.2.4)
exception_notification (~> 4.5.0)
From 373b1c7e90b950c5017777a4f2b4eb9413428703 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Mon, 3 Apr 2023 16:02:57 +0100
Subject: [PATCH 257/289] Remove "Introductory Pricing" phrase
Started to cause some confusion for WhatDoTheyKnow users wondering if
their plan will change price after a period of months. Makes less sense
to include this in Alaveteli core now; we have a variety of installs
running Pro, some quite new but some quite established.
---
app/views/alaveteli_pro/plans/_pricing_tiers.html.erb | 4 ----
1 file changed, 4 deletions(-)
diff --git a/app/views/alaveteli_pro/plans/_pricing_tiers.html.erb b/app/views/alaveteli_pro/plans/_pricing_tiers.html.erb
index b0c5538c54..5f4c5b7452 100644
--- a/app/views/alaveteli_pro/plans/_pricing_tiers.html.erb
+++ b/app/views/alaveteli_pro/plans/_pricing_tiers.html.erb
@@ -22,10 +22,6 @@
no_cents_if_whole: true)) %>
<% end %>
-
-
- <%= _('Introductory Pricing') %>
-
From e43e1cbd716bb563d2970b2214e43acb4ba5ef12 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 5 Apr 2023 14:35:23 +0100
Subject: [PATCH 258/289] Fix admin timeline edit comment events
When an comment is edited the admin timeline breaks. This is due to
changes in how the event params are stored in #7173.
We should now use `event.comment` which loads the correct `Comment` from
the database without needing the manually load from the view.
Fixes #7682
---
app/views/admin_general/_edit_comment.html.erb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/views/admin_general/_edit_comment.html.erb b/app/views/admin_general/_edit_comment.html.erb
index 246e0bd7ae..a7a086980b 100644
--- a/app/views/admin_general/_edit_comment.html.erb
+++ b/app/views/admin_general/_edit_comment.html.erb
@@ -1,6 +1,5 @@
-<% comment = Comment.find(event.params[:comment_id].to_i) %>
had annotation edited by administrator <%= event.params[:editor] %>.
-<% if comment %>
+<% if event.comment %>
<%= event_params_description(event) %>
<% else %>
Missing annotation, internal error.
From 6ccd2d06e1d1308425bb5fcb0a3a6b1506dbb076 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 10 Apr 2023 05:01:55 +0000
Subject: [PATCH 259/289] Build(deps-dev): Bump rubocop-performance from 1.16.0
to 1.17.1
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.16.0 to 1.17.1.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.16.0...v1.17.1)
---
updated-dependencies:
- dependency-name: rubocop-performance
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 9da69507a6..9910ffe691 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -349,7 +349,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.2.1.1)
+ parser (3.2.2.0)
ast (~> 2.4.1)
pg (1.4.6)
prime (0.1.2)
@@ -451,9 +451,9 @@ GEM
rubocop-ast (>= 1.26.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.27.0)
+ rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
- rubocop-performance (1.16.0)
+ rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.18.0)
From 0683c1d6469e1f2334e73f7d87decfadf316e0e6 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 10 Apr 2023 05:03:30 +0000
Subject: [PATCH 260/289] Build(deps): Bump aws-sdk-s3 from 1.120.0 to 1.120.1
Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.120.0 to 1.120.1.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)
---
updated-dependencies:
- dependency-name: aws-sdk-s3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 9da69507a6..4484848961 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -120,7 +120,7 @@ GEM
rake (>= 10.4, < 14.0)
ast (2.4.2)
aws-eventstream (1.2.0)
- aws-partitions (1.739.0)
+ aws-partitions (1.743.0)
aws-sdk-core (3.171.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
@@ -129,7 +129,7 @@ GEM
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.120.0)
+ aws-sdk-s3 (1.120.1)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
From 4d98b9cfa70b0fce45bf119d552680a400d92224 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 10 Apr 2023 05:00:20 +0000
Subject: [PATCH 261/289] Build(deps-dev): Bump rubocop-rails from 2.18.0 to
2.19.0
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.18.0 to 2.19.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.18.0...v2.19.0)
---
updated-dependencies:
- dependency-name: rubocop-rails
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 3 +++
Gemfile.lock | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 83122370ba..66689f45e5 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -1366,6 +1366,9 @@ Rails/StripHeredoc:
Rails/TableNameAssignment:
Enabled: false
+Rails/ThreeStateBooleanColumn:
+ Enabled: false
+
Rails/TimeZone:
Enabled: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 9da69507a6..86a9ef66fe 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -349,7 +349,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.2.1.1)
+ parser (3.2.2.0)
ast (~> 2.4.1)
pg (1.4.6)
prime (0.1.2)
@@ -451,12 +451,12 @@ GEM
rubocop-ast (>= 1.26.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.27.0)
+ rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
- rubocop-rails (2.18.0)
+ rubocop-rails (2.19.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
From 93c4711925038b63bb3ba076226089d2d7811ac1 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 10 Apr 2023 05:07:35 +0000
Subject: [PATCH 262/289] Build(deps-dev): Bump rubocop from 1.48.1 to 1.49.0
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.48.1 to 1.49.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.48.1...v1.49.0)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 6 ++++++
Gemfile | 2 +-
Gemfile.lock | 10 +++++-----
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 83122370ba..3887b0d21f 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -1555,6 +1555,9 @@ Style/ConstantVisibility:
Style/Copyright:
Enabled: false
+Style/DataInheritance:
+ Enabled: false
+
Style/DateTime:
Enabled: false
@@ -1989,6 +1992,9 @@ Style/RedundantInitialize:
Style/RedundantInterpolation:
Enabled: true
+Style/RedundantLineContinuation:
+ Enabled: false
+
Style/RedundantParentheses:
Enabled: true
diff --git a/Gemfile b/Gemfile
index fab05415d5..8c2c00df93 100644
--- a/Gemfile
+++ b/Gemfile
@@ -190,7 +190,7 @@ group :development do
gem 'launchy', '< 2.6.0'
gem 'listen', '>= 3.0.5', '< 3.8.1'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.48.1', require: false
+ gem 'rubocop', '~> 1.49.0', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 9da69507a6..8cad290218 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -349,7 +349,7 @@ GEM
open4 (1.3.4)
os (1.1.4)
parallel (1.22.1)
- parser (3.2.1.1)
+ parser (3.2.2.0)
ast (~> 2.4.1)
pg (1.4.6)
prime (0.1.2)
@@ -441,17 +441,17 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.48.1)
+ rubocop (1.49.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.26.0, < 2.0)
+ rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
- rubocop-ast (1.27.0)
+ rubocop-ast (1.28.0)
parser (>= 3.2.1.0)
rubocop-performance (1.16.0)
rubocop (>= 1.7.0, < 2.0)
@@ -612,7 +612,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.48.1)
+ rubocop (~> 1.49.0)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From a360f1e0c1debe72d31a9c3cb0f668ca42cb9d8c Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 11 Apr 2023 09:38:31 +0100
Subject: [PATCH 263/289] Remove duplicate method
Looks like this was meant to be removed in #7452.
---
app/models/info_request_event.rb | 4 ----
1 file changed, 4 deletions(-)
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 3226561ba7..3892b1a0a9 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -202,10 +202,6 @@ def tags
info_request.tag_array_for_search
end
- def variety
- event_type
- end
-
def visible
if event_type == 'comment'
comment.visible
From e8f7dcb20019edcab0da6c7dc8da9c9ea637dcb0 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Tue, 4 Apr 2023 15:42:39 +0100
Subject: [PATCH 264/289] feat: alter project download to include requests with
no extractions
---
app/models/project/export.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/project/export.rb b/app/models/project/export.rb
index dcbfc50107..22cbed4cc4 100644
--- a/app/models/project/export.rb
+++ b/app/models/project/export.rb
@@ -14,7 +14,7 @@ def initialize(project)
end
def data
- @data ||= project.info_requests.extracted.map do |info_request|
+ @data ||= project.info_requests.map do |info_request|
Project::Export::InfoRequest.new(project, info_request).data
end
end
From 9942e1cf480351fb03bcec2ac5e7a433d6ddafd8 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Wed, 5 Apr 2023 13:43:09 +0100
Subject: [PATCH 265/289] test: won't expect 'exported' call to info_requests
---
spec/models/project/export_spec.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spec/models/project/export_spec.rb b/spec/models/project/export_spec.rb
index c458d8b18c..e693226024 100644
--- a/spec/models/project/export_spec.rb
+++ b/spec/models/project/export_spec.rb
@@ -11,11 +11,11 @@
let(:info_request_b) { instance_double('InfoRequest') }
before do
- allow(project).to receive_message_chain(:info_requests, :extracted).
+ allow(project).to receive_message_chain(:info_requests).
and_return([info_request_a, info_request_b])
end
- it 'individualy exports info requests' do
+ it 'individually exports info requests' do
expect(Project::Export::InfoRequest).to receive(:new).
with(project, info_request_a).
and_return(double(data: { header: 'DATA A' }))
From 997f2352f135deea60e703d3282478fd2d41eeb2 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Tue, 11 Apr 2023 12:28:49 +0100
Subject: [PATCH 266/289] Remove file_watcher from config
In Rails 7, the file_watcher variable was removed from the config
template (as well as the listen gem).
This change is now reflected here, which makes development in a
docker environment easier, because it means that the container
doesn't need to be restarted for changes to files to reflect
in the local website in the browser.
---
Gemfile | 1 -
Gemfile.lock | 8 --------
config/environments/development.rb | 4 ----
3 files changed, 13 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8c2c00df93..e8ac8a1651 100644
--- a/Gemfile
+++ b/Gemfile
@@ -188,7 +188,6 @@ group :development do
gem 'net-ssh', '~> 7.1.0'
gem 'net-ssh-gateway', '>= 1.1.0', '< 3.0.0'
gem 'launchy', '< 2.6.0'
- gem 'listen', '>= 3.0.5', '< 3.8.1'
gem 'web-console', '>= 3.3.0'
gem 'rubocop', '~> 1.49.0', require: false
gem 'rubocop-performance', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 52a78f27e0..4c8eed37aa 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -202,7 +202,6 @@ GEM
faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0)
fast_gettext (2.3.0)
- ffi (1.15.5)
fivemat (1.3.7)
flipper (0.24.1)
flipper-active_record (0.24.1)
@@ -286,9 +285,6 @@ GEM
libv8-node (16.10.0.0-arm64-darwin)
libv8-node (16.10.0.0-x86_64-darwin)
libv8-node (16.10.0.0-x86_64-linux)
- listen (3.8.0)
- rb-fsevent (~> 0.10, >= 0.10.3)
- rb-inotify (~> 0.9, >= 0.9.10)
locale (2.1.3)
loofah (2.19.1)
crass (~> 1.0.2)
@@ -400,9 +396,6 @@ GEM
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
recaptcha (5.12.3)
json
redis (4.8.1)
@@ -584,7 +577,6 @@ DEPENDENCIES
jquery-ui-rails (~> 6.0.0)
json (~> 2.6.2)
launchy (< 2.6.0)
- listen (>= 3.0.5, < 3.8.1)
locale (~> 2.1.3)
mahoro (~> 0.5)
mail (~> 2.8.1)
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 636e5e4909..a92d6846b3 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -64,10 +64,6 @@
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
- # Use an evented file watcher to asynchronously detect changes in source code,
- # routes, locales, etc. This feature depends on the listen gem.
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
-
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
From 4f087a17ac5eadca5a613707df533a7e4623565f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 12 Apr 2023 06:35:46 +0000
Subject: [PATCH 267/289] Build(deps): Bump nokogiri from 1.14.2 to 1.14.3
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.14.2 to 1.14.3.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.14.2...v1.14.3)
---
updated-dependencies:
- dependency-name: nokogiri
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8c2c00df93..7d38c675e8 100644
--- a/Gemfile
+++ b/Gemfile
@@ -104,7 +104,7 @@ gem 'iso_country_codes', '~> 0.7.8'
gem 'mail', '~> 2.8.1'
gem 'maxmind-db', '~> 1.0.0'
gem 'mahoro', '~> 0.5'
-gem 'nokogiri', '~> 1.14.2'
+gem 'nokogiri', '~> 1.14.3'
gem 'open4', '~> 1.3.0'
gem 'rack', '~> 2.2.6'
gem 'rack-utf8_sanitizer', '~> 1.8.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 52a78f27e0..3a6b844fd9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -332,16 +332,16 @@ GEM
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
nio4r (2.5.8)
- nokogiri (1.14.2)
+ nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
- nokogiri (1.14.2-aarch64-linux)
+ nokogiri (1.14.3-aarch64-linux)
racc (~> 1.4)
- nokogiri (1.14.2-arm64-darwin)
+ nokogiri (1.14.3-arm64-darwin)
racc (~> 1.4)
- nokogiri (1.14.2-x86_64-darwin)
+ nokogiri (1.14.3-x86_64-darwin)
racc (~> 1.4)
- nokogiri (1.14.2-x86_64-linux)
+ nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
oink (0.10.1)
activerecord
@@ -596,7 +596,7 @@ DEPENDENCIES
money (~> 6.16.0)
net-ssh (~> 7.1.0)
net-ssh-gateway (>= 1.1.0, < 3.0.0)
- nokogiri (~> 1.14.2)
+ nokogiri (~> 1.14.3)
oink (~> 0.10.1)
open4 (~> 1.3.0)
pg (~> 1.4.6)
From 93d0ed0057d837739cbfea79e7e93fe6b239c690 Mon Sep 17 00:00:00 2001
From: Gareth Rees
Date: Fri, 31 Mar 2023 15:17:42 +0100
Subject: [PATCH 268/289] Add inline documentation for blog posts
Add some basic documentation so that admins know they can match blog
posts to related content via tags.
---
app/views/admin/blog_posts/_about.html.erb | 21 +++++++++++++++++++++
app/views/admin/blog_posts/index.html.erb | 4 ++++
2 files changed, 25 insertions(+)
create mode 100644 app/views/admin/blog_posts/_about.html.erb
diff --git a/app/views/admin/blog_posts/_about.html.erb b/app/views/admin/blog_posts/_about.html.erb
new file mode 100644
index 0000000000..00e8965925
--- /dev/null
+++ b/app/views/admin/blog_posts/_about.html.erb
@@ -0,0 +1,21 @@
+
+
+
+
About Blog Posts
+
+
+ Alaveteli automatically imports posts from the configured
+
+ BLOG_FEED to display around the site.
+
+
+
+ By default blog posts are listed by recency. When they're presented
+ alongside <%= link_to 'taggable content', admin_tags_path %>, Alaveteli
+ attempts to render relevant posts through matching tags. For example,
+ blog posts tagged with "climate" would be matched with records
+ (requests, authorities, etc) also tagged "climate".
+
+
+
+
diff --git a/app/views/admin/blog_posts/index.html.erb b/app/views/admin/blog_posts/index.html.erb
index 0adf3d90bb..13507dc4e9 100644
--- a/app/views/admin/blog_posts/index.html.erb
+++ b/app/views/admin/blog_posts/index.html.erb
@@ -25,3 +25,7 @@
feed in Alaveteli’s configuration.
<% end %>
+
+
+
+<%= render partial: 'about' %>
From 45ced492a37b687dd741e891fe6a9bd86dd6c586 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Apr 2023 04:57:40 +0000
Subject: [PATCH 269/289] Build(deps): Bump recaptcha from 5.12.3 to 5.13.0
Bumps [recaptcha](https://github.com/ambethia/recaptcha) from 5.12.3 to 5.13.0.
- [Release notes](https://github.com/ambethia/recaptcha/releases)
- [Changelog](https://github.com/ambethia/recaptcha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ambethia/recaptcha/compare/v5.12.3...v5.13.0)
---
updated-dependencies:
- dependency-name: recaptcha
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index e474f2de3a..6bd2ba6db2 100644
--- a/Gemfile
+++ b/Gemfile
@@ -108,7 +108,7 @@ gem 'nokogiri', '~> 1.14.3'
gem 'open4', '~> 1.3.0'
gem 'rack', '~> 2.2.6'
gem 'rack-utf8_sanitizer', '~> 1.8.0'
-gem 'recaptcha', '~> 5.12.3', require: 'recaptcha/rails'
+gem 'recaptcha', '~> 5.13.0', require: 'recaptcha/rails'
gem 'matrix', '~> 0.4.2'
gem 'mini_magick', '~> 4.12.0'
gem 'redis', '~> 4.8.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 0fd3ddda59..0393ea3267 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -396,7 +396,7 @@ GEM
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
- recaptcha (5.12.3)
+ recaptcha (5.13.0)
json
redis (4.8.1)
regexp_parser (2.7.0)
@@ -598,7 +598,7 @@ DEPENDENCIES
rails (~> 7.0.4)
rails-controller-testing
rails-i18n (~> 7.0.5)
- recaptcha (~> 5.12.3)
+ recaptcha (~> 5.13.0)
redis (~> 4.8.1)
rolify (~> 6.0.1)
routing-filter (~> 0.7.0)
From 0e8139451375658ea39012b886a00f2097490fae Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Apr 2023 04:58:12 +0000
Subject: [PATCH 270/289] Build(deps-dev): Bump rubocop-rails from 2.19.0 to
2.19.1
Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.19.0 to 2.19.1.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.19.0...v2.19.1)
---
updated-dependencies:
- dependency-name: rubocop-rails
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 0fd3ddda59..2bc7c57cc4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -449,7 +449,7 @@ GEM
rubocop-performance (1.17.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
- rubocop-rails (2.19.0)
+ rubocop-rails (2.19.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
From c341f27a5f9de65986f634f4f3e9cd72aae01c24 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Apr 2023 04:59:41 +0000
Subject: [PATCH 271/289] Build(deps-dev): Bump rubocop from 1.49.0 to 1.50.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.49.0 to 1.50.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.49.0...v1.50.1)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
.ruby-style.yml | 3 +++
Gemfile | 2 +-
Gemfile.lock | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/.ruby-style.yml b/.ruby-style.yml
index 00485c270c..8c25fcf7c1 100644
--- a/.ruby-style.yml
+++ b/.ruby-style.yml
@@ -471,6 +471,9 @@ Lint/DuplicateHashKey:
Lint/DuplicateMagicComment:
Enabled: false
+Lint/DuplicateMatchPattern:
+ Enabled: false
+
Lint/DuplicateMethods:
Enabled: true
diff --git a/Gemfile b/Gemfile
index e474f2de3a..af69e2a034 100644
--- a/Gemfile
+++ b/Gemfile
@@ -189,7 +189,7 @@ group :development do
gem 'net-ssh-gateway', '>= 1.1.0', '< 3.0.0'
gem 'launchy', '< 2.6.0'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.49.0', require: false
+ gem 'rubocop', '~> 1.50.1', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 0fd3ddda59..1aad3abab1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -434,7 +434,7 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.49.0)
+ rubocop (1.50.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@@ -604,7 +604,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.49.0)
+ rubocop (~> 1.50.1)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From 0747b1da6fbcca8d463efd4eed81e38aa29a8d5c Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Tue, 11 Apr 2023 12:07:07 +0100
Subject: [PATCH 272/289] feat: add censor rules JS and use previous comment
feature in admin_censor_rule form
This change introduces a new JavaScript file, censor-rules.js, to handle the functionality for the admin censor rules section. Specifically, it adds a "Use previous comment" feature to the form for editing censor rules. The change has been made by:
Including the new censor-rules.js file in admin.js to make it available for use in the admin section of js files.
Creating the censor-rules.js file, where a click event listener is added to the "Use previous comment" link. When the link is clicked, the event handler retrieves the last edit comment from the associated text area's data attribute and sets the text area's value to the comment at the last edit.
Updating the _form.html.erb partial for the censor rule form. In the partial, a data attribute is added to the last_edit_comment text area to store the last_edit_comment value from the censor_rule object.
The purpose of this change is to streamline the editing process for admin users. By providing a "Use previous comment" option, admins can easily reuse the last edit comment as the reason for the current update, saving time and effort when making similar or related changes to censor rules.
---
app/assets/javascripts/admin.js | 1 +
app/assets/javascripts/admin/censor-rules.js | 8 ++++++++
app/views/admin_censor_rule/_form.html.erb | 5 ++++-
3 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 app/assets/javascripts/admin/censor-rules.js
diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js
index f8e6a2fad4..b40ef6990a 100644
--- a/app/assets/javascripts/admin.js
+++ b/app/assets/javascripts/admin.js
@@ -9,5 +9,6 @@
//= require bootstrap-tooltip
//= require admin/admin
//= require admin/category-order
+//= require admin/censor-rules
//= require admin/holidays
//= require jquery_ujs
diff --git a/app/assets/javascripts/admin/censor-rules.js b/app/assets/javascripts/admin/censor-rules.js
new file mode 100644
index 0000000000..d90a205f22
--- /dev/null
+++ b/app/assets/javascripts/admin/censor-rules.js
@@ -0,0 +1,8 @@
+$(function () {
+ $('#js-use-previous-comment').click(function (e) {
+ var textArea = $($(this).data('target'));
+ var lastEditComment = textArea.data('last-edit-comment');
+ textArea.val(lastEditComment);
+ e.preventDefault();
+ })
+});
diff --git a/app/views/admin_censor_rule/_form.html.erb b/app/views/admin_censor_rule/_form.html.erb
index 603dfe4a8f..25314ecca0 100644
--- a/app/views/admin_censor_rule/_form.html.erb
+++ b/app/views/admin_censor_rule/_form.html.erb
@@ -56,7 +56,10 @@
From b0ddc92b44423dbaa6deb79595a4e9c8ab464e43 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 19 Apr 2023 15:22:54 +0000
Subject: [PATCH 273/289] Build(deps): Bump recaptcha from 5.13.0 to 5.13.1
Bumps [recaptcha](https://github.com/ambethia/recaptcha) from 5.13.0 to 5.13.1.
- [Release notes](https://github.com/ambethia/recaptcha/releases)
- [Changelog](https://github.com/ambethia/recaptcha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ambethia/recaptcha/compare/v5.13.0...v5.13.1)
---
updated-dependencies:
- dependency-name: recaptcha
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8b405bf569..e453f1704a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -108,7 +108,7 @@ gem 'nokogiri', '~> 1.14.3'
gem 'open4', '~> 1.3.0'
gem 'rack', '~> 2.2.6'
gem 'rack-utf8_sanitizer', '~> 1.8.0'
-gem 'recaptcha', '~> 5.13.0', require: 'recaptcha/rails'
+gem 'recaptcha', '~> 5.13.1', require: 'recaptcha/rails'
gem 'matrix', '~> 0.4.2'
gem 'mini_magick', '~> 4.12.0'
gem 'redis', '~> 4.8.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 26ee1e61c9..6c146771fd 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -396,7 +396,7 @@ GEM
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
- recaptcha (5.13.0)
+ recaptcha (5.13.1)
json
redis (4.8.1)
regexp_parser (2.7.0)
@@ -598,7 +598,7 @@ DEPENDENCIES
rails (~> 7.0.4)
rails-controller-testing
rails-i18n (~> 7.0.5)
- recaptcha (~> 5.13.0)
+ recaptcha (~> 5.13.1)
redis (~> 4.8.1)
rolify (~> 6.0.1)
routing-filter (~> 0.7.0)
From 3e683a2d29adc70d0f6471dc49068df60eb8b1b3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Wed, 19 Apr 2023 15:23:23 +0000
Subject: [PATCH 274/289] Build(deps-dev): Bump rubocop from 1.50.1 to 1.50.2
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.50.1 to 1.50.2.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.50.1...v1.50.2)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Gemfile b/Gemfile
index 8b405bf569..1cc515a3fd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -189,7 +189,7 @@ group :development do
gem 'net-ssh-gateway', '>= 1.1.0', '< 3.0.0'
gem 'launchy', '< 2.6.0'
gem 'web-console', '>= 3.3.0'
- gem 'rubocop', '~> 1.50.1', require: false
+ gem 'rubocop', '~> 1.50.2', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 26ee1e61c9..a56ebd7759 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -344,7 +344,7 @@ GEM
hodel_3000_compliant_logger
open4 (1.3.4)
os (1.1.4)
- parallel (1.22.1)
+ parallel (1.23.0)
parser (3.2.2.0)
ast (~> 2.4.1)
pg (1.4.6)
@@ -399,7 +399,7 @@ GEM
recaptcha (5.13.0)
json
redis (4.8.1)
- regexp_parser (2.7.0)
+ regexp_parser (2.8.0)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
@@ -434,7 +434,7 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.11.1)
- rubocop (1.50.1)
+ rubocop (1.50.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
@@ -604,7 +604,7 @@ DEPENDENCIES
routing-filter (~> 0.7.0)
rspec-activemodel-mocks (~> 1.1.0)
rspec-rails (~> 6.0.0)
- rubocop (~> 1.50.1)
+ rubocop (~> 1.50.2)
rubocop-performance
rubocop-rails
ruby-msg (~> 1.5.0)!
From 0b8c46fbc9af46aa3659e94595f4ac94d8bedd73 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 20 Apr 2023 13:18:51 +0100
Subject: [PATCH 275/289] Remove merge conflict marker
---
doc/CHANGES.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 6a2cf7782e..79fe0e53d7 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -1,4 +1,3 @@
-<<<<<<< HEAD
# develop
## Highlighted Features
From f7dae71984a79825e1ddf8dbefdbf3893d3f79d0 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 21 Apr 2023 08:43:54 +0000
Subject: [PATCH 276/289] Build(deps): Bump aws-sdk-s3 from 1.120.1 to 1.121.0
Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.120.1 to 1.121.0.
- [Release notes](https://github.com/aws/aws-sdk-ruby/releases)
- [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-ruby/commits)
---
updated-dependencies:
- dependency-name: aws-sdk-s3
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 64c7d4113c..7da7bc0331 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -120,7 +120,7 @@ GEM
rake (>= 10.4, < 14.0)
ast (2.4.2)
aws-eventstream (1.2.0)
- aws-partitions (1.743.0)
+ aws-partitions (1.751.0)
aws-sdk-core (3.171.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
@@ -129,7 +129,7 @@ GEM
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
- aws-sdk-s3 (1.120.1)
+ aws-sdk-s3 (1.121.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
From d0ad2a5cdfb909bf640afdb116529c652b19ae24 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 21 Apr 2023 08:44:52 +0000
Subject: [PATCH 277/289] Build(deps): Bump recaptcha from 5.13.1 to 5.14.0
Bumps [recaptcha](https://github.com/ambethia/recaptcha) from 5.13.1 to 5.14.0.
- [Release notes](https://github.com/ambethia/recaptcha/releases)
- [Changelog](https://github.com/ambethia/recaptcha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ambethia/recaptcha/compare/v5.13.1...v5.14.0)
---
updated-dependencies:
- dependency-name: recaptcha
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/Gemfile b/Gemfile
index 5d3bae9d97..4f7a46777b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -108,7 +108,7 @@ gem 'nokogiri', '~> 1.14.3'
gem 'open4', '~> 1.3.0'
gem 'rack', '~> 2.2.6'
gem 'rack-utf8_sanitizer', '~> 1.8.0'
-gem 'recaptcha', '~> 5.13.1', require: 'recaptcha/rails'
+gem 'recaptcha', '~> 5.14.0', require: 'recaptcha/rails'
gem 'matrix', '~> 0.4.2'
gem 'mini_magick', '~> 4.12.0'
gem 'redis', '~> 4.8.1'
diff --git a/Gemfile.lock b/Gemfile.lock
index 64c7d4113c..1b040c730b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -396,8 +396,7 @@ GEM
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
- recaptcha (5.13.1)
- json
+ recaptcha (5.14.0)
redis (4.8.1)
regexp_parser (2.8.0)
representable (3.2.0)
@@ -598,7 +597,7 @@ DEPENDENCIES
rails (~> 7.0.4)
rails-controller-testing
rails-i18n (~> 7.0.5)
- recaptcha (~> 5.13.1)
+ recaptcha (~> 5.14.0)
redis (~> 4.8.1)
rolify (~> 6.0.1)
routing-filter (~> 0.7.0)
From df2f56e032839b4896a1c4c370f1427e2f44b1fc Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 14 Apr 2023 16:37:43 +0100
Subject: [PATCH 278/289] style: Lint/IneffectiveAccessModifier RuboCop
2 changes, made manually
---
app/models/mail_server_log.rb | 1 +
app/models/public_body.rb | 1 +
2 files changed, 2 insertions(+)
diff --git a/app/models/mail_server_log.rb b/app/models/mail_server_log.rb
index f8854e6018..2144d2aacf 100644
--- a/app/models/mail_server_log.rb
+++ b/app/models/mail_server_log.rb
@@ -295,6 +295,7 @@ def self.create_mail_server_logs(emails, line, order, done)
end
end
end
+ private_class_method :create_mail_server_logs
def line_decorator
mta = AlaveteliConfiguration.mta_log_type.to_sym
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index fd6dc3adcf..8ec9dd5bcf 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -955,6 +955,7 @@ def self.get_public_body_list_translated_condition(table, has_first_letter=false
result += " AND #{table}.locale = :locale" if locale
result
end
+ private_class_method :get_public_body_list_translated_condition
def update_missing_email_tag
if missing_email? && !defunct?
From 348d80527a035b66207a2fedaa592bd06913d4b0 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 14 Apr 2023 17:06:23 +0100
Subject: [PATCH 279/289] style: Lint/ImplicitStringConcatenation RuboCop
---
app/models/incoming_message.rb | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index f91eda86a3..d15d8bb950 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -235,7 +235,7 @@ def self.remove_quoted_sections(text, replacement = "FOLDED_QUOTED_SECTION")
# http://www.whatdotheyknow.com/request/71/response/108
# http://www.whatdotheyknow.com/request/police_powers_to_inform_car_insu
# http://www.whatdotheyknow.com/request/secured_convictions_aided_by_cct
- multiline_original_message = '(' + '''>>>.* \d\d/\d\d/\d\d\d\d\s+\d\d:\d\d(?::\d\d)?\s*>>>''' + ')'
+ multiline_original_message = '(>>>.* \d\d/\d\d/\d\d\d\d\s+\d\d:\d\d(?::\d\d)?\s*>>>)'
text.gsub!(/^(#{multiline_original_message}\n.*)$/m, replacement)
# On Thu, Nov 28, 2013 at 9:08 AM, A User
@@ -278,12 +278,13 @@ def self.remove_quoted_sections(text, replacement = "FOLDED_QUOTED_SECTION")
# http://www.whatdotheyknow.com/request/123/response/192
# http://www.whatdotheyknow.com/request/235/response/513
# http://www.whatdotheyknow.com/request/445/response/743
- original_message =
- '(' + '''----* This is a copy of the message, including all the headers. ----*''' \
- '|' + '''----*\s*Original Message\s*----*''' \
- '|' + '''----*\s*Forwarded message.+----*''' \
- '|' + '''----*\s*Forwarded by.+----*''' \
- ')'
+ message_section_strings = [
+ '----* This is a copy of the message, including all the headers. ----*',
+ '----*\s*Original Message\s*----*',
+ '----*\s*Forwarded message.+----*',
+ '----*\s*Forwarded by.+----*'
+ ]
+ original_message = "(#{message_section_strings.join('|')})"
# Could have a ^ at start here, but see messed up formatting here:
# http://www.whatdotheyknow.com/request/refuse_and_recycling_collection#incoming-842
text.gsub!(/(#{original_message}\n.*)$/mi, replacement)
From 08ffda92e01d181f53c043783be4a6e4e92be597 Mon Sep 17 00:00:00 2001
From: Alexander Griffen
Date: Fri, 21 Apr 2023 14:41:04 +0100
Subject: [PATCH 280/289] style: Lint/ShadowingOuterVariable RuboCop
Manual changes made to variable names
---
app/controllers/api_controller.rb | 12 ++++++------
app/models/info_request.rb | 4 ++--
app/models/outgoing_message.rb | 2 +-
lib/alaveteli_text_masker.rb | 4 ++--
.../alaveteli_rate_limiter/ip_rate_limiter_spec.rb | 4 ++--
spec/mailers/alaveteli_pro/embargo_mailer_spec.rb | 4 ++--
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index d5d9521d98..6dd05e2365 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -244,18 +244,18 @@ def body_request_events
render template: "api/request_events", formats: [:atom], layout: false
elsif feed_type == "json"
@event_data = []
- @events.each do |event|
+ @events.each do |json_event|
- request = event.info_request
+ request = json_event.info_request
this_event = {
request_id: request.id,
- event_id: event.id,
- created_at: event.created_at.iso8601,
- event_type: event.event_type,
+ event_id: json_event.id,
+ created_at: json_event.created_at.iso8601,
+ event_type: json_event.event_type,
request_url: request_url(request),
request_email: request.incoming_email,
title: request.title,
- body: event.outgoing_message.body,
+ body: json_event.outgoing_message.body,
user_name: request.user_name
}
this_event[:user_url] = user_url(request.user) if request.user
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 57e37d0c98..b64c356986 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1475,12 +1475,12 @@ def applicable_censor_rules
def apply_censor_rules_to_text(text)
applicable_censor_rules.
- reduce(text) { |text, rule| rule.apply_to_text(text) }
+ reduce(text) { |t, rule| rule.apply_to_text(t) }
end
def apply_censor_rules_to_binary(text)
applicable_censor_rules.
- reduce(text) { |text, rule| rule.apply_to_binary(text) }
+ reduce(text) { |t, rule| rule.apply_to_binary(t) }
end
def apply_masks(text, content_type)
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 1e97e8b8bf..434384deb4 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -191,7 +191,7 @@ def body(options = {})
info_request.try(:applicable_censor_rules) or []
end
- censor_rules.reduce(text) { |text, rule| rule.apply_to_text(text) }
+ censor_rules.reduce(text) { |t, rule| rule.apply_to_text(t) }
end
def raw_body
diff --git a/lib/alaveteli_text_masker.rb b/lib/alaveteli_text_masker.rb
index b9496b4a3b..a0dd232daf 100644
--- a/lib/alaveteli_text_masker.rb
+++ b/lib/alaveteli_text_masker.rb
@@ -147,7 +147,7 @@ def apply_binary_masks(text, options = {})
# Replace censor items
censor_rules = options[:censor_rules] || []
- text = censor_rules.reduce(text) { |text, rule| rule.apply_to_binary(text) }
+ text = censor_rules.reduce(text) { |t, rule| rule.apply_to_binary(t) }
raise "internal error in apply_binary_masks" if text.bytesize != orig_size
text
@@ -173,7 +173,7 @@ def apply_text_masks(text, options = {})
memo.gsub(mask[:to_replace], mask[:replacement])
end
- censor_rules.reduce(text) { |text, rule| rule.apply_to_text(text) }
+ censor_rules.reduce(text) { |t, rule| rule.apply_to_text(t) }
end
end
diff --git a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
index bd6f584f5f..0b00382fac 100644
--- a/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
+++ b/spec/lib/alaveteli_rate_limiter/ip_rate_limiter_spec.rb
@@ -19,8 +19,8 @@
defaults = AlaveteliRateLimiter::IPRateLimiter::Defaults.
new(whitelist: whitelist)
- described_class.set_defaults do |defaults|
- defaults.whitelist = whitelist
+ described_class.set_defaults do |d|
+ d.whitelist = whitelist
end
expect(described_class.defaults).to eq(defaults)
diff --git a/spec/mailers/alaveteli_pro/embargo_mailer_spec.rb b/spec/mailers/alaveteli_pro/embargo_mailer_spec.rb
index 74958b297e..c5de3f7499 100644
--- a/spec/mailers/alaveteli_pro/embargo_mailer_spec.rb
+++ b/spec/mailers/alaveteli_pro/embargo_mailer_spec.rb
@@ -103,7 +103,7 @@
AlaveteliPro::EmbargoMailer.alert_expiring
mails = ActionMailer::Base.deliveries
- mail = mails.detect { |mail| mail.to == [pro_user_3.email] }
+ mail = mails.detect { |m| m.to == [pro_user_3.email] }
expect(mail).to be nil
end
end
@@ -228,7 +228,7 @@
AlaveteliPro::EmbargoMailer.alert_expired
mails = ActionMailer::Base.deliveries
- mail = mails.detect { |mail| mail.to == [pro_user_3.email] }
+ mail = mails.detect { |m| m.to == [pro_user_3.email] }
expect(mail).to be nil
end
end
From e8c5ec0c5fbc0f6edac2ad6d1a66231cd323983e Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 21 Apr 2023 17:14:21 +0100
Subject: [PATCH 281/289] Update default Ruby check
Allow the preferred version to be specified in `.ruby-verison` file
rather then the example file.
This will allow re-users to upgrade to a later version of Ruby without
changing a core file and possibly causing Git warnings:
`cannot pull with rebase: You have unstaged changes`
---
script/site-specific-install.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index db02316e16..6b399516d6 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -199,7 +199,11 @@ fi
# Ensure we have required Ruby version from the current distribution package, if
# not then install using rbenv
-required_ruby="$(cat $REPOSITORY/.ruby-version.example)"
+if [ -f $REPOSITORY/.ruby-version ]; then
+ required_ruby="$(cat $REPOSITORY/.ruby-version)"
+else
+ required_ruby="$(cat $REPOSITORY/.ruby-version.example)"
+fi
current_ruby="$(ruby --version | awk 'match($0, /[0-9\.]+/) {print substr($0,RSTART,RLENGTH)}')"
if [ "$(printf '%s\n' "$required_ruby" "$current_ruby" | sort -V | head -n1)" = "$required_ruby" ]; then
echo "Current Ruby (${current_ruby}) is greater than or equal to required version (${required_ruby})"
From 831f1b7fcd2ab3b8dc35c7cec289c8db0e497d53 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 18 Apr 2023 16:03:19 +0100
Subject: [PATCH 282/289] Remove cls attribute
This attribute is unused and removing this will make future refactoring
easier.
---
app/helpers/link_to_helper.rb | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index d8f151f769..95c29772d3 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -18,8 +18,8 @@ def request_path(info_request, options = {})
request_url(info_request, options.merge(only_path: true))
end
- def request_link(info_request, cls=nil)
- link_to info_request.title, request_path(info_request), class: cls
+ def request_link(info_request)
+ link_to info_request.title, request_path(info_request)
end
def request_details_path(info_request)
@@ -104,8 +104,8 @@ def public_body_link_short(public_body)
link_to public_body.short_or_long_name, public_body_path(public_body)
end
- def public_body_link(public_body, cls=nil)
- link_to public_body.name, public_body_path(public_body), class: cls
+ def public_body_link(public_body)
+ link_to public_body.name, public_body_path(public_body)
end
def public_body_link_absolute(public_body) # e.g. for in RSS
@@ -121,11 +121,11 @@ def user_path(user, options = {})
user_url(user, options.merge(only_path: true))
end
- def user_link(user, cls=nil)
- link_to user.name, user_path(user), class: cls
+ def user_link(user)
+ link_to user.name, user_path(user)
end
- def user_link_for_request(request, cls=nil)
+ def user_link_for_request(request)
if request.is_external?
user_name = request.external_user_name || _("Anonymous user")
if !request.external_url.nil?
@@ -134,7 +134,7 @@ def user_link_for_request(request, cls=nil)
user_name
end
else
- link_to request.user.name, user_path(request.user), class: cls
+ link_to request.user.name, user_path(request.user)
end
end
@@ -203,8 +203,8 @@ def user_or_you_capital_link(user)
link_to user_or_you_capital(user), user_path(user)
end
- def user_admin_link(user, name="admin", cls=nil)
- link_to name, admin_user_url(user), class: cls
+ def user_admin_link(user, name="admin")
+ link_to name, admin_user_url(user)
end
# Tracks. feed can be 'track' or 'feed'
From 340ce527e5ea9320bea890266a1f7b280b709a09 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 18 Apr 2023 16:10:05 +0100
Subject: [PATCH 283/289] Remove absolute attribute
Conform to the conventions set out in `link_to_helper.rb` by creating a
`#external_user_link_absolute` method.
---
app/helpers/link_to_helper.rb | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 95c29772d3..7e1d9d8061 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -154,22 +154,25 @@ def user_link(user)
link_to user.name, user_path(user)
end
- def external_user_link(request, absolute, text)
+ def external_user_link(request, text)
if request.external_user_name
request.external_user_name
else
- if absolute
- url = help_privacy_url(anchor: 'anonymous')
- else
- url = help_privacy_path(anchor: 'anonymous')
- end
- link_to(text, url)
+ link_to(text, help_privacy_path(anchor: 'anonymous'))
+ end
+ end
+
+ def external_user_link_absolute(request, text)
+ if request.external_user_name
+ request.external_user_name
+ else
+ link_to(text, help_privacy_url(anchor: 'anonymous'))
end
end
def request_user_link_absolute(request, anonymous_text=_("Anonymous user"))
if request.is_external?
- external_user_link(request, absolute=true, anonymous_text)
+ external_user_link_absolute(request, anonymous_text)
else
user_link_absolute(request.user)
end
@@ -177,7 +180,7 @@ def request_user_link_absolute(request, anonymous_text=_("Anonymous user"))
def request_user_link(request, anonymous_text=_("Anonymous user"))
if request.is_external?
- external_user_link(request, absolute=false, anonymous_text)
+ external_user_link(request, anonymous_text)
else
user_link(request.user)
end
From 5e4e4c5014f7fe871cc389005faa0e849a951c9d Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Tue, 18 Apr 2023 17:32:10 +0100
Subject: [PATCH 284/289] Remove duplicate method
Reorders the `#user_link_absolute` method too.
---
app/helpers/link_to_helper.rb | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index 7e1d9d8061..a72e3e0734 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -121,6 +121,10 @@ def user_path(user, options = {})
user_url(user, options.merge(only_path: true))
end
+ def user_link_absolute(user)
+ link_to user.name, user_url(user)
+ end
+
def user_link(user)
link_to user.name, user_path(user)
end
@@ -146,14 +150,6 @@ def user_admin_link_for_request(request, external_text=nil, internal_text=nil)
end
end
- def user_link_absolute(user)
- link_to user.name, user_url(user)
- end
-
- def user_link(user)
- link_to user.name, user_path(user)
- end
-
def external_user_link(request, text)
if request.external_user_name
request.external_user_name
From 25deb7a80046b04421d3f08ab47aa2ccfc6b9ac2 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Wed, 19 Apr 2023 09:20:41 +0100
Subject: [PATCH 285/289] Move default anonymous user text
This allows the `#external_user_link` and `#external_user_link_absolute`
methods to be called without the second argument.
---
app/helpers/link_to_helper.rb | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb
index a72e3e0734..522e4c33a1 100755
--- a/app/helpers/link_to_helper.rb
+++ b/app/helpers/link_to_helper.rb
@@ -150,23 +150,25 @@ def user_admin_link_for_request(request, external_text=nil, internal_text=nil)
end
end
- def external_user_link(request, text)
+ def external_user_link(request, text = nil)
if request.external_user_name
request.external_user_name
else
+ text ||= _("Anonymous user")
link_to(text, help_privacy_path(anchor: 'anonymous'))
end
end
- def external_user_link_absolute(request, text)
+ def external_user_link_absolute(request, text = nil)
if request.external_user_name
request.external_user_name
else
+ text ||= _("Anonymous user")
link_to(text, help_privacy_url(anchor: 'anonymous'))
end
end
- def request_user_link_absolute(request, anonymous_text=_("Anonymous user"))
+ def request_user_link_absolute(request, anonymous_text = nil)
if request.is_external?
external_user_link_absolute(request, anonymous_text)
else
@@ -174,7 +176,7 @@ def request_user_link_absolute(request, anonymous_text=_("Anonymous user"))
end
end
- def request_user_link(request, anonymous_text=_("Anonymous user"))
+ def request_user_link(request, anonymous_text = nil)
if request.is_external?
external_user_link(request, anonymous_text)
else
From 52518784a4938b71e0f2dc427ef68fd3364326a8 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 20 Apr 2023 14:22:01 +0100
Subject: [PATCH 286/289] Update changelog
---
doc/CHANGES.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 88 insertions(+), 1 deletion(-)
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 79fe0e53d7..110f76542e 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -2,28 +2,115 @@
## Highlighted Features
+* Improve censor rules comment editing (Alexander Griffen)
* Reduce the visual prominence of defunct bodies in lists (Gareth Rees)
+* Improve application health metrics (Graeme Porteous)
+* Add ability to display blog posts on request/authority page sidebars using
+ tags (Graeme Porteous)
+* Adding localisation to resent notice (Miroslav Schlossberg, Graeme Porteous)
* Add ability to paginate through requests in a batch (Gareth Rees)
* Add list of batch requests to admin user page (Gareth Rees)
* Add daily limit to user message creation (Gareth Rees)
+* Add project leaderboards (Alexander Griffen)
+* Add background job processing (Graeme Porteous)
* Add rate limiting to comment creation (Gareth Rees)
* Fix bug preventing ex-pro users follow up to still-private requests (Gareth
Rees, Graeme Porteous)
* Make it clearer that usernames are published (Gareth Rees)
* Add spam term checking to user to user messages (Gareth Rees)
+* Install script improvements (Graeme Porteous)
+* Update passenger config (Graeme Porteous)
+* Removed legacy event params (Graeme Porteous)
+* Removed legacy notes (Graeme Porteous)
+* Fix rendering of notes on request new (Graeme Porteous)
* Add support for Ruby 3.2 (Graeme Porteous)
* Add support for Ruby 3.1 (Graeme Porteous)
* Upgrade to Rails 7 (Graeme Porteous)
* Improve processing of large PDF attachments (Graeme Porteous)
* Add support for Ruby 3.0 (Graeme Porteous)
* Drop support for Ruby 2.7 (Graeme Porteous)
+* Code linting (Alexander Griffen, Graeme Porteous)
+* Dependencies upgrades (Alexander Griffen, Graeme Porteous)
## Upgrade Notes
-* To upgrade the Ruby version in your development Docker container please run:
+* _Required:_ This upgrade requires upgrading Ruby from 2.7 to 3.x. Alaveteli
+ can now run on all supported 3.x versions. We recommend upgrading to the 3.2.
+ See: https://github.com/mysociety/alaveteli/wiki/Migrating-an-existing-Alaveteli-site-from-Ruby-2.7-to-3.x
+
+* _Required:_ For the new background job processing feature you'll need Redis
+ Server, a popular open-source in-memory data store. And you'll need Sidekiq
+ an efficient background job processor for Ruby:
+
+ 1. install Redis Server by running:
+
+ sudo apt-get install redis-server
+
+ 2. configure Sidekiq to run when your server starts by creating
+ `/etc/systemd/system/sidekiq.service` from `config/sidekiq.service.example`.
+ And running:
+
+ systemctl enable sidekiq.service
+ systemctl daemon-reload
+
+* _Required:_ There are some database structure updates so remember to run:
+
+ bin/rails db:migrate
+
+* _Optional:_ To upgrade the Ruby version in your development Docker container
+ please run:
docker/reset
+* _Note:_ This release will be the last to support anonymous "external requests"
+ created by the API. If you rely on the API to create or update requests then
+ please contact us as it is our current intention to make the API read-only for
+ the next release.
+
+* _Note:_ This release will be the last to officially support Ubuntu Focal
+ 20.04. With the next release we will recommend using Ubuntu Jammy 22.04 LTS.
+ Although using Focal might still work as it will still be within Ubuntu's
+ long term support window. Please bear this in mind for future upgrades.
+
+### Changed Templates
+
+app/views/admin/tags/_tagging.html.erb
+app/views/admin/users/_sign_in_table.html.erb
+app/views/admin_censor_rule/_form.html.erb
+app/views/admin_censor_rule/_list.html.erb
+app/views/admin_censor_rule/index.html.erb
+app/views/admin_comment/edit.html.erb
+app/views/admin_general/_admin_navbar.html.erb
+app/views/admin_general/_edit_comment.html.erb
+app/views/admin_general/stats.html.erb
+app/views/admin_public_body/_public_body.html.erb
+app/views/admin_public_body/show.html.erb
+app/views/admin_request/show.html.erb
+app/views/admin_user/edit.html.erb
+app/views/admin_user/show.html.erb
+app/views/alaveteli_pro/general/_nav_items.html.erb
+app/views/alaveteli_pro/info_request_batches/_message_preview.html.erb
+app/views/alaveteli_pro/info_requests/_batch.html.erb
+app/views/alaveteli_pro/info_requests/_message_preview.html.erb
+app/views/alaveteli_pro/info_requests/_select_authority_form.html.erb
+app/views/alaveteli_pro/info_requests/_sidebar.html.erb
+app/views/alaveteli_pro/info_requests/new.html.erb
+app/views/alaveteli_pro/plans/_pricing_tiers.html.erb
+app/views/comment/rate_limited.html.erb
+app/views/general/_nav_items.html.erb
+app/views/general/blog.html.erb
+app/views/general/frontpage.html.erb
+app/views/health/checks/index.html.erb
+app/views/projects/projects/show.html.erb
+app/views/public_body/_body_listing_single.html.erb
+app/views/public_body/show.html.erb
+app/views/request/_batch.html.erb
+app/views/request/_resent_outgoing_correspondence.html.erb
+app/views/request/_resent_outgoing_correspondence.text.erb
+app/views/request/_sidebar.html.erb
+app/views/request/new.html.erb
+app/views/request/preview.html.erb
+
# 0.42.0.1
## Highlighted Features
From 5cd82f7d682e4fdc6a38342ccf33cc9cc8a0e6f3 Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 20 Apr 2023 14:22:35 +0100
Subject: [PATCH 287/289] Remove temporary rake tasks
These should've been run while upgrading to 0.41 or 0.42.
---
lib/tasks/temp.rake | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake
index 26510d6cc3..502952a811 100644
--- a/lib/tasks/temp.rake
+++ b/lib/tasks/temp.rake
@@ -1,22 +1,2 @@
namespace :temp do
- desc 'Populate incoming message from email'
- task populate_incoming_message_from_email: :environment do
- scope = IncomingMessage.where(from_email: nil)
- count = scope.count
-
- scope.includes(:raw_email).find_each.with_index do |message, index|
- message.update_columns(from_email: message.raw_email.from_email || '')
-
- erase_line
- print "Populated IncomingMessage#from_email #{index + 1}/#{count}"
- end
-
- erase_line
- puts "Populated IncomingMessage#from_email completed."
- end
-
- def erase_line
- # https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences
- print "\e[1G\e[K"
- end
end
From 7dc0d55382be1a8d44369b20c78c923449df377c Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Thu, 20 Apr 2023 14:38:38 +0100
Subject: [PATCH 288/289] Generate translations
---
locale/af_ZA/app.po | 83 +++++++++++++++++++++++++++++++-
locale/aln/app.po | 83 +++++++++++++++++++++++++++++++-
locale/app.pot | 82 +++++++++++++++++++++++++++++++-
locale/ar/app.po | 83 +++++++++++++++++++++++++++++++-
locale/bg/app.po | 83 +++++++++++++++++++++++++++++++-
locale/bs/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ca/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ckb/app.po | 83 +++++++++++++++++++++++++++++++-
locale/cs/app.po | 85 ++++++++++++++++++++++++++++++++-
locale/cy/app.po | 83 +++++++++++++++++++++++++++++++-
locale/de/app.po | 83 +++++++++++++++++++++++++++++++-
locale/el/app.po | 83 +++++++++++++++++++++++++++++++-
locale/en/app.po | 82 +++++++++++++++++++++++++++++++-
locale/en_HK/app.po | 83 +++++++++++++++++++++++++++++++-
locale/en_IE/app.po | 83 +++++++++++++++++++++++++++++++-
locale/en_RW/app.po | 82 +++++++++++++++++++++++++++++++-
locale/en_UG/app.po | 83 +++++++++++++++++++++++++++++++-
locale/en_US/app.po | 83 +++++++++++++++++++++++++++++++-
locale/es/app.po | 83 +++++++++++++++++++++++++++++++-
locale/es_AR/app.po | 83 +++++++++++++++++++++++++++++++-
locale/es_NI/app.po | 83 +++++++++++++++++++++++++++++++-
locale/es_PA/app.po | 83 +++++++++++++++++++++++++++++++-
locale/es_PY/app.po | 83 +++++++++++++++++++++++++++++++-
locale/eu/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fa/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fi/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fr/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fr_BE/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fr_CA/app.po | 83 +++++++++++++++++++++++++++++++-
locale/fr_FR/app.po | 85 ++++++++++++++++++++++++++++++++-
locale/ga_IE/app.po | 83 +++++++++++++++++++++++++++++++-
locale/gl/app.po | 83 +++++++++++++++++++++++++++++++-
locale/he_IL/app.po | 83 +++++++++++++++++++++++++++++++-
locale/hr/app.po | 85 ++++++++++++++++++++++++++++++++-
locale/hu_HU/app.po | 83 +++++++++++++++++++++++++++++++-
locale/id/app.po | 83 +++++++++++++++++++++++++++++++-
locale/is/app.po | 85 ++++++++++++++++++++++++++++++++-
locale/is_IS/app.po | 83 +++++++++++++++++++++++++++++++-
locale/it/app.po | 83 +++++++++++++++++++++++++++++++-
locale/it_IT/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ka/app.po | 85 ++++++++++++++++++++++++++++++++-
locale/mk/app.po | 83 +++++++++++++++++++++++++++++++-
locale/mk_MK/app.po | 83 +++++++++++++++++++++++++++++++-
locale/nb/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ne/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ne_NP/app.po | 83 +++++++++++++++++++++++++++++++-
locale/nl/app.po | 83 +++++++++++++++++++++++++++++++-
locale/nl_BE/app.po | 83 +++++++++++++++++++++++++++++++-
locale/nn/app.po | 83 +++++++++++++++++++++++++++++++-
locale/pap/app.po | 83 +++++++++++++++++++++++++++++++-
locale/pl/app.po | 83 +++++++++++++++++++++++++++++++-
locale/pt_BR/app.po | 83 +++++++++++++++++++++++++++++++-
locale/pt_PT/app.po | 83 +++++++++++++++++++++++++++++++-
locale/ro_RO/app.po | 83 +++++++++++++++++++++++++++++++-
locale/rw/app.po | 83 +++++++++++++++++++++++++++++++-
locale/se/app.po | 83 +++++++++++++++++++++++++++++++-
locale/si/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sk/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sl/app.po | 86 +++++++++++++++++++++++++++++++++-
locale/sq/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sr/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sr@latin/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sv/app.po | 83 +++++++++++++++++++++++++++++++-
locale/sw_KE/app.po | 83 +++++++++++++++++++++++++++++++-
locale/tr/app.po | 83 +++++++++++++++++++++++++++++++-
locale/tr_TR/app.po | 83 +++++++++++++++++++++++++++++++-
locale/uk/app.po | 83 +++++++++++++++++++++++++++++++-
locale/vi/app.po | 83 +++++++++++++++++++++++++++++++-
locale/yue/app.po | 83 +++++++++++++++++++++++++++++++-
locale/zh_CN/app.po | 83 +++++++++++++++++++++++++++++++-
locale/zh_HK/app.po | 83 +++++++++++++++++++++++++++++++-
locale_alaveteli_pro/app.pot | 8 ++--
locale_alaveteli_pro/en/app.po | 8 ++--
73 files changed, 5835 insertions(+), 84 deletions(-)
diff --git a/locale/af_ZA/app.po b/locale/af_ZA/app.po
index cb8077a351..67242268ee 100644
--- a/locale/af_ZA/app.po
+++ b/locale/af_ZA/app.po
@@ -31,13 +31,14 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# FOI Monkey, 2022
# FOI Monkey, 2022
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: FOI Monkey, 2022\n"
"Language-Team: Afrikaans (South Africa) (http://app.transifex.com/mysociety/al"
@@ -445,6 +446,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -607,6 +611,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -670,6 +677,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -934,6 +944,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -1003,6 +1016,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1530,6 +1546,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2204,6 +2223,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Onthou my op hierdie rekanaar"
@@ -2390,6 +2412,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2426,6 +2451,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2491,6 +2540,9 @@ msgstr "Meld af"
msgid "Sign up"
msgstr "Registreer"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2545,6 +2597,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2962,9 +3017,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3185,6 +3246,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3311,9 +3375,15 @@ msgstr "Vandag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3660,6 +3730,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Ja"
@@ -3789,6 +3862,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4409,6 +4485,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/aln/app.po b/locale/aln/app.po
index 22f9f9519b..4d917401c6 100644
--- a/locale/aln/app.po
+++ b/locale/aln/app.po
@@ -31,13 +31,14 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Valon , 2011
# Valon , 2011
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Valon , 2011\n"
"Language-Team: Albanian Gheg (http://app.transifex.com/mysociety/alaveteli/lan"
@@ -438,6 +439,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -600,6 +604,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -663,6 +670,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -927,6 +937,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -996,6 +1009,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1523,6 +1539,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2197,6 +2216,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2383,6 +2405,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2419,6 +2444,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2484,6 +2533,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2538,6 +2590,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2955,9 +3010,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3178,6 +3239,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3304,9 +3368,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3653,6 +3723,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3782,6 +3855,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4402,6 +4478,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/app.pot b/locale/app.pot
index 4ba73e0c8c..d81fbc0cae 100644
--- a/locale/app.pot
+++ b/locale/app.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-10-09 01:10+0200\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -406,6 +406,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -568,6 +571,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -631,6 +637,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -895,6 +904,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -964,6 +976,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1491,6 +1506,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2165,6 +2183,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2351,6 +2372,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2387,6 +2411,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2452,6 +2500,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2506,6 +2557,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2923,9 +2977,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3146,6 +3206,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3272,9 +3335,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3621,6 +3690,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3750,6 +3822,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4370,6 +4445,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/ar/app.po b/locale/ar/app.po
index 002343139b..a6abe272a6 100644
--- a/locale/ar/app.po
+++ b/locale/ar/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Aladdin El-Haraty , 2012
# Aladdin El-Haraty , 2012
# Aladdin El-Haraty , 2012
@@ -50,7 +51,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: , 2013\n"
"Language-Team: Arabic (http://app.transifex.com/mysociety/alaveteli/language/a"
@@ -489,6 +490,9 @@ msgstr "يمكن ان تستند كل الخيارات اسفله على your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1609,6 +1625,9 @@ msgstr "آخر مطلب وقع الإطلاع عليه: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2296,6 +2315,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2485,6 +2507,9 @@ msgstr "البحث عن مساهماتك"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "ابعث متابعة "
@@ -2521,6 +2546,30 @@ msgstr "ابعث رسالة ل {{user_name}} فقط لمشاهدة كيفية ا
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2586,6 +2635,9 @@ msgstr "تسجيل الخروج"
msgid "Sign up"
msgstr "اشترك"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2646,6 +2698,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3073,9 +3128,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "عدد المطالب التي بامكانك تقديمها في اليوم الواحد محدود, لاننا لاننا لا تريد ان تكثر على السلطات العامة الطلبات الغير ملائمة. ان كان لديك سبب وجيه لتسألهم الترفيع في العدد المحدد للطلبات في حالتك, الرجاء الاتصال بنا."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3305,6 +3366,9 @@ msgstr ""
"سرعة رد السلطات على الطلبات , عدد الطلبات\n"
"التي تسوجب ردا بريديا و اكثر ."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3437,9 +3501,15 @@ msgstr "اليوم"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "طلبات كثيرة جدا"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3808,6 +3878,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "اكتب طلبك بلغة بسيطة ودقيقة."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3937,6 +4010,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "لقد بلغت السقف الأقصى للطلبات الجديدة. المستخدمون محددون عادة ب {{max_requests_per_user_per_day}} طلب في كل 24 ساعة. ستتمكن من القيام بطلب جديد خلال{{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4580,6 +4656,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/bg/app.po b/locale/bg/app.po
index 9b057ee1f4..f4815f0a2f 100644
--- a/locale/bg/app.po
+++ b/locale/bg/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Anton Stoychev , 2013
# Anton Stoychev , 2013
# Liz Conlan , 2018
@@ -41,7 +42,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: louisecrow , 2014\n"
"Language-Team: Bulgarian (http://app.transifex.com/mysociety/alaveteli/languag"
@@ -482,6 +483,9 @@ msgstr "Всички опции по-долу могат да се използ
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -650,6 +654,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Размножено заявление, създадено от {{info_request_user}} на {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Започващи с"
@@ -713,6 +720,9 @@ msgstr " Спиране на някои известия от {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Отказ и връщане в страницата на профила Ви"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Промяна на имейла в {{site_name}}"
@@ -979,6 +989,9 @@ msgstr "Готово >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Сваляне на zip файл с цялата кореспонденция"
@@ -1052,6 +1065,9 @@ msgstr "История на събитията"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Това, което напишете на тази страница, включително Вашето име,\n"
@@ -1621,6 +1637,9 @@ msgstr "Последно гледано заявление: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2310,6 +2329,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2499,6 +2521,9 @@ msgstr "Търсене в допринесеното от Вас"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Изпращане на пояснително съобщение"
@@ -2535,6 +2560,30 @@ msgstr "Изпращане на съобщение до {{user_name}} само
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Изпратено до един орган от {{info_request_user}} на {{date}}."
@@ -2600,6 +2649,9 @@ msgstr "Изход"
msgid "Sign up"
msgstr "Регистриране"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2660,6 +2712,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3093,9 +3148,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Има ограничение на броя заявления на ден, които може да направите, понеже не желаем публичните органи да бъдат бомбардирани с голям брой неуместни заявления. Ако считате, че имате основателна причина да поискате вдигане на лимита във Вашия случай, молим, уведомете ни."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Все още няма нищо за показване."
@@ -3324,6 +3385,9 @@ msgstr ""
"бързината, с която органите отговарят на заявления, броят на заявленията,\n"
"които изискват отговор по пощата и много други."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3458,9 +3522,15 @@ msgstr "Днес"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Твърде много заявления"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3827,6 +3897,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Напишете заявлението си ясно и конкретно."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3956,6 +4029,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Вие достигнахте лимита за нови заявления. Потребителите обикновено са ограничени до {{max_requests_per_user_per_day}} заявления на всеки 24 часа. Ще можете да отправите друго заявление в {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4605,6 +4681,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/bs/app.po b/locale/bs/app.po
index b65c95fdcc..51a1e51423 100644
--- a/locale/bs/app.po
+++ b/locale/bs/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Krule , 2011
# BORIS , 2011
# BORIS , 2011
@@ -44,7 +45,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: vedad , 2011\n"
"Language-Team: Bosnian (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -472,6 +473,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -640,6 +644,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Počevši sa"
@@ -703,6 +710,9 @@ msgstr "Poništi neka {{site_name}} upozorenja"
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Promijeniti e-mail na {{site_name}}"
@@ -969,6 +979,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Preuzmite svu korespondenciju u zip fajlu"
@@ -1040,6 +1053,9 @@ msgstr "Prikaz prošlih događanja"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Sve što unesete na ovu stranicu, uključujući Vaše ime, \n"
@@ -1602,6 +1618,9 @@ msgstr "Zadnji pregledani zahtjev: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2289,6 +2308,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2475,6 +2497,9 @@ msgstr "Pretražite Vaše doprinose"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2511,6 +2536,30 @@ msgstr "Pošalji poruku {{user_name}} samo da vidite kako radi"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2576,6 +2625,9 @@ msgstr "Odjavite se"
msgid "Sign up"
msgstr "Registrujte se"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2636,6 +2688,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3069,9 +3124,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3294,6 +3355,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3426,9 +3490,15 @@ msgstr "Danas"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3795,6 +3865,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Pišite Vaš zahtjev jednostavnim, preciznim jezikom."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3924,6 +3997,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4554,6 +4630,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/ca/app.po b/locale/ca/app.po
index b2a9c0961f..2e2e32aa8c 100644
--- a/locale/ca/app.po
+++ b/locale/ca/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# David Cabo , 2012,2014
# ecapfri , 2012
# ecapfri , 2012
@@ -43,7 +44,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: mmtarres , 2012\n"
"Language-Team: Catalan (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -487,6 +488,9 @@ msgstr "All the options below can use variety or latest
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -655,6 +659,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Començant per"
@@ -718,6 +725,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -986,6 +996,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarregar un fitxer ZIP amb tota la correspondència"
@@ -1055,6 +1068,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Tot el que escriguis en aquesta pàgina, incloent el teu nom, \n"
@@ -1621,6 +1637,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2309,6 +2328,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2498,6 +2520,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Enviar una resposta"
@@ -2534,6 +2559,30 @@ msgstr "Envia un missatge a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2599,6 +2648,9 @@ msgstr "Tancar sessió"
msgid "Sign up"
msgstr "Registra't"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2659,6 +2711,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3091,9 +3146,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que los organismos públicos reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3322,6 +3383,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de los organismos o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3454,9 +3518,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3819,6 +3889,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escriu la teva sol·licitud en un llenguatge senzill i clar."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3948,6 +4021,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4591,6 +4667,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/ckb/app.po b/locale/ckb/app.po
index cb76b51a19..80dab25c12 100644
--- a/locale/ckb/app.po
+++ b/locale/ckb/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Central Kurdish (http://app.transifex.com/mysociety/alaveteli/l"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/cs/app.po b/locale/cs/app.po
index b565aa0768..3a3db62edf 100644
--- a/locale/cs/app.po
+++ b/locale/cs/app.po
@@ -31,6 +31,8 @@
# Translators:
# Translators:
# Translators:
+# Translators:
+# Appukonrad , 2012
# Appukonrad , 2012
# Graeme Porteous , 2021
# Hana Hunt , 2016-2018,2020-2021
@@ -41,6 +43,7 @@
# janakneschke , 2013
# janakneschke , 2012-2013
# janakneschke , 2013
+# Jiří Podhorecký, 2021
# Appukonrad , 2012,2015-2017
# Jiří Podhorecký, 2021-2022
# josefpospisil , 2012
@@ -57,7 +60,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Jiří Podhorecký, 2021\n"
"Language-Team: Czech (http://app.transifex.com/mysociety/alaveteli/language/cs"
@@ -492,6 +495,9 @@ msgstr "Všechny níže uvedené možnosti variety or l
msgid "All time"
msgstr "Vždy"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Nejlepší hráči"
@@ -656,6 +662,9 @@ msgstr "Odstraněno s těchto stránek"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Dávka vytvořena {{info_request_user}} dne {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Začínající na"
@@ -719,6 +728,9 @@ msgstr "Zrušte tato upozornění stránek {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Zrušit, návrat zpět do stránky s profilem"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Změnit e-mail na stránkách {{site_name}}"
@@ -993,6 +1005,9 @@ msgstr "Hotovo >>"
msgid "Download Data"
msgstr "Stažená data"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Stáhnout zazipovaný soubor celé korespondence"
@@ -1064,6 +1079,9 @@ msgstr "Historie případu"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Každý občan má právo na přístup k informacím veřejných institucí"
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Veškeré informace, které vložíte na tuto stránku, včetně vašeho jména, budou trvaleuveřejněny na tomto webu."
@@ -1614,6 +1632,9 @@ msgstr "Naposled prohlížený dotaz: {{request_url}}"
msgid "Latest"
msgstr "Nejnovější"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Zjistěte více →"
@@ -2299,6 +2320,9 @@ msgstr "Nařízení"
msgid "Rejected"
msgstr "Zamítnuto"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Zapamatovat mé údaje (zašrktněte, pokud chcete být déle přihlášeni; nezaškrtávejte, pokud jste na veřejně přístupném počítači)."
@@ -2488,6 +2512,9 @@ msgstr "Prohledávat vlastní příspěvky"
msgid "Section"
msgstr "Sekce"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Odpovědět"
@@ -2524,6 +2551,30 @@ msgstr "Vznést dotaz na uživatele {{user_name}}. Tímto způsobem si můžete
msgid "Sending..."
msgstr "Odesílá se..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Odešlete {{authority_count}} instituci od {{info_request_user}} dne {{date}}."
@@ -2591,6 +2642,9 @@ msgstr "Odhlásit"
msgid "Sign up"
msgstr "Registrovat"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2650,6 +2704,9 @@ msgstr "Omlouváme se, teď nelze přídávat nové komentáře. Prosím zkuste
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Omlouváme se, teď nelze poslat vaši žádost. Prosím zkuste to později. "
@@ -3079,9 +3136,15 @@ msgstr "Tuto stránku používá více než jedna osoba s tímt
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Počet dotazů za jeden den je limitován. Nechceme, aby byly instituce bombardovány velkým množstvím nerelevantních dotazů. Pokud máte dobrý důvod, proč by měl být váš limit navýšen, prosímekontaktujte nás."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Zatím tu nic není"
@@ -3310,6 +3373,9 @@ msgstr "Sekce se statistickými informacemi o institucích je v současnosti v t
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Tato tabulka ukazuje technické detaily související s tímto dotazem vzneseným na stránkách {{site_name}}. Tento přehled lze použít k analýze rychlosti, s jakou instituce odpovídají na dotazy, počtu dotazů, které byly zodpovězeny poštou atd. "
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Tomuto uživateli byl zablokován přístup na stránky {{site_name}} "
@@ -3442,9 +3508,15 @@ msgstr "Dnes"
msgid "Too many annotations"
msgstr "Příliš mnoho poznámek"
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Příliš mnoho dotazů"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Nejlepší hráči"
@@ -3813,6 +3885,9 @@ msgstr ""
"Svůj dotaz formulujte v jasných bodech. \n"
"Pokud žádáte o více nesouvisejících informací, rozdělte je do více dotazů. "
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Ano"
@@ -3948,6 +4023,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Dosáhli jste početního limitu stanoveného pro nové dotazy. Uživatelé mohou podat {{max_requests_per_user_per_day}} dotazů během 24 hodin. Nový dotaz můžete podat za {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Opustili jste tento projekt"
@@ -4621,6 +4699,11 @@ msgstr[1] "{{number_of_comments}} připomínky"
msgstr[2] "{{number_of_comments}} připomínek"
msgstr[3] "{{number_of_comments}} připomínek"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} dotaz"
diff --git a/locale/cy/app.po b/locale/cy/app.po
index 7b712754b9..29dade8740 100644
--- a/locale/cy/app.po
+++ b/locale/cy/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Cymrodor , 2014,2017
# Cymrodor , 2014
# skenaja , 2011-2012
@@ -54,7 +55,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: PerryX , 2013\n"
"Language-Team: Welsh (http://app.transifex.com/mysociety/alaveteli/language/cy"
@@ -463,6 +464,9 @@ msgstr "Gall yr holl opsiynau isod defnyddio variety neu >"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Lawrlwytho ffeil zip o bob gohebiaeth"
@@ -1021,6 +1034,9 @@ msgstr "Hanes y digwyddiad"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Dangosir popeth yr ydych yn rhoi i mewn ar y dudalen hon, gan gynnwys eich enw, yn gyhoeddus ar y wefan hon am byth (pam?)."
@@ -1556,6 +1572,9 @@ msgstr "Y cais diwethaf edrychwyd arno: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Dysgu mwy →"
@@ -2230,6 +2249,9 @@ msgstr ""
msgid "Rejected"
msgstr "Gwrthodwyd"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2416,6 +2438,9 @@ msgstr "Chwilio eich cyfraniadau"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Anfon neges ddilynol"
@@ -2452,6 +2477,30 @@ msgstr "Anfon neges i {{user_name}} dim ond i weld sut mae'n gweithio"
msgid "Sending..."
msgstr "Yn anfon..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Anfonwyd at un awdurdod gan {{info_request_user}} ar {{date}}."
@@ -2519,6 +2568,9 @@ msgstr "Allgofnodwch"
msgid "Sign up"
msgstr "Cofrestrwch"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2573,6 +2625,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2990,9 +3045,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Mae cyfyngiad ar y nifer o geisiadau y gallwch eu gwneud mewn diwrnod, oherwydd nid ydym am i awdurdodau cyhoeddus gael eu peledu gyda nifer fawr o geisiadau amhriodol. Os ydych yn teimlo bod gennych reswm da dros ofyn i'r terfyn gael ei godi yn eich achos chi, cysylltwch â ni."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Does dim i'w ddangos eto."
@@ -3215,6 +3276,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Mae'r tabl hwn yn dangos manylion technegol y digwyddiadau mewnol a ddigwyddodd i'r cais hwn ar {{site_name}}. Gallai hwn gael ei ddefnyddio i gynhyrchu gwybodaeth am ba mor gyflym y mae awdurdodau yn ymateb i geisiadau, nifer y ceisiadau sy'n gofyn am ymateb drwy'r post a llawer mwy."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3341,9 +3405,15 @@ msgstr "Heddiw"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Gormod o geisiadau"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3690,6 +3760,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Ysgrifennwch eich cais mewn iaith syml, gryno."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3819,6 +3892,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Rydych chi wedi cyrraedd y terfyn cyfradd ar geisiadau newydd. Fel arfer cyfyngir defnyddwyr i {{max_requests_per_user_per_day}} cais mewn unrhyw gyfnod treigl 24-awr. Byddwch yn gallu gwneud cais arall ymhen {{ can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4455,6 +4531,11 @@ msgstr[1] "{{number_of_comments}} sylw"
msgstr[2] "{{number_of_comments}} sylw"
msgstr[3] "{{number_of_comments}} sylw"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} cais"
diff --git a/locale/de/app.po b/locale/de/app.po
index a4bcf5fdc6..d0bf72b7c5 100644
--- a/locale/de/app.po
+++ b/locale/de/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# andreas.pavlou , 2016
# andreas.pavlou , 2016
# arne , 2015-2016
@@ -48,7 +49,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: stefanw , 2011\n"
"Language-Team: German (http://app.transifex.com/mysociety/alaveteli/language/d"
@@ -478,6 +479,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -644,6 +648,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Mit Anfangsbuchstabe"
@@ -707,6 +714,9 @@ msgstr "Einige Benachrichtigungen für {{site_name}} abbestellen"
msgid "Cancel, return to your profile page"
msgstr "Abbrechen, zurück zur Profilseite"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Email ändern auf {{site_name}}"
@@ -973,6 +983,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Laden Sie eine Zip-Datei des gesamten Schriftverkehrs herunter."
@@ -1044,6 +1057,9 @@ msgstr "Verlaufsübersicht"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Jegliche auf dieser Seite eingegebene Information, inklusive Ihrem Namen, ⏎ wird\n"
@@ -1581,6 +1597,9 @@ msgstr "Zuletzt angesehene Anfrage: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Mehr erfahren"
@@ -2258,6 +2277,9 @@ msgstr ""
msgid "Rejected"
msgstr "Abgelehnt"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Login speichern (Sie bleiben eingeloggt. Nutzen Sie diese Funktion nicht an öffentlichen Computern) "
@@ -2447,6 +2469,9 @@ msgstr "Suchen Sie Ihre Beiträge"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Nachfrage senden"
@@ -2483,6 +2508,30 @@ msgstr "Nachricht senden an {{user_name}} um zu sehen wie es funktioniert"
msgid "Sending..."
msgstr "Senden..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2548,6 +2597,9 @@ msgstr "Ausloggen"
msgid "Sign up"
msgstr "Benutzerkonto erstellen"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2604,6 +2656,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3021,9 +3076,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3246,6 +3307,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3374,9 +3438,15 @@ msgstr "Heute"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Zu viele Anfragen"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3726,6 +3796,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Formulieren Sie Ihre Anfrage in schlicht und präzise ."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3855,6 +3928,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4484,6 +4560,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/el/app.po b/locale/el/app.po
index 008d14dcba..81dd461146 100644
--- a/locale/el/app.po
+++ b/locale/el/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Andreas Nedelkos , 2017
# Graeme Porteous , 2021
# Maria Nathanail , 2021
@@ -42,7 +43,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: ΜΑΡΙΑ ΝΑΘΑΝΑΗΛ , 2021\n"
"Language-Team: Greek (http://app.transifex.com/mysociety/alaveteli/language/el"
@@ -453,6 +454,9 @@ msgstr "Όλες οι επιλογές παρακάτω μπορούν να χρ
msgid "All time"
msgstr "Όλων των εποχών"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Καλύτεροι παίκτες όλων των εποχών"
@@ -615,6 +619,9 @@ msgstr "Έχει εκδιωχτεί από αυτό το site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Παρτίδα που δημιουργήθηκε από {{info_request_user}} στις {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Ξεκινώντας με"
@@ -678,6 +685,9 @@ msgstr "Ακυρώστε κάποιες ειδοποιήσεις από το {{s
msgid "Cancel, return to your profile page"
msgstr "Ακυρώστε, επιστρέψτε στη σελίδα του προφίλ σας"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Αλλάξτε email στο {{site_name}}"
@@ -942,6 +952,9 @@ msgstr "Ολοκληρώθηκε >>"
msgid "Download Data"
msgstr "Κατεβάστε δεδομένα"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Κατεβάστε ένα αρχείο zip με όλη την αλληλογραφία"
@@ -1011,6 +1024,9 @@ msgstr "Ιστορικό συμβάντων"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Κάθε πολίτης έχει το δικαίωμα να αποκτήσει πληροφορίες από δημόσιους οργανισμούς."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Οτιδήποτε εισάγετε σε αυτή την σελίδα, συμπεριλαμβανομένου του ονόματός σας, θα εμφανίζετε δημόσια σε αυτή την ιστοσελίδα για πάντα"
@@ -1543,6 +1559,9 @@ msgstr "Τελευταία αίτηση που είδατε: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Μάθετε περισσότερα →"
@@ -2217,6 +2236,9 @@ msgstr ""
msgid "Rejected"
msgstr "Έχει απορριφθεί"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Να με θυμάσαι (σας κρατά συνδεδεμένο για μεγαλύτερο χρονικό διάστημα, μην το χρησιμοποιείτε σε δημόσιο υπολογιστή)"
@@ -2403,6 +2425,9 @@ msgstr "Αναζητήστε τις συνεισφορές σας"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Στείλτε ένα followup"
@@ -2439,6 +2464,30 @@ msgstr "Αποστολή μηνύματος στον {{user_name}} για να
msgid "Sending..."
msgstr "Αποστολή..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Εστάλη στις αρχές από {{info_request_user}} στις {{date}}."
@@ -2504,6 +2553,9 @@ msgstr "Αποσύνδεση"
msgid "Sign up"
msgstr "Δημιουργία λογαριασμού"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2558,6 +2610,9 @@ msgstr "Λυπούμαστε, αυτή τη στιγμή είναι αδύνατ
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Λυπούμαστε, αυτή τη στιγμή δεν είναι δυνατόν να σταλεί το αίτημά σας. Παρακαλούμε δοκιμάστε ξανά αργότερα. "
@@ -2975,9 +3030,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Υπάρχει ένα όριο στον αριθμό αιτημάτων που μπορείτε να κάνετε σε μια μέρα, γιατί δεν θέλουμε οι δημόσιες αρχές να βομβαρδίζονται με μεγάλο αριθμό ανάρμοστων αιτημάτων. Αν πιστεύετε ότι έχετε καλό λόγο να ζητήσετε αύξηση του ορίου στην περίπτωσή σας, παρακαλούμε επικοινωνήστε ."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Δεν υπάρχει τίποτα για να εμφανιστεί ακόμα."
@@ -3198,6 +3259,9 @@ msgstr "Αυτό το τμήμα σχετικά με τις στατιστικέ
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Αυτός ο πίνακας δείχνει τις τεχνικές λεπτομέρειες των εσωτερικών διεργασιών που συνέβησαν με αυτό το αίτημα στο {{site_name}}. Αυτό θα μπορούσε να παρέχει πληροφορίες σχετικά με την ταχύτητα με την οποία οι αρχές ανταποκρίνονται στα αιτήματα, τον αριθμό των αιτήσεων που απαιτούν ταχυδρομική απάντηση και πολλά άλλα."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Ο χρήστης αυτός έχει τεθεί σε αναστολή από το {{site_name}}"
@@ -3324,9 +3388,15 @@ msgstr "Σήμερα"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Πάρα πολλά αιτήματα"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Κορυφαίοι πρόσφατοι παίκτες"
@@ -3673,6 +3743,9 @@ msgstr "Γράψτε ένα απαντητικό μήνυμα για το Αίτ
msgid "Write your request in simple, precise language."
msgstr "Γράψτε ένα αίτημα σε απλή, συγκεκριμένη γλώσσα ."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Ναι"
@@ -3802,6 +3875,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Φτάσατε το όριο νέων αιτημάτων. Οι χρήστες/-ριες συνήθως περιορίζονται σε {{max_requests_per_user_per_day}} αιτήματα σε κάθε 24ωρο. Θα μπορείτε να καταθέσετε νέο αίτημα σε {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Εγκαταλείψατε το σχέδιο "
@@ -4422,6 +4498,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} σχόλιο"
msgstr[1] "{{number_of_comments}} σχόλια"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} αίτηση"
diff --git a/locale/en/app.po b/locale/en/app.po
index 90b54a8b0c..5b9dccfa54 100644
--- a/locale/en/app.po
+++ b/locale/en/app.po
@@ -35,7 +35,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: English (http://www.transifex.com/mysociety/alaveteli/language/"
@@ -446,6 +446,9 @@ msgstr "All the options below can use variety or latest
msgid "All time"
msgstr "All time"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "All time best players"
@@ -608,6 +611,9 @@ msgstr "Banned from this site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Batch created by {{info_request_user}} on {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Beginning with"
@@ -671,6 +677,9 @@ msgstr "Cancel some {{site_name}} alerts"
msgid "Cancel, return to your profile page"
msgstr "Cancel, return to your profile page"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Change email on {{site_name}}"
@@ -935,6 +944,9 @@ msgstr "Done >>"
msgid "Download Data"
msgstr "Download Data"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Download a zip file of all correspondence"
@@ -1004,6 +1016,9 @@ msgstr "Event history"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Every citizen has the right to access information held by public authorities."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
@@ -1531,6 +1546,9 @@ msgstr "Last request viewed: {{request_url}}"
msgid "Latest"
msgstr "Latest"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Learn more →"
@@ -2205,6 +2223,9 @@ msgstr "Regulation"
msgid "Rejected"
msgstr "Rejected"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Remember me (keeps you signed in longer; do not use on a public computer)"
@@ -2391,6 +2412,9 @@ msgstr "Search your contributions"
msgid "Section"
msgstr "Section"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Send a followup"
@@ -2427,6 +2451,30 @@ msgstr "Send message to {{user_name}} just to see how it works"
msgid "Sending..."
msgstr "Sending..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Sent to one authority by {{info_request_user}} on {{date}}."
@@ -2492,6 +2540,9 @@ msgstr "Sign out"
msgid "Sign up"
msgstr "Sign up"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
@@ -2546,6 +2597,9 @@ msgstr "Sorry, we're currently unable to add your annotation. Please try again l
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr "Sorry, we're currently unable to create your account. Please try again later."
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Sorry, we're currently unable to send your request. Please try again later."
@@ -2963,9 +3017,15 @@ msgstr "There is more than one person who uses this site and ha
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "There is nothing to display yet."
@@ -3186,6 +3246,9 @@ msgstr "This section on public body statistics is currently experimental, so the
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "This user has been suspended from {{site_name}} "
@@ -3312,9 +3375,15 @@ msgstr "Today"
msgid "Too many annotations"
msgstr "Too many annotations"
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Too many requests"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Top recent players"
@@ -3661,6 +3730,9 @@ msgstr "Write your FOI follow up message to {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Write your request in simple, precise language."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Yes"
@@ -3790,6 +3862,9 @@ msgstr "You have hit the rate limit on annotations. Users are ordinarily limited
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "You have left the project."
@@ -4410,6 +4485,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} comment"
msgstr[1] "{{number_of_comments}} comments"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} request"
diff --git a/locale/en_HK/app.po b/locale/en_HK/app.po
index 2f652f8e81..5cab7d3019 100644
--- a/locale/en_HK/app.po
+++ b/locale/en_HK/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: English (Hong Kong) (http://app.transifex.com/mysociety/alavete"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/en_IE/app.po b/locale/en_IE/app.po
index f193229767..b3e2d59be4 100644
--- a/locale/en_IE/app.po
+++ b/locale/en_IE/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# John Cross , 2012
# handelaar , 2011
# John Cross , 2012
@@ -40,7 +41,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: John Cross , 2012\n"
"Language-Team: English (Ireland) (http://app.transifex.com/mysociety/alaveteli"
@@ -441,6 +442,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -603,6 +607,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -666,6 +673,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -930,6 +940,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -999,6 +1012,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1526,6 +1542,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2200,6 +2219,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2386,6 +2408,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2422,6 +2447,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2487,6 +2536,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2541,6 +2593,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2958,9 +3013,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3181,6 +3242,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3307,9 +3371,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3656,6 +3726,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3785,6 +3858,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4405,6 +4481,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/en_RW/app.po b/locale/en_RW/app.po
index 06a689aad5..338c5f2fc7 100644
--- a/locale/en_RW/app.po
+++ b/locale/en_RW/app.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2018-12-21 12:21+0000\n"
"Last-Translator: Liz Conlan \n"
"Language-Team: LANGUAGE \n"
@@ -418,6 +418,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -580,6 +583,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -643,6 +649,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -907,6 +916,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -976,6 +988,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1512,6 +1527,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2186,6 +2204,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2375,6 +2396,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2411,6 +2435,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2476,6 +2524,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2530,6 +2581,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2952,9 +3006,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "There is a limit on the number of requests you can make in a day, because we don’t want public agencies to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3179,6 +3239,9 @@ msgstr ""
"the speed with which agencies respond to requests, the number of requests\n"
"which require a postal response and much more."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3305,9 +3368,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3654,6 +3723,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3783,6 +3855,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4403,6 +4478,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/en_UG/app.po b/locale/en_UG/app.po
index f7b4d2ee3c..40439d7377 100644
--- a/locale/en_UG/app.po
+++ b/locale/en_UG/app.po
@@ -31,12 +31,13 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Liz Conlan , 2018
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Liz Conlan , 2018\n"
"Language-Team: English (Uganda) (http://app.transifex.com/mysociety/alaveteli/"
@@ -448,6 +449,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -610,6 +614,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -673,6 +680,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -937,6 +947,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -1006,6 +1019,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1542,6 +1558,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2216,6 +2235,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2405,6 +2427,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2441,6 +2466,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2506,6 +2555,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2560,6 +2612,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2982,9 +3037,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "There is a limit on the number of requests you can make in a day, because we don’t want public agencies to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3209,6 +3270,9 @@ msgstr ""
"the speed with which agencies respond to requests, the number of requests\n"
"which require a postal response and much more."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3335,9 +3399,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3684,6 +3754,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3813,6 +3886,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4433,6 +4509,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/en_US/app.po b/locale/en_US/app.po
index f87cc98e5d..0cb3b8f217 100644
--- a/locale/en_US/app.po
+++ b/locale/en_US/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: English (United States) (http://app.transifex.com/mysociety/ala"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/es/app.po b/locale/es/app.po
index c989e1d80c..ef126ae689 100644
--- a/locale/es/app.po
+++ b/locale/es/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Anatoli Pena , 2017
# Anatoli Pena , 2017
# Anatoli Pena , 2017
@@ -61,7 +62,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: vickyanderica , 2011\n"
"Language-Team: Spanish (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -505,6 +506,9 @@ msgstr "All the options below can use variety or latest
msgid "All time"
msgstr "Todo el tiempo"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Los mejores jugadores de todos los tiempos. "
@@ -673,6 +677,9 @@ msgstr "Vedado el ingreso al sitio"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Lote creado por {{info_request_user}} el {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -736,6 +743,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -1004,6 +1014,9 @@ msgstr "Hecho >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarga un fichero ZIP con toda la correspondencia"
@@ -1075,6 +1088,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Todos los ciudadanos tienen el derecho a acceder a la información que tiene los organismos y autoridades públicas."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Todo lo que escribas en esta página, incluyendo tu nombre, \n"
@@ -1649,6 +1665,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Conoce más →"
@@ -2337,6 +2356,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rechazada"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
"Recuérdame (mantiene la sesión abierta;\n"
@@ -2528,6 +2550,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Mandar una respuesta"
@@ -2564,6 +2589,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr "Enviando..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviada a un organismo por {{info_request_user}} el {{date}}."
@@ -2630,6 +2679,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Registrarse"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2690,6 +2742,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3123,9 +3178,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que los organismos públicos reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "No hay nada que mostrar aún."
@@ -3355,6 +3416,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de los organismos o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3487,9 +3551,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Demasiados pedidos"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Los mejores jugadores recientes"
@@ -3856,6 +3926,9 @@ msgstr "Escribe tu mensaje de seguimiento a {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Escribe tu solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3985,6 +4058,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4639,6 +4715,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} solicitudes."
diff --git a/locale/es_AR/app.po b/locale/es_AR/app.po
index b6f7a1ebd4..f967a24479 100644
--- a/locale/es_AR/app.po
+++ b/locale/es_AR/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Anatoli Pena , 2017
# andreas.pavlou , 2015,2017
# Fabrizio Scrollini , 2012
@@ -50,7 +51,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Victor Diaz , 2014\n"
"Language-Team: Spanish (Argentina) (http://app.transifex.com/mysociety/alavete"
@@ -494,6 +495,9 @@ msgstr "All the options below can use variety or latest
msgid "All time"
msgstr "Todo el tiempo"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Los mejores jugadores de todos los tiempos. "
@@ -662,6 +666,9 @@ msgstr "Vedado el ingreso al sitio"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Lote creado por {{info_request_user}} el {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -725,6 +732,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -993,6 +1003,9 @@ msgstr "Hecho >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarga un fichero ZIP con toda la correspondencia"
@@ -1064,6 +1077,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Todos los ciudadanos tienen el derecho a acceder a la información que tiene los organismos y autoridades públicas."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Todo lo que escribas en esta página, incluyendo tu nombre, \n"
@@ -1638,6 +1654,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Conoce más →"
@@ -2326,6 +2345,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rechazada"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
"Recuérdame (mantiene la sesión abierta;\n"
@@ -2517,6 +2539,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Mandar una respuesta"
@@ -2553,6 +2578,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr "Enviando..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviada a un organismo por {{info_request_user}} el {{date}}."
@@ -2619,6 +2668,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Registrarse"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2679,6 +2731,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3112,9 +3167,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que los organismos públicos reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "No hay nada que mostrar aún."
@@ -3344,6 +3405,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de los organismos o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3476,9 +3540,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Demasiados pedidos"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Los mejores jugadores recientes"
@@ -3845,6 +3915,9 @@ msgstr "Escribe tu mensaje de seguimiento a {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Escribe tu solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3974,6 +4047,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4628,6 +4704,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} solicitudes."
diff --git a/locale/es_NI/app.po b/locale/es_NI/app.po
index 7f2acbcbed..a71ad38c83 100644
--- a/locale/es_NI/app.po
+++ b/locale/es_NI/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Fabrizio Scrollini , 2012
# Fabrizio Scrollini , 2012
# Gaba , 2012,2014
@@ -51,7 +52,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Victor Diaz , 2014\n"
"Language-Team: Spanish (Nicaragua) (http://app.transifex.com/mysociety/alavete"
@@ -497,6 +498,9 @@ msgstr "Todas las opciones a continuación pueden usar variedad
msgid "All time"
msgstr "Todo el tiempo"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Todo el tiempo los mejores jugadores"
@@ -665,6 +669,9 @@ msgstr "Expulso de este sitio"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Bloque creado por {{info_request_user}} en {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -728,6 +735,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -994,6 +1004,9 @@ msgstr "Hecho >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarga un fichero ZIP con toda la correspondencia"
@@ -1065,6 +1078,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Todos los ciudadanos tienen derecho a acceder a la información pública en poder de las entidades públicas."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Todo lo que escribas en esta página, incluyendo tu nombre, estará disponible públicamente en está web (¿por qué?)."
@@ -1638,6 +1654,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2326,6 +2345,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rechazado"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
"Recuérdame (mantiene la sesión abierta;\n"
@@ -2517,6 +2539,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Mandar una respuesta"
@@ -2553,6 +2578,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviado por {{authority_count}} la autoridad {{info_request_user}} el {{date}}."
@@ -2619,6 +2668,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Iniciar cesión "
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2679,6 +2731,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3112,9 +3167,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que los Entidades públicas reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "No hay nada que mostrar aún."
@@ -3344,6 +3405,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de las entidades o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3476,9 +3540,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Demasiados pedidos"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3845,6 +3915,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escribe tu solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3974,6 +4047,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4624,6 +4700,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/es_PA/app.po b/locale/es_PA/app.po
index 99324ec474..13497ddef8 100644
--- a/locale/es_PA/app.po
+++ b/locale/es_PA/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Aida Martinez , 2016
# Fabrizio Scrollini , 2012
# Fabrizio Scrollini , 2012
@@ -52,7 +53,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Victor Diaz , 2014\n"
"Language-Team: Spanish (Panama) (http://app.transifex.com/mysociety/alaveteli/"
@@ -498,6 +499,9 @@ msgstr "Todas las opciones a continuación pueden usar variedad
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Mejores jugadores de todos los tiempos"
@@ -667,6 +671,9 @@ msgstr "Bloqueado de este sitio Web"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Bloque creado por {{info_request_user}} en {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -730,6 +737,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar dirección de correo en {{site_name}}"
@@ -996,6 +1006,9 @@ msgstr "Listo >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarge un documento ZIP con toda la correspondencia"
@@ -1067,6 +1080,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Todo ciudadano tiene el derecho de acceder a la información en poder de las instituciones públicas. "
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Todo lo que escriba en esta página, incluyendo su nombre,\n"
@@ -1639,6 +1655,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Aprenda más →"
@@ -2325,6 +2344,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rechazado"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Recuérdame (mantiene la sesión abierta; no lo use en un ordenador público)"
@@ -2514,6 +2536,9 @@ msgstr "Busque sus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Enviar un seguimiento a la respuesta"
@@ -2550,6 +2575,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr "Enviando..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviado a una institución pública {{info_request_user}} el {{date}}"
@@ -2616,6 +2665,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Registrarse"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2676,6 +2728,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3105,9 +3160,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puede realizar en un día, porque no queremos que las instituciones públicas reciban un número exagerado de solicitudes mal formuladas. Si necesita que el límite no se aplique en su caso, por favor contáctenos."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "No hay nada que mostrar aún."
@@ -3336,6 +3397,9 @@ msgstr ""
" con la solicitud en {{site_name}}. Estos datos pueden ser utilizados para generar estadísticas sobre\n"
" por ejemplo la velocidad de respuesta de las instituciones."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3468,9 +3532,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Demasiadas solicitudes"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Los mejores jugadores más recientes"
@@ -3834,6 +3904,9 @@ msgstr "Para enviar un mensaje de seguimiento sobre acces a la información a {{
msgid "Write your request in simple, precise language."
msgstr "Escriba su solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3963,6 +4036,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Ha alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrá enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4613,6 +4689,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} solicitud"
diff --git a/locale/es_PY/app.po b/locale/es_PY/app.po
index ce3b7b2337..86c7d2b405 100644
--- a/locale/es_PY/app.po
+++ b/locale/es_PY/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Fabrizio Scrollini , 2012
# Fabrizio Scrollini , 2012
# Gaba , 2012,2014
@@ -51,7 +52,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Victor Diaz , 2014\n"
"Language-Team: Spanish (Paraguay) (http://app.transifex.com/mysociety/alavetel"
@@ -497,6 +498,9 @@ msgstr "Todas las opciones a continuación pueden usar variedad
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -665,6 +669,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Bloque creado por {{info_request_user}} en {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -728,6 +735,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -994,6 +1004,9 @@ msgstr "Hecho >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descarga un fichero ZIP con toda la correspondencia"
@@ -1065,6 +1078,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Todo lo que escribas en esta página, incluyendo tu nombre, estará disponible públicamente en está web (¿por qué?)."
@@ -1632,6 +1648,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2320,6 +2339,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rechazado"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
"Recuérdame (mantiene la sesión abierta;\n"
@@ -2511,6 +2533,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Mandar una respuesta"
@@ -2547,6 +2572,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviado por {{authority_count}} la autoridad {{info_request_user}} el {{date}}."
@@ -2613,6 +2662,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Iniciar sesión "
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2673,6 +2725,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3106,9 +3161,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que las entidades públicas reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "No hay nada que mostrar aún."
@@ -3338,6 +3399,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de las entidades o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3470,9 +3534,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Demasiados pedidos"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3839,6 +3909,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escribe tu solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3968,6 +4041,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4618,6 +4694,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/eu/app.po b/locale/eu/app.po
index ae61887ae9..0a15baf4f3 100644
--- a/locale/eu/app.po
+++ b/locale/eu/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# David Cabo , 2012
# sroberto , 2012
# Liz Conlan , 2018
@@ -41,7 +42,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: sroberto , 2012\n"
"Language-Team: Basque (http://app.transifex.com/mysociety/alaveteli/language/e"
@@ -464,6 +465,9 @@ msgstr "Beheko aukera guztiek erabil dezakete variety edo your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Orrialde honetan idatziko duzun guztia, zure izena barne, \n"
@@ -1562,6 +1578,9 @@ msgstr "Ikusi den azken eskabidea: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2238,6 +2257,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2427,6 +2449,9 @@ msgstr "Bilatu zure ekarpenak"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Bidali erantzuna"
@@ -2463,6 +2488,30 @@ msgstr "Bidali _____-ri mezua {{user_name}} nola funtzionatzen duen ikustearren"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2528,6 +2577,9 @@ msgstr "Itxi saioa"
msgid "Sign up"
msgstr "Erregistratu"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2584,6 +2636,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3009,9 +3064,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Badago egunean egin ditzakezun eskabide kopuru mugatua, ez dugulako nahi erakunde publikoek gaizki idatzitako eskabide gehiegizkoak jaso ditzaten. Zure kasuan muga hau aplika ez dadin behar izanez gero, mesedez jar zaitez gurekin harremanetan."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3234,6 +3295,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ondoko taulak {{site_name}} eskabidearekin zerikusia duten barne gertaeren datu teknikoak erakusten ditu. Datu hauek erabil daitezke estatistikak sortzeko, esaterako erakundeen erantzun abiadura edo posta arrunta erabiltzeko eskatzen duten eskabide kopurua."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3362,9 +3426,15 @@ msgstr "Gaur"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3714,6 +3784,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Idatz ezazu zure eskabidea hizkera erraz eta argi batez."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3843,6 +3916,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Egun bateko eskabide kopurua gainditu duzu, hau da 24 ordutan H{{max_requests_per_user_per_day}} eskabide egin daitezke. Eskabide berria egin ahal izango duzu {{can_make_another_request}}-ean."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4473,6 +4549,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/fa/app.po b/locale/fa/app.po
index a8c27f13ee..bbf398ad60 100644
--- a/locale/fa/app.po
+++ b/locale/fa/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Persian (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/fi/app.po b/locale/fi/app.po
index d04526a938..f70057ba8f 100644
--- a/locale/fi/app.po
+++ b/locale/fi/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# apoikola , 2013
# apoikola , 2013
# Juha-Matti Santala , 2013
@@ -39,7 +40,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Juha-Matti Santala , 2013\n"
"Language-Team: Finnish (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -440,6 +441,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -602,6 +606,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -665,6 +672,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -929,6 +939,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -998,6 +1011,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1525,6 +1541,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2199,6 +2218,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2385,6 +2407,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2421,6 +2446,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2486,6 +2535,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2540,6 +2592,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2957,9 +3012,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3180,6 +3241,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3306,9 +3370,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3655,6 +3725,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3784,6 +3857,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4404,6 +4480,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/fr/app.po b/locale/fr/app.po
index da943cd317..07ffad097b 100644
--- a/locale/fr/app.po
+++ b/locale/fr/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 0c5d54599df8b711a7a254a114ba48aa, 2011
# Adrien Chauvet, 2013
# Adrien Chauvet, 2013
@@ -76,7 +77,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: vickyanderica , 2011\n"
"Language-Team: French (http://app.transifex.com/mysociety/alaveteli/language/f"
@@ -521,6 +522,9 @@ msgstr "Toutes les options ci-dessous peuvent utiliser Etat ou
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Palmarès des meilleurs acteurs"
@@ -685,6 +689,9 @@ msgstr "Banni de ce site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Groupe creé par {{info_request_user}} le {{date}}"
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Commence par"
@@ -748,6 +755,9 @@ msgstr "Annuler les alertes {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Annuler, retourner à votre page de profil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Changer le courriel sur {{site_name}}"
@@ -1016,6 +1026,9 @@ msgstr "Fait >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Télécharger un fichier zip de toute la correspondance"
@@ -1089,6 +1102,9 @@ msgstr "Historique des événements"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Chaque citoyen a la droit d'accédez aux informations détenues par les autorités publiques."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Tout ce que vous indiquez dans cette page, y compris votre nom ,\n"
@@ -1654,6 +1670,9 @@ msgstr "Dernière demande consultée : {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "En savoir plus →"
@@ -2333,6 +2352,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rejeté"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Souvenez-vous de moi (vous permet de rester connecté longtemps; ne pas utiliser sur un ordinateur publique)"
@@ -2522,6 +2544,9 @@ msgstr "Chercher vos contributions"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Envoyer un suivi"
@@ -2558,6 +2583,30 @@ msgstr "Envoyer un message à {{user_name}} juste pour voir comment ça marche"
msgid "Sending..."
msgstr "Envoi..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Envoyé à {{info_request_user}} ce {{date}}."
@@ -2624,6 +2673,9 @@ msgstr "Se déconnecter"
msgid "Sign up"
msgstr "Créer un compte"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2681,6 +2733,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3106,9 +3161,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Il y a une limite sur le nombre de demandes que vous pouvez faire en une journée, parce que nous ne voulons pas que les autorités publiques soient bombardées avec un grand nombre de demandes inappropriées. Si vous sentez que vous avez une bonne raison de demander que la limite soit levée pour vous, veuillez nous contacter."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Il n'y a rien à afficher encore."
@@ -3336,6 +3397,9 @@ msgstr ""
" la vitesse avec laquelle les autorités répondent aux demandes, le nombre de demandes \n"
" qui nécessitent une réponse postale et bien plus encore."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3468,9 +3532,15 @@ msgstr "Aujourd'hui"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Trop de demandes "
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Palmarès des acteurs récents"
@@ -3836,6 +3906,9 @@ msgstr "Ecrivez votre message de suivi à {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Formulez votre demande en langage simple et precis ."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3965,6 +4038,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Vous avez atteint la limite du nombre des nouvelles demandes. Les utilisateurs sont normalement limités à {max_requests_per_user_per_day}} demandes par jour . Vous serez en mesure de faire une autre demande dans {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4620,6 +4696,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} demandes"
diff --git a/locale/fr_BE/app.po b/locale/fr_BE/app.po
index d5b4ceb616..365a4ae055 100644
--- a/locale/fr_BE/app.po
+++ b/locale/fr_BE/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 0c5d54599df8b711a7a254a114ba48aa, 2011
# Adrien Chauvet, 2013
# Adrien Chauvet, 2013
@@ -61,7 +62,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: vickyanderica , 2011\n"
"Language-Team: French (Belgium) (http://app.transifex.com/mysociety/alaveteli/"
@@ -485,6 +486,9 @@ msgstr "Toutes les options ci-dessous peuvent utiliser variety
msgid "All time"
msgstr "Tout le temps"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Palmarès des meilleurs acteurs"
@@ -647,6 +651,9 @@ msgstr "Banni de ce site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Groupe créé par {{info_request_user}} le {{date}}"
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Commence par"
@@ -710,6 +717,9 @@ msgstr "Annuler certaines alertes de {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Annuler et retourner à votre page de profil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Changer l'email utilisé sur {{site_name}}"
@@ -974,6 +984,9 @@ msgstr "C'est fait"
msgid "Download Data"
msgstr "Télécharger les données"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Télécharger un fichier zip de toute la correspondance"
@@ -1043,6 +1056,9 @@ msgstr "Historique des événements"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Chaque citoyen a le droit d'accéder aux informations détenues par les autorités publiques."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tout ce que vous indiquez dans cette page, y compris votre nom, sera public sur ce site (pourquoi?)."
@@ -1579,6 +1595,9 @@ msgstr "Dernière demande consultée : {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "En savoir plus →"
@@ -2254,6 +2273,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rejeté"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Souvenez-vous de moi (vous permet de rester connecté, ne pas utiliser sur un ordinateur public)"
@@ -2440,6 +2462,9 @@ msgstr "Rechercher vos contributions"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Envoyer un message de suivi"
@@ -2476,6 +2501,30 @@ msgstr "Envoyer un message à {{user_name}} juste pour voir comment cela fonctio
msgid "Sending..."
msgstr "Envoi..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Envoyé à une autorité par {{info_request_user}} le {{date}}."
@@ -2542,6 +2591,9 @@ msgstr "Se déconnecter"
msgid "Sign up"
msgstr "S'inscrire"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2598,6 +2650,9 @@ msgstr "Désolé, nous sommes actuellement dans l'impossibilité d'ajouter votre
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Désolé, nous sommes actuellement dans l'impossibilité d'envoyer votre demande. Merci d'essayer ultérieurement."
@@ -3015,9 +3070,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Il y a une limite concernant le nombre de demandes que vous pouvez effectuer en une journée, parce que nous ne voulons pas que les autorités publiques soient bombardées avec un grand nombre de demandes inappropriées. Si vous estimez que vous avez une bonne raison de demander que la limite soit augmentée pour vous, veuillez nous contacter."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "A ce stade, il n'y a rien à afficher."
@@ -3240,6 +3301,9 @@ msgstr "Cette section sur les statistiques de l'organisme public est actuellemen
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ce tableau présente les détails techniques des événements internes concernant cette demande faite via {{site_name}}. Ces données pourraient être utilisées pour générer des informations sur la vitesse avec laquelle les autorités répondent aux demandes, le nombre de demandes qui nécessitent une réponse postale et bien plus encore."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Cet utilisateur a été suspendu de {{site_name}}"
@@ -3366,9 +3430,15 @@ msgstr "Aujourd'hui"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Trop de demandes "
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Palmarès des acteurs récents"
@@ -3720,6 +3790,9 @@ msgstr "Ecrivez votre message de suivi à {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Formulez votre demande en langage simple et précis."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Oui"
@@ -3852,6 +3925,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Vous avez atteint la limite maximale de nouvelles demandes. Les utilisateurs sont limités à {{max_requests_per_user_per_day}} demandes par période de 24h. Vous pourrez faire une autre demande dans {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Vous avez quitté le projet."
@@ -4489,6 +4565,11 @@ msgstr[0] "{{number_of_comments}} commentaire"
msgstr[1] "{{number_of_comments}} commentaires"
msgstr[2] "{{number_of_comments}} commentaires"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} demande"
diff --git a/locale/fr_CA/app.po b/locale/fr_CA/app.po
index ed71d06e54..164d5717a7 100644
--- a/locale/fr_CA/app.po
+++ b/locale/fr_CA/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 0c5d54599df8b711a7a254a114ba48aa, 2011
# andreas.pavlou , 2013
# 0c5d54599df8b711a7a254a114ba48aa, 2011
@@ -53,7 +54,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: vickyanderica , 2011\n"
"Language-Team: French (Canada) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -496,6 +497,9 @@ msgstr "Toutes les options ci-dessous peuvent utiliser variety
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -660,6 +664,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Commence avec"
@@ -723,6 +730,9 @@ msgstr "Annuler certaines alertes de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Annuler, retourner à votre page de profil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Changer le courriel sur {{site_name}}"
@@ -991,6 +1001,9 @@ msgstr "Fait >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Télécharger un fichier zip de toute la correspondance"
@@ -1064,6 +1077,9 @@ msgstr "Historique des événements"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Tout ce que vous indiquez sur cette page, y compris votre nom ,\n"
@@ -1626,6 +1642,9 @@ msgstr "Dernière demande consultée : {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2305,6 +2324,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2494,6 +2516,9 @@ msgstr "Chercher dans vos demandes"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Envoyer un message de suivi"
@@ -2530,6 +2555,30 @@ msgstr "Envoyer un message à {{user_name}} Juste pour voir comment cela fonctio
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2595,6 +2644,9 @@ msgstr "Se déconnecter"
msgid "Sign up"
msgstr "Créer un compte"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2653,6 +2705,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3080,9 +3135,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Il y a un nombre limite de demandes pouvant être formulées par jour (nous voulons éviter que les organismes soient bombardés de demandes inappropriées). Si vous croyez que vous devriez être exempté de cette limite, veuillez nous contacter."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3308,6 +3369,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ce tableau détaille les événements techniques liés à cette demande. Cette information peut vous aider à retracer la suite des événements et, par exemple, à voir avec précision quand ont été échangés les différents messages."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3442,9 +3506,15 @@ msgstr "Aujourd'hui"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Trop de demandes "
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3806,6 +3876,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Formulez votre demande en langage simple et précis ."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3935,6 +4008,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Vous avez atteint la limite de nouvelles demandes permises. Les utilisateurs sont normalement limités à {max_requests_per_user_per_day}} demandes par jour. Vous serez en mesure de faire une autre demande dans {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4590,6 +4666,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/fr_FR/app.po b/locale/fr_FR/app.po
index 5053bde03a..2ccdbc9158 100644
--- a/locale/fr_FR/app.po
+++ b/locale/fr_FR/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 0c5d54599df8b711a7a254a114ba48aa, 2011
# a270031086f2a0d3514bc0cb507b48f6, 2019
# Adrien Chauvet, 2013
@@ -62,9 +63,9 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
-"Last-Translator: Laurent S, 2019-2023\n"
+"Last-Translator: vickyanderica , 2011\n"
"Language-Team: French (France) (http://app.transifex.com/mysociety/alaveteli/l"
"anguage/fr_FR/)\n"
"MIME-Version: 1.0\n"
@@ -486,6 +487,9 @@ msgstr "Toutes les options ci-dessous peuvent utiliser variety
msgid "All time"
msgstr "Tout le temps"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Palmarès des meilleurs acteurs"
@@ -648,6 +652,9 @@ msgstr "Banni de ce site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Groupe créé par {{info_request_user}} le {{date}}"
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Commence par"
@@ -711,6 +718,9 @@ msgstr "Annuler certaines alertes de {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Annuler et retourner à votre page de profil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Changer l'email utilisé sur {{site_name}}"
@@ -1015,6 +1025,9 @@ msgstr "C'est fait"
msgid "Download Data"
msgstr "Télécharger la donnée"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Télécharger un fichier zip de toute la correspondance"
@@ -1084,6 +1097,9 @@ msgstr "Historique des événements"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Ma Dada est un site associatif qui vous aide à faire des demandes d’accès aux documents administratifs communicables."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tout ce que vous indiquez dans cette page, y compris votre nom, sera public sur ce site (pourquoi?)."
@@ -1618,6 +1634,9 @@ msgstr "Dernière demande consultée : {{request_url}}"
msgid "Latest"
msgstr "Dernier"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "En savoir plus →"
@@ -2299,6 +2318,9 @@ msgstr "Regulation"
msgid "Rejected"
msgstr "Rejetée"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Souvenez-vous de moi (vous permet de rester connecté, ne pas utiliser sur un ordinateur public)"
@@ -2485,6 +2507,9 @@ msgstr "Rechercher vos contributions"
msgid "Section"
msgstr "Section"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Envoyer un message"
@@ -2521,6 +2546,30 @@ msgstr "Envoyer un message à {{user_name}} juste pour voir comment cela fonctio
msgid "Sending..."
msgstr "Envoi..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Envoyé à une autorité par {{info_request_user}} le {{date}}."
@@ -2587,6 +2636,9 @@ msgstr "Se déconnecter"
msgid "Sign up"
msgstr "S'inscrire"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2643,6 +2695,9 @@ msgstr "Désolé, nous sommes actuellement dans l'impossibilité d'ajouter votre
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Désolé, nous sommes actuellement dans l'impossibilité d'envoyer votre demande. Merci d'essayer ultérieurement."
@@ -3064,9 +3119,15 @@ msgstr "Il y a plus d'une personne qui utilise ce site et ce no
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Il y a une limite concernant le nombre de demandes que vous pouvez effectuer en une journée, parce que nous ne voulons pas que les autorités publiques soient bombardées avec un grand nombre de demandes inappropriées. Si vous estimez que vous avez une bonne raison de demander que la limite soit augmentée pour vous, veuillez nous contacter."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "A ce stade, il n'y a rien à afficher."
@@ -3289,6 +3350,9 @@ msgstr "Cette section sur les statistiques de l'organisme public est actuellemen
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ce tableau présente les détails techniques des événements internes concernant cette demande faite via {{site_name}}. Ces données pourraient être utilisées pour générer des informations sur la vitesse avec laquelle les autorités répondent aux demandes, le nombre de demandes qui nécessitent une réponse postale et bien plus encore."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Cet utilisateur a été suspendu de {{site_name}} "
@@ -3415,9 +3479,15 @@ msgstr "Aujourd'hui"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Trop de demandes "
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Palmarès des acteurs récents"
@@ -3769,6 +3839,9 @@ msgstr "Ecrivez votre message de suivi à {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Formulez votre demande en langage simple et précis."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Oui"
@@ -3901,6 +3974,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Vous avez atteint la limite maximale de nouvelles demandes. Les utilisateurs sont limités à {{max_requests_per_user_per_day}} demandes par période de 24h. Vous pourrez faire une autre demande dans {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Vous avez quitté ce projet"
@@ -4538,6 +4614,11 @@ msgstr[0] "{{number_of_comments}} commentaire"
msgstr[1] "{{number_of_comments}} commentaires"
msgstr[2] "{{number_of_comments}} commentaires"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} demande"
diff --git a/locale/ga_IE/app.po b/locale/ga_IE/app.po
index 7e177cdb11..ac16fa8c09 100644
--- a/locale/ga_IE/app.po
+++ b/locale/ga_IE/app.po
@@ -31,12 +31,13 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Niall Ó Tuathail , 2015
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Niall Ó Tuathail , 2015\n"
"Language-Team: Irish (Ireland) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -438,6 +439,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -600,6 +604,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Ag tosú le"
@@ -663,6 +670,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -927,6 +937,9 @@ msgstr "Críochnaithe >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -996,6 +1009,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1523,6 +1539,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2197,6 +2216,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2383,6 +2405,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2419,6 +2444,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2484,6 +2533,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2538,6 +2590,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2955,9 +3010,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3178,6 +3239,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3304,9 +3368,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3653,6 +3723,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3782,6 +3855,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4402,6 +4478,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/gl/app.po b/locale/gl/app.po
index 26f465908a..1f5e391c3b 100644
--- a/locale/gl/app.po
+++ b/locale/gl/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# David Cabo , 2012
# Liz Conlan , 2018
# louisecrow , 2014
@@ -39,7 +40,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: louisecrow , 2014\n"
"Language-Team: Galician (http://app.transifex.com/mysociety/alaveteli/language"
@@ -483,6 +484,9 @@ msgstr "All the options below can use variety or latest
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -651,6 +655,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Comenzando por"
@@ -714,6 +721,9 @@ msgstr "Cancelar alertas de {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Cancelar, volver a mi perfil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambiar correo en {{site_name}}"
@@ -982,6 +992,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descargar un fichero ZIP con toda la correspondencia"
@@ -1053,6 +1066,9 @@ msgstr "Historial de eventos"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Todo lo que escribas en esta página, incluyendo tu nombre, \n"
@@ -1621,6 +1637,9 @@ msgstr "Última solicitud vista: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2309,6 +2328,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2498,6 +2520,9 @@ msgstr "Busca tus aportaciones"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Mandar una respuesta"
@@ -2534,6 +2559,30 @@ msgstr "Enviar un mensaje a {{user_name}} sólo para ver cómo funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2599,6 +2648,9 @@ msgstr "Cerrar sesión"
msgid "Sign up"
msgstr "Registrarse"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2659,6 +2711,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3092,9 +3147,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hay un límite en el número de solicitudes que puedes hacer en un día, porque no queremos que los organismos públicos reciban un número exagerado de solicitudes mal formuladas. Si necesitas que el límite no se aplique en tu caso, por favor contacta con nosotros."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3323,6 +3384,9 @@ msgstr ""
"estadísticas sobre por ejemplo la velocidad de respuesta de los organismos o\n"
"el número de solicitudes que piden usar correo ordinario."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3457,9 +3521,15 @@ msgstr "Hoy"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3824,6 +3894,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escribe tu solicitud en un lenguaje sencillo y claro."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3953,6 +4026,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Has alcanzado el límite de solicitudes en un día, que es de {{max_requests_per_user_per_day}} solicitudes en un plazo de 24 horas. Podrás enviar una nueva solicitud en {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4596,6 +4672,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/he_IL/app.po b/locale/he_IL/app.po
index a1e6eb9c90..78eb9c3ee7 100644
--- a/locale/he_IL/app.po
+++ b/locale/he_IL/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Liz Conlan , 2018
# louisecrow , 2014
# louisecrow , 2014
@@ -53,7 +54,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Z.D , 2013\n"
"Language-Team: Hebrew (Israel) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -495,6 +496,9 @@ msgstr "כל האפשרויות למטה יכולות לעשות שימושyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "כל מה שתזינו בדף הזה, כולל השם שלכם, יוצג פתוח לציבור באתר הזה לתמיד(למה?)."
@@ -1617,6 +1633,9 @@ msgstr "בקשה אחרונה שנצפתה: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2304,6 +2323,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "זכור אותי (משאיר אתכם מחוברים לזמן רב יותר; אל תסמנו על מחשב ציבורי)"
@@ -2492,6 +2514,9 @@ msgstr "חפש בין התוספות שלך"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "לשלוח הודעת המשך"
@@ -2528,6 +2553,30 @@ msgstr "שלחו הודעה {{user_name}} רק כדי לראות איך זה ע
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2593,6 +2642,9 @@ msgstr "התנתק"
msgid "Sign up"
msgstr "הרשמה"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2653,6 +2705,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3083,9 +3138,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "מספר הבקשות שניתן להגיש ביום מוגבל, כי אנו לא רוצים להציף את הרשויות הציבוריות בבקשות שווא. אם אתם רוצים להגדיל את המספר המותר, צרו קשר."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3316,6 +3377,9 @@ msgstr ""
" המהירות בה רשויות מגיבות לבקשות, מספר הבקשות\n"
" שדרשו שליחת דואר ודברים רבים נוספים."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3446,9 +3510,15 @@ msgstr "היום"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "יותר מדי בקשות"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3809,6 +3879,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "כתבו את בקשתכם בשפה פשוטה ומדויקת."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3938,6 +4011,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "עברתם את המכסה היומית המותרת להגשת בקשות מידע. לרוב מוגבלים המשתמשים ל- {{max_requests_per_user_per_day}} בקשות ביממה. תוכלו להגיש בקשה נוספת בעוד {{can_make_another_request}} שעות."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4601,6 +4677,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/hr/app.po b/locale/hr/app.po
index 9fb40978da..491726bcfb 100644
--- a/locale/hr/app.po
+++ b/locale/hr/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# ae792aa766bbca91f3f4821acaa19518_a48216f <924a924c26027fc002ca6fada3386ff5_247255>, 2015
# Bojan Opacak , 2013
# Bojan Opacak , 2013
@@ -63,9 +64,9 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
-"Last-Translator: Miroslav Schlossberg, 2021-2023\n"
+"Last-Translator: Žana Počuča , 2015,2021\n"
"Language-Team: Croatian (http://app.transifex.com/mysociety/alaveteli/language"
"/hr/)\n"
"MIME-Version: 1.0\n"
@@ -475,6 +476,9 @@ msgstr "Sve opcije ispod mogu koristiti variety ili lat
msgid "All time"
msgstr "Sveukupno"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Svo vrijeme najbolji igrači"
@@ -637,6 +641,9 @@ msgstr "Zabranjen pristup na ovoj stranici"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Seriju je napravio/la {{info_request_user}} dana {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Počevši sa"
@@ -700,6 +707,9 @@ msgstr "Poništite neka upozorenja na {{site_name}}"
msgid "Cancel, return to your profile page"
msgstr "Odustanite, vratite se na stranicu svojeg profila"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Promijenite elektroničku poštu na {{site_name}}"
@@ -964,6 +974,9 @@ msgstr "Završeno >>"
msgid "Download Data"
msgstr "Preuzmi podatke"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Preuzmite svu korespondenciju u zip datoteci"
@@ -1033,6 +1046,9 @@ msgstr "Prikaz prošlih događanja"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Svaki građanin ima pravo na pristup informacijama koje posjeduju tijela javne vlasti."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Sve što unesete na ovu stranicu, uključujući vaše ime, bit će javno prikazano na ovoj internetskoj stranici zauvijek"
@@ -1564,6 +1580,9 @@ msgstr "Zadnje pregledani zahtjev: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Saznajte više →"
@@ -2239,6 +2258,9 @@ msgstr ""
msgid "Rejected"
msgstr "Odbijen"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Zapamti me (ostajete dulje prijavljeni; ne koristite na javnim računalima)"
@@ -2425,6 +2447,9 @@ msgstr "Pretražite Vaše doprinose"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Pošaljite dodatnu poruku"
@@ -2461,6 +2486,30 @@ msgstr "Pošaljite poruku {{user_name}} samo da vidite kako radi"
msgid "Sending..."
msgstr "Slanje..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Poslano jednoj ustanovi od {{info_request_user}} dana {{date}}."
@@ -2527,6 +2576,9 @@ msgstr "Odjavite se"
msgid "Sign up"
msgstr "Registrirajte se"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2581,6 +2633,9 @@ msgstr "Nažalost, trenutno ne možemo dodati vašu bilješku. Molimo pokušajte
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Nažalost, trenutno ne možemo poslati Vaš zahtjev. Molimo pokušajte ponovo kasnije."
@@ -2998,9 +3053,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Postoji ograničenje broja zahtjeva koje možete dnevno izraditi. Ne želimo da tijela javne vlasti budu zatrpane velikim brojem neprikladnih zahtjeva. Ukoliko mislite da, u Vašem slučaju, imate dobar razlog zatražiti veći broj zahtjeva, molimo javite nam se."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Još nema ničega za prikazati."
@@ -3223,6 +3284,9 @@ msgstr "Ovaj je odjeljak o statistici tijela javne vlasti trenutno eksperimental
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ova tablica prikazuje tehničke detalje internih događaja vezanih uz ovaj zahtjev na {{site_name}}. To se može iskoristiti za dobivanje informacija o brzini kojom tijela javne vlasti odgovaraju na zahtjeve, o broju zahtjeva koji žele odgovoriti poštom i mnogo drugih stvari."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Ovaj korisnik je suspendiran na {{site_name}} "
@@ -3349,9 +3413,15 @@ msgstr "Danas"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Previše zahtjeva"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Najnoviji vrhunski igrači"
@@ -3700,6 +3770,9 @@ msgstr "Napišite svoju dodatnu poruku za pravo na pristup informacijama za {{au
msgid "Write your request in simple, precise language."
msgstr "Pišite Vaš zahtjev jednostavnim, preciznim jezikom."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Da"
@@ -3832,6 +3905,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Dosegli ste limit novih zahtjeva. Korisnici su ograničeni na {{max_requests_per_user_per_day}} zahtjeva u periodu od 24 sata. Novi zatjev bit će moguć za {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Napustili ste projekt."
@@ -4469,6 +4545,11 @@ msgstr[0] "{{number_of_comments}} komentara"
msgstr[1] "{{number_of_comments}} komentara"
msgstr[2] "{{number_of_comments}} komentara"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} zahtjeva"
diff --git a/locale/hu_HU/app.po b/locale/hu_HU/app.po
index 238f19f518..a19b3e0b7c 100644
--- a/locale/hu_HU/app.po
+++ b/locale/hu_HU/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# alaveteli_hu , 2012
# alaveteli_hu , 2012
# Dohány Tamás, 2021-2022
@@ -48,7 +49,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: iamdtms, 2021-2022\n"
"Language-Team: Hungarian (Hungary) (http://app.transifex.com/mysociety/alavete"
@@ -484,6 +485,9 @@ msgstr "Az alábbi beállítások mindegyike használhatja a változat
msgid "All time"
msgstr "Mindenkori"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Mindenkori legjobb játékosok"
@@ -650,6 +654,9 @@ msgstr "Kitiltva az oldalról"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "A köteget létrehozta: {{info_request_user}}, {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Kezdőbetű"
@@ -713,6 +720,9 @@ msgstr "Néhány {{site_name}} értesítő törlése "
msgid "Cancel, return to your profile page"
msgstr "Mégse, visszatérés a profiloldalra "
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "E-mail cím módosítása"
@@ -981,6 +991,9 @@ msgstr "Kész >>"
msgid "Download Data"
msgstr "Adatok letöltése"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Az adatigényléssel kapcsolatos eddigi teljes levelezés letöltése zip formátumban"
@@ -1052,6 +1065,9 @@ msgstr "Eseménytörténet"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Minden állampolgárnak joga van hozzáférni a hatóságok birtokában lévő információkhoz."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Az ön neve, valamint minden, amit itt beír,\n"
@@ -1624,6 +1640,9 @@ msgstr "Legutóbb megtekintett igénylés: {{request_url}}"
msgid "Latest"
msgstr "Legújabb"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "További információ →"
@@ -2313,6 +2332,9 @@ msgstr "Szabályozás"
msgid "Rejected"
msgstr "Elutasítva"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Emlékezzen rám (továbbra is bejelentkezve marad; ne használja nyilvános számítógépen)"
@@ -2502,6 +2524,9 @@ msgstr "Keresés az adatigényléseimben"
msgid "Section"
msgstr "Szakasz"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Emlékeztető üzenet küldése - Rákérdezhet az adatgazdánál, hogy hogy áll az igénylése."
@@ -2538,6 +2563,30 @@ msgstr "Üzenet küldése a következőnek: {{user_name}} Csak hogy megnézzük,
msgid "Sending..."
msgstr "Küldés..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Elküldte {{authority_count}} hatóságnak, {{info_request_user}}, {{date}}."
@@ -2603,6 +2652,9 @@ msgstr "Kijelentkezés"
msgid "Sign up"
msgstr "Regisztráció"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2663,6 +2715,9 @@ msgstr "Sajnáljuk, jelenleg nem tudjuk hozzáadni a kommentjét. Kérlek, prób
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Sajnáljuk, jelenleg nem tudjuk elküldeni kérését. Kérlek, próbáld újra később."
@@ -3096,9 +3151,15 @@ msgstr "Egynél több személy használja ezt az oldalt és ren
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Ennek a korlátozásnak az az oka hogy nem szeretnénk ha nagy mennyiségű inadekvát adatigényléssel árasztaná el az adatgazdákat valaki. Ha úgy érzi hogy nyomós oka van ennél több adatigénylést kezdeményezni rövid időn belül, kérjük, lépjen kapcsolatba velünk."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Még nincs mit megjeleníteni."
@@ -3327,6 +3388,9 @@ msgstr ""
"a közintézmények milyen gyorsan válaszolnak, mennyi igénylés esetén\n"
"van szükség postai válaszra stb.. "
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Ezt a felhasználót felfüggesztettük a {{site_name}} webhelyen"
@@ -3459,9 +3523,15 @@ msgstr "Ma "
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Túl sok igénylés"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Legújabb játékosok"
@@ -3826,6 +3896,9 @@ msgstr "Írja meg az FOI nyomon követési üzenetét a következőnek: {{author
msgid "Write your request in simple, precise language."
msgstr "Igénylését egyszerűen és pontosan fogalmazza meg!"
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Igen"
@@ -3957,6 +4030,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Felhasználóink 24 órán belül legfeljebb {{max_requests_per_user_per_day}} új adatigénylést kezdeményezhetnek. Ön elérte ezt a számot, ezért a következő adatigénylését legkorábban kb. {{can_make_another_request}} óra múlva küldheti el."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Kilépett a projektből."
@@ -4602,6 +4678,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} megjegyzés"
msgstr[1] "{{number_of_comments}} megjegyzés"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} igénylés"
diff --git a/locale/id/app.po b/locale/id/app.po
index a2c719120f..781aa31525 100644
--- a/locale/id/app.po
+++ b/locale/id/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Agung Riyadi , 2013
# Agung Riyadi , 2012-2013
# agustriwanto , 2012
@@ -47,7 +48,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Agung Riyadi , 2012-2013\n"
"Language-Team: Indonesian (http://app.transifex.com/mysociety/alaveteli/langua"
@@ -492,6 +493,9 @@ msgstr "Semua pilihan di bawah dapat menggunakanjenis atauyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Semua yang Anda masukkan di halaman ini, termasuknama Anda, \n"
@@ -1634,6 +1650,9 @@ msgstr "Permintaan terakhir yang dilihat: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2321,6 +2340,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2510,6 +2532,9 @@ msgstr "Cari kontribusi Anda"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Kirim tindak lanjut"
@@ -2546,6 +2571,30 @@ msgstr "Kirim pesan kepada {{user_name}} hanya untuk melihat cara kerjanya"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2611,6 +2660,9 @@ msgstr "Keluar"
msgid "Sign up"
msgstr "Daftar"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2671,6 +2723,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3104,9 +3159,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Ada batas jumlah permintaan yang dapat Anda buat dalam sehari, karena kami tidak mau otoritas publik dibombardir dengan sejumlah besar permintaan yang tidak sesuai. Jika Anda merasa Anda memiliki alasan yang bagus untuk meminta batasan ini dicabut dalam kasus Anda, silakan berhubungan."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3334,6 +3395,9 @@ msgstr ""
"kecepatan otoritas dalam merespon permintaan, jumlah permintaan\n"
"yang membutuhkan respon pos dan banyak lagi."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3468,9 +3532,15 @@ msgstr "Hari ini"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Terlalu banyak permintaan"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3837,6 +3907,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Tulis permintaan Anda dalam bahasa yang sederhana, tepat."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3966,6 +4039,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Anda telah mencapai batas kecepatan permintaan baru. Pengguna biasanya dibatasi sampai {{max_requests_per_user_per_day}} permintaan dalam jangka waktu 24 jam berjalan. Anda akan dapat membuat permintaan lain dalam {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4612,6 +4688,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/is/app.po b/locale/is/app.po
index 864538bfa2..18857701cc 100644
--- a/locale/is/app.po
+++ b/locale/is/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Finnur Magnusson , 2015
# Liz Conlan , 2018
# Ölvir Gíslason , 2016
@@ -39,9 +40,9 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
-"Last-Translator: Páll Hilmarsson , 2020-2021,2023\n"
+"Last-Translator: Ölvir Gíslason , 2016\n"
"Language-Team: Icelandic (http://app.transifex.com/mysociety/alaveteli/languag"
"e/is/)\n"
"MIME-Version: 1.0\n"
@@ -472,6 +473,9 @@ msgstr "Með öllum neðangreindum valkostum má nota variety o
msgid "All time"
msgstr "Allra tíma"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Þau allra afkastamestu"
@@ -640,6 +644,9 @@ msgstr "Í banni á þessum vef"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Hópbeiðni búin til af {{info_request_user}} þann {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Byrjar á"
@@ -703,6 +710,9 @@ msgstr "Hætta við einhverjar {{site_name}} viðvaranir"
msgid "Cancel, return to your profile page"
msgstr "Hætta við, fara aftur á þína síðu"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Breyta netfangi á {{site_name}}"
@@ -967,6 +977,9 @@ msgstr "Lokið >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Sækja zip-skrá með öllum samskiptum"
@@ -1038,6 +1051,9 @@ msgstr "Færsluferill"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Allir borgarar hafa rétt á að fá aðgang að upplýsingum sem stjórnvöld búa yfir."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Allt sem þú setur á þetta vefsvæði, þar á meðal nafnið þitt,\n"
@@ -1582,6 +1598,9 @@ msgstr "Síðasta beiðni sem var skoðuð: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Meiri upplýsingar →"
@@ -2258,6 +2277,9 @@ msgstr ""
msgid "Rejected"
msgstr "Hafnað"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Muna mig (þú verður lengur innskráð/ur; ekki haka við þetta á tæki sem fleiri en þú nota)"
@@ -2447,6 +2469,9 @@ msgstr "Leitaðu í þínum innleggjum"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Senda svar/viðbót"
@@ -2483,6 +2508,30 @@ msgstr "Senda skilaboð til {{user_name}} til að prófa hvernig það virkar"
msgid "Sending..."
msgstr "Sendi..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Sent til eins stjórnvalds af {{info_request_user}} þann {{date}}"
@@ -2548,6 +2597,9 @@ msgstr "Útskrá"
msgid "Sign up"
msgstr "Nýskrá"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2606,6 +2658,9 @@ msgstr "Því miður getum við ekki bætt við athugasemd þinni núna. Reyndu
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Því miður getum við ekki send beiðnina þína núna. Reyndu aftur síðar."
@@ -3031,9 +3086,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Fjöldi þeirra beiðna sem hægt er að leggja fram á einum degi er takmarkaður því við viljum forðast að stjórnvöld fái mikinn fjölda óviðeigandi beiðna. Hafðu samband ef þér finnst ástæða til að aflétta takmörkuninni í þínu tilfelli."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Ekkert til að sýna enn."
@@ -3254,6 +3315,9 @@ msgstr "Hlutinn um tölfræði stjórnvalda er á tilraunastigi svo það eru ý
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Þessi tafla sýnir tæknilegar upplýsingar um feril beiðnarinnar á {{site_name}}. Þetta má til dæmis nota til að fá fram upplýsingar um það hversu hratt stjórnvöld bregðast við beiðnum og fjölda þeirra beiðna sem þarf að svara bréflega, svo fátt eitt sé nefnt."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3382,9 +3446,15 @@ msgstr "Í dag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Of margar beiðnir"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Afkastamest upp á síðkastið"
@@ -3736,6 +3806,9 @@ msgstr "Skrifa ítrekunarskilaboð vegna upplýsingabeiðni til {{authority_name
msgid "Write your request in simple, precise language."
msgstr "Skrifaðu beiðnina þín með einföldu, markvissu máli"
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3865,6 +3938,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Þú hefur náð hámarksfjölda nýrra beiðna. Takmarkið fyrir notendur er yfirleitt {{max_requests_per_user_per_day}} beiðnir á hverjum sólarhring. Þú getur lagt fram nýja beiðni eftir {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4491,6 +4567,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} beiðni"
diff --git a/locale/is_IS/app.po b/locale/is_IS/app.po
index 8a2d89dd61..30ee627fbd 100644
--- a/locale/is_IS/app.po
+++ b/locale/is_IS/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Finnur Magnusson , 2015
# Liz Conlan , 2018
# Ölvir Gíslason , 2016
@@ -39,7 +40,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Ölvir Gíslason , 2016\n"
"Language-Team: Icelandic (Iceland) (http://app.transifex.com/mysociety/alavete"
@@ -472,6 +473,9 @@ msgstr "Með öllum neðangreindum valkostum má nota variety o
msgid "All time"
msgstr "Allra tíma"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Þau allra afkastamestu"
@@ -640,6 +644,9 @@ msgstr "Í banni á þessum vef"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Hópbeiðni búin til af {{info_request_user}} þann {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Byrjar á"
@@ -703,6 +710,9 @@ msgstr "Hætta við einhverjar {{site_name}} viðvaranir"
msgid "Cancel, return to your profile page"
msgstr "Hætta við, fara aftur á þína síðu"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Breyta netfangi á {{site_name}}"
@@ -967,6 +977,9 @@ msgstr "Lokið >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Sækja zip-skrá með öllum samskiptum"
@@ -1038,6 +1051,9 @@ msgstr "Færsluferill"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Allir borgarar hafa rétt á að fá aðgang að upplýsingum sem stjórnvöld búa yfir."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Allt sem þú setur á þetta vefsvæði, þar á meðal nafnið þitt,\n"
@@ -1582,6 +1598,9 @@ msgstr "Síðasta beiðni sem var skoðuð: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Meiri upplýsingar →"
@@ -2258,6 +2277,9 @@ msgstr ""
msgid "Rejected"
msgstr "Hafnað"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Muna mig (þú verður lengur innskráð/ur; ekki haka við þetta á tæki sem fleiri en þú nota)"
@@ -2447,6 +2469,9 @@ msgstr "Leitaðu í þínum innleggjum"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Senda svar/viðbót"
@@ -2483,6 +2508,30 @@ msgstr "Senda skilaboð til {{user_name}} til að prófa hvernig það virkar"
msgid "Sending..."
msgstr "Sendi..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Sent til eins stjórnvalds af {{info_request_user}} þann {{date}}"
@@ -2548,6 +2597,9 @@ msgstr "Útskrá"
msgid "Sign up"
msgstr "Nýskrá"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2606,6 +2658,9 @@ msgstr "Því miður getum við ekki bætt við athugasemd þinni núna. Reyndu
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Því miður getum við ekki send beiðnina þína núna. Reyndu aftur síðar."
@@ -3031,9 +3086,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Fjöldi þeirra beiðna sem hægt er að leggja fram á einum degi er takmarkaður því við viljum forðast að stjórnvöld fái mikinn fjölda óviðeigandi beiðna. Hafðu samband ef þér finnst ástæða til að aflétta takmörkuninni í þínu tilfelli."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Ekkert til að sýna enn."
@@ -3254,6 +3315,9 @@ msgstr "Hlutinn um tölfræði stjórnvalda er á tilraunastigi svo það eru ý
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Þessi tafla sýnir tæknilegar upplýsingar um feril beiðnarinnar á {{site_name}}. Þetta má til dæmis nota til að fá fram upplýsingar um það hversu hratt stjórnvöld bregðast við beiðnum og fjölda þeirra beiðna sem þarf að svara bréflega, svo fátt eitt sé nefnt."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3382,9 +3446,15 @@ msgstr "Í dag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Of margar beiðnir"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Afkastamest upp á síðkastið"
@@ -3736,6 +3806,9 @@ msgstr "Skrifa ítrekunarskilaboð vegna upplýsingabeiðni til {{authority_name
msgid "Write your request in simple, precise language."
msgstr "Skrifaðu beiðnina þín með einföldu, markvissu máli"
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3865,6 +3938,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Þú hefur náð hámarksfjölda nýrra beiðna. Takmarkið fyrir notendur er yfirleitt {{max_requests_per_user_per_day}} beiðnir á hverjum sólarhring. Þú getur lagt fram nýja beiðni eftir {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4491,6 +4567,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} beiðni"
diff --git a/locale/it/app.po b/locale/it/app.po
index a6ae357a4c..e2ae50b431 100644
--- a/locale/it/app.po
+++ b/locale/it/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Antonella , 2014-2015
# Claudio Cesarano , 2015-2016
# Giancarlo , 2015
@@ -43,7 +44,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Marco Giustini , 2013\n"
"Language-Team: Italian (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -468,6 +469,9 @@ msgstr "Tutte le opzioni qui sotto possono usare la variety o <
msgid "All time"
msgstr "Globale"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "I migliori"
@@ -630,6 +634,9 @@ msgstr "Bannato da questo sito"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Gruppo di richieste creato da {{info_request_user}} il {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "quelle che iniziano per "
@@ -693,6 +700,9 @@ msgstr "Cancella alcuni avvisi di {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Cancella e torna al tuo profilo"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambia l'indirizzo email su {{site_name}}"
@@ -957,6 +967,9 @@ msgstr "Fatto >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Scarica un file .zip di tutta la corrispondenza"
@@ -1026,6 +1039,9 @@ msgstr "Cronologia"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Ogni cittadino ha diritto di accedere alle informazioni possedute dalle pubbliche amministrazioni."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tutto ciò che scrivi in questa pagina, incluso il tuo nome sarà pubblicato su questo sito e sarà visibile (perché?)."
@@ -1570,6 +1586,9 @@ msgstr "Ultima richiesta visualizzata: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Scopri di più →"
@@ -2247,6 +2266,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rifiutata"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Ricordami (mantiene l'accesso più a lungo: non usare questa funzione su un computer pubblico)"
@@ -2436,6 +2458,9 @@ msgstr "Cerca i tuoi contributi"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Invia un messaggio di risposta"
@@ -2472,6 +2497,30 @@ msgstr "Invia un messaggio a {{user_name}} per vedere come funziona"
msgid "Sending..."
msgstr "Invio in corso..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Spedito da {{info_request_user}} il {{date}}."
@@ -2538,6 +2587,9 @@ msgstr "Esci"
msgid "Sign up"
msgstr "Registrati"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2594,6 +2646,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3013,9 +3068,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Abbiamo impostato un limite al numero di richieste quotidiane che puoi fare, perché non vogliamo che le amministrazioni siano bombardate con un numero eccessivo di richieste, magari non appropriate. Se pensi che nel tuo caso serva un'eccezione scrivici."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Non c'è ancora niente da mostrare."
@@ -3239,6 +3300,9 @@ msgstr "Questa sezione sulle statistiche che riguardano le pubbliche amministraz
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Questa tabella mostra dettagli tecnici relativi alla risposta alla richiesta spedita attraverso {{site_name}}. Può essere usata per ricavare informazioni sulla rapidità di risposta delle amministrazioni, il numero di richieste che richiedono risposta per posta ecc."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3365,9 +3429,15 @@ msgstr "Oggi"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Troppe richieste"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Gli utenti più attivi di recente"
@@ -3716,6 +3786,9 @@ msgstr "Rispondi a \"{{authority_name}}\""
msgid "Write your request in simple, precise language."
msgstr "Devi scrivere la tua richiesta in un linguaggio semplice e preciso."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3845,6 +3918,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Hai raggiunto il limite di nuove richieste. Gli utenti possono inviare non più di {{max_requests_per_user_per_day}} richieste in un periodo di 24 ore. Potrai inviare una nuova richiesta tra {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4485,6 +4561,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} richiesta"
diff --git a/locale/it_IT/app.po b/locale/it_IT/app.po
index 58ad0ca11b..0d8fb0db6c 100644
--- a/locale/it_IT/app.po
+++ b/locale/it_IT/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Giancarlo , 2015
# guido romeo , 2015
# 1bb8f5eb4bc72723d4109decfd20c765, 2017-2018
@@ -39,7 +40,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Marco Giustini , 2013\n"
"Language-Team: Italian (Italy) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -464,6 +465,9 @@ msgstr "Tutte le opzioni qui sotto possono usare la variety o <
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "I migliori"
@@ -626,6 +630,9 @@ msgstr "Bannato da questo sito"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Gruppo di richieste creato da {{info_request_user}} il {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "quelle che iniziano per "
@@ -689,6 +696,9 @@ msgstr "Cancella alcuni avvisi di {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Cancella e torna al tuo profilo"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Cambia l'indirizzo email su {{site_name}}"
@@ -953,6 +963,9 @@ msgstr "Fatto >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Scarica un file .zip di tutta la corrispondenza"
@@ -1022,6 +1035,9 @@ msgstr "Cronologia"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Ogni cittadino ha diritto di accedere alle informazioni possedute dalle pubbliche amministrazioni."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tutto ciò che scrivi in questa pagina, incluso il tuo nome sarà pubblicato su questo sito e sarà visibile (perché?)."
@@ -1566,6 +1582,9 @@ msgstr "Ultima richiesta visualizzata: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Scopri di più →"
@@ -2243,6 +2262,9 @@ msgstr ""
msgid "Rejected"
msgstr "Rifiutata"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Ricordami (mantiene l'accesso più a lungo: non usare questa funzione su un computer pubblico)"
@@ -2432,6 +2454,9 @@ msgstr "Cerca i tuoi contributi"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Invia un messaggio di risposta"
@@ -2468,6 +2493,30 @@ msgstr "Invia un messaggio a {{user_name}} per vedere come funziona"
msgid "Sending..."
msgstr "Invio in corso..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Spedito da {{info_request_user}} il {{date}}."
@@ -2534,6 +2583,9 @@ msgstr "Esci"
msgid "Sign up"
msgstr "Registrati"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2590,6 +2642,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3009,9 +3064,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Abbiamo impostato un limite al numero di richieste quotidiane che puoi fare, perché non vogliamo che le amministrazioni siano bombardate con un numero eccessivo di richieste, magari non appropriate. Se pensi che nel tuo caso serva un'eccezione scrivici."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Non c'è ancora niente da mostrare."
@@ -3235,6 +3296,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Questa tabella mostra dettagli tecnici relativi alla risposta alla richiesta spedita attraverso {{site_name}}. Può essere usata per ricavare informazioni sulla rapidità di risposta delle amministrazioni, il numero di richieste che richiedono risposta per posta ecc."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3361,9 +3425,15 @@ msgstr "Oggi"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Troppe richieste"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Gli utenti più attivi di recente"
@@ -3712,6 +3782,9 @@ msgstr "Rispondi a \"{{authority_name}}\""
msgid "Write your request in simple, precise language."
msgstr "Devi scrivere la tua richiesta in un linguaggio semplice e preciso."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3841,6 +3914,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Hai raggiunto il limite di nuove richieste. Gli utenti possono inviare non più di {{max_requests_per_user_per_day}} richieste in un periodo di 24 ore. Potrai inviare una nuova richiesta tra {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4478,6 +4554,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} richiesta"
diff --git a/locale/ka/app.po b/locale/ka/app.po
index 03ce58957a..4a8cf7ee20 100644
--- a/locale/ka/app.po
+++ b/locale/ka/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Jubo Beridzishvili, 2021-2023
# Lela Merabishvili, 2021
# Lela Merabishvili, 2021-2022
@@ -41,9 +42,9 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
-"Last-Translator: Jubo Beridzishvili, 2021-2023\n"
+"Last-Translator: Natalie Hiirulainen , 2021,2023\n"
"Language-Team: Georgian (http://app.transifex.com/mysociety/alaveteli/language"
"/ka/)\n"
"MIME-Version: 1.0\n"
@@ -449,6 +450,9 @@ msgstr "ქვემოთ მოცემულ ყველა ვარია
msgid "All time"
msgstr "ყველა დროის"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "ყველა დროის საუკეთესო მოთამაშეები"
@@ -611,6 +615,9 @@ msgstr "დაბლოკილია ვებგვერდიდან"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "შექმნილია მომხმარებლის მიერ {{info_request_user}} თარიღით {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "რომლებიც იწყება"
@@ -674,6 +681,9 @@ msgstr "ვებგვერდის {{site_name}} ზოგიერთი
msgid "Cancel, return to your profile page"
msgstr "გააუქმე, ან დაბრუნდი შენი პროფილის გვერდზე"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "შეცვალე ელ-ფოსტა ვებგვერდისთვის {{site_name}}"
@@ -944,6 +954,9 @@ msgstr "დასრულება >>"
msgid "Download Data"
msgstr "მონაცემების გადმოწერა"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "მიმოწერის ისტორიის ZIP ფორმატით გადმოწერა"
@@ -1013,6 +1026,9 @@ msgstr "მოქმედებების ისტორია"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "ყველა მოქალაქეს აქვს უფლება გამოითხოვოს ინფორმაცია, რომელსაც საჯარო დაწესებულებები ფლობენ. "
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "ამ გვერდზე მითითებული ყველა ინფორმაცია, მათ შორის შენი სახელი, პორტალზე საჯაროდ,განუსაზღვრელი ვადით განთავსდება"
@@ -1540,6 +1556,9 @@ msgstr "ბოლოს ნანახი მოთხოვნა: {{request_u
msgid "Latest"
msgstr "უკანასკნელი"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "გაიგე მეტი →"
@@ -2222,6 +2241,9 @@ msgstr "რეგულაცია"
msgid "Rejected"
msgstr "უარყოფილია"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "დამახსოვრება (არ გამოიყენო საჯარო კომპიუტერზე)"
@@ -2408,6 +2430,9 @@ msgstr "ძებნა"
msgid "Section"
msgstr "სექცია"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "პასუხის გაგზავნა"
@@ -2444,6 +2469,30 @@ msgstr "წერილის გაგზავნა მომხმარე
msgid "Sending..."
msgstr "იგზავნება..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "გაუგზავნე {{authority_count}} საჯარო დაწესებულებას {{info_request_user}}-ის მიერ, თარიღით {{date}}."
@@ -2509,6 +2558,9 @@ msgstr "გამოსვლა"
msgid "Sign up"
msgstr "რეგისტრაცია"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2563,6 +2615,9 @@ msgstr "ბოდიში, ამ ეტაპზე შენს ანოტ
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "ბოდიში, შენი მოთხოვნის გაგზავნა ვერ მოხერხდა. მოგვიანებით კიდევ სცადე."
@@ -2980,9 +3035,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "ლიმიტის დაწესებით ვცდილობთ, რომ საჯარო დაწესებულებები დიდი ოდენობით შეუსაბამო განცხადებების მიღებისგან დავაზღვიოთ. თუ ფიქრობ, რომ ლეგიტიმური მიზეზი გაქვს ლიმიტის გასაზრდელად, დაგვიკავშირდი."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "საჩვენებელი არაფერია"
@@ -3203,6 +3264,9 @@ msgstr "საჯარო უწყების სტატისტიკა
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "მოცემული ცხრილი აღნიშნავს მოთხოვნის ირგვლივ განხორციელებული მოქმედებების ისტორიას პორტალზე {{site_name}}. ცხრილის გამოყენება შეიძლება იმის გასარკვევად, თუ რა სისწრაფით პასუხობდნენ საჯარო დაწესებულებები მოთხოვნებს, რამდენი განაცხადი მოითხოვდა პასუხს საფოსტო მომსახურებით და ა.შ."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "მომხმარებელი დაბლოკილია საიტიდან {{site_name}} "
@@ -3329,9 +3393,15 @@ msgstr "დღეს"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "უპს. განცხადებების დღიური ლიმიტი ამოიწურა"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "ბოლო დროის საუკეთესო მოთამაშეები"
@@ -3678,6 +3748,9 @@ msgstr "გაუგზავნე საპასუხო წერილი
msgid "Write your request in simple, precise language."
msgstr " მოკლე და მკაფიო მესიჯებით მიმართვა საჯარო დაწესებულებებს გაუმარტივებს უკეთ აღიქვან შენი მოთხოვნილი ინფორმაციის შინაარსი, რაც ნიშნავს, რომ პასუხს უფრო მალე დაგიბრუნებენ."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "დიახ"
@@ -3807,6 +3880,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "სამწუხაროდ, 24 საათის მანძილზე არაუმეტეს {{max_requests_per_user_per_day}} განცხადების გაგზავნა შეგიძლია."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "შენ ეს პროექტი დატოვე"
@@ -4427,6 +4503,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} კომენტარი"
msgstr[1] "{{number_of_comments}} კომენტარი"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} მოთხოვნა"
diff --git a/locale/mk/app.po b/locale/mk/app.po
index 6287167b20..af438011fd 100644
--- a/locale/mk/app.po
+++ b/locale/mk/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Macedonian (http://app.transifex.com/mysociety/alaveteli/langua"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/mk_MK/app.po b/locale/mk_MK/app.po
index a24fedbc3a..ef80f5e8b0 100644
--- a/locale/mk_MK/app.po
+++ b/locale/mk_MK/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Liz Conlan , 2018
# louisecrow , 2014
# louisecrow , 2014
@@ -38,7 +39,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: louisecrow , 2014\n"
"Language-Team: Macedonian (Macedonia) (http://app.transifex.com/mysociety/alav"
@@ -485,6 +486,9 @@ msgstr "Сите опции подолу може да користат
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -653,6 +657,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Започнувајќи со"
@@ -716,6 +723,9 @@ msgstr "Откажете некои предупредувања за {{site_nam
msgid "Cancel, return to your profile page"
msgstr "Откажете и вратете се до страницата на вашиот профил"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Промени е-пошта на {{site_name}}"
@@ -990,6 +1000,9 @@ msgstr "Готово >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Преземете zip датотека од целата кореспонденција"
@@ -1063,6 +1076,9 @@ msgstr "Историја на настани"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Се што ќе внесете на оваа страница, вклучувајќи го и вашето име,\n"
@@ -1636,6 +1652,9 @@ msgstr "Последно видено барање: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2325,6 +2344,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2514,6 +2536,9 @@ msgstr "Пребарајте ги вашите придонеси"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Испратете реакција"
@@ -2550,6 +2575,30 @@ msgstr "Испратете порака до {{user_name}} само да вид
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2615,6 +2664,9 @@ msgstr "Одјавете се"
msgid "Sign up"
msgstr "Регистрирајте се"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2675,6 +2727,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3108,9 +3163,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Постои ограничување за бројот на барања кои може да ги направите во еден ден, бидејќи не сакаме имателите да бидат „бомбардирани“ со голем број на барања. Доколку сметате дека имате јака причина зошто ова ограничување не треба да важи за вас, ве молиме стапете во контакт."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3339,6 +3400,9 @@ msgstr ""
"брзината со која имателите одговараат на барањата, бројот на барањата\n"
"кои изнудуваат одговор преку пошта и др.."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3473,9 +3537,15 @@ msgstr "Денес"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Премногу барања"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3842,6 +3912,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Напишете го вашето барање со едноставен, прецизен речник."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3971,6 +4044,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Го исполнивте ограничувањето за нови барања. Корисниците обично се ограничени на {{max_requests_per_user_per_day}} барања во период од 24 часа. Ќе може да направите ново барање за {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4620,6 +4696,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/nb/app.po b/locale/nb/app.po
index 8104f28fc7..ff4df81ce5 100644
--- a/locale/nb/app.po
+++ b/locale/nb/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 2b81488fecf64b01474cdd73adee6da4_f428fa4 <168fddc5dd8708c6cc0c28446af80acb_220254>, 2017
# andreli , 2013
# Hans-Petter Fjeld , 2014
@@ -56,7 +57,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: pere , 2013,2015\n"
"Language-Team: Norwegian Bokmål (http://app.transifex.com/mysociety/alaveteli/"
@@ -503,6 +504,9 @@ msgstr "Alle alternativene nedenfor kan bruke variety eller your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Alt som du skriver inn på denne tjenesten, inkludert navnet ditt,\n"
@@ -1628,6 +1644,9 @@ msgstr "Siste henvendelse du så på: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Lær mer →"
@@ -2315,6 +2334,9 @@ msgstr ""
msgid "Rejected"
msgstr "Avvist"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Husk meg (lar deg være logget inn lengre, ikke bruk dette på en offentlig datamaskin)"
@@ -2504,6 +2526,9 @@ msgstr "Søk i dine bidrag"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Send en oppfølgning"
@@ -2540,6 +2565,30 @@ msgstr "Send melding til {{user_name}} bare for å se hvordan det fungerer"
msgid "Sending..."
msgstr "Sender..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Sendt til en myndighet av {{info_request_user}} den {{date}}."
@@ -2605,6 +2654,9 @@ msgstr "Logg ut"
msgid "Sign up"
msgstr "Lag konto"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2665,6 +2717,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3096,9 +3151,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Det er en grense på antall henvendelser du kan lage på én dag, fordi vi ikke ønsker at offentlige myndigheter skal bli oversvømt med et stort antall upassende henvendelser. Dersom du synes du har en god grunn til at grensen skal økes i ditt tilfelle, vennligst ta kontakt."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Det er ingenting å vise enda."
@@ -3323,6 +3384,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Denne tabellen viser de tekniske detaljene til interne hendelser som skjedde med denne henvendelsen på {{site_name}}. Dette kan brukes til å generere informasjon om hvor raskt ulike etater svarer på henvendelser, antall henvendelser som krever papirpostsvar og mye mer."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3455,9 +3519,15 @@ msgstr "Idag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "For mange henvendelser"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3822,6 +3892,9 @@ msgstr "Skriv din oppfølgningsmelding til {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Skriv henvendelsen i enkelt, nøyaktig språk."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3951,6 +4024,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Du har truffet grensen for antall nye henvendelser. Brukere er ordinært begrenset til {{max_requests_per_user_per_day}} henvendelser i en 24-timers periode. Du kan gjøre en ny henvendelse {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4591,6 +4667,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} henvendelse"
diff --git a/locale/ne/app.po b/locale/ne/app.po
index 4d17a80681..22fb6423c1 100644
--- a/locale/ne/app.po
+++ b/locale/ne/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Amit Shrestha , 2017
# Anjesh Ojha , 2017
# arjun gautam , 2016
@@ -65,7 +66,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Yudeep Rajbhandari , 2017\n"
"Language-Team: Nepali (http://app.transifex.com/mysociety/alaveteli/language/n"
@@ -495,6 +496,9 @@ msgstr "तल रहेका सबै विकल्प varietyyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"तपाईँ ले यो पेजमा लेख्नु भएको हरेक कुराहरू,तपाईँको सहितनामसहित,\n"
@@ -1619,6 +1635,9 @@ msgstr "अन्तिम पटक हेरिएको: {{request_url}} "
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "थप जान्नुहोस् →"
@@ -2295,6 +2314,9 @@ msgstr ""
msgid "Rejected"
msgstr "फर्काइयो"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "मलाई सम्झनुहोस् (लामो समयसम्म प्रवेश गराइराख्छ;सार्वजनिक कम्प्युटरमा प्रयोग नगर्नुहोस्)"
@@ -2484,6 +2506,9 @@ msgstr "तपाईंको योगदान खोज"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "फलोअप पठाउनुहोस्"
@@ -2520,6 +2545,30 @@ msgstr "कसरी काम गर्छ भनेर हेर्नका
msgid "Sending..."
msgstr "पठाउँदै..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "{{date}} मा {{info_request_user}} द्वारा एउटा निकायलाई पठाइएको | "
@@ -2585,6 +2634,9 @@ msgstr "साइन आउट गर्नुहोस्"
msgid "Sign up"
msgstr "साइन अप गर्नुहोस्"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2645,6 +2697,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3064,9 +3119,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "एक दिनमा कति सन्देश पठाउने भन्ने सीमाना छ, किन भने सार्वजनिक निकायहरू हाम्रो साइटबाट प्राप्त हुने अनुरोधहरूबाट ग्रसित नहुन्। यदि तपाईँको यस सीमालाई हटाइनु पर्छ भन्ने तपाईँसँग कुनै कारण छ भने थाह दिनुहोस्।"
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "हालसम्म देखाउनको लागी केहि छैन |"
@@ -3295,6 +3356,9 @@ msgstr ""
"र कसलाई कति वटा अनुरोधहरू छन् भन्ने पनि\n"
"कतिलाई हुलाकद्वारा जवाफ दिनु पर्छ इत्यादि। "
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3425,9 +3489,15 @@ msgstr "आज"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "धेरै अनुरोधहरू"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "हालका शीर्ष प्रयोगकर्ताहरू"
@@ -3779,6 +3849,9 @@ msgstr "{{authority_name}}मा तपाईंले FOI सन्देश
msgid "Write your request in simple, precise language."
msgstr "सटीक, सरल भाषामा आफ्नो अनुरोध लेख्नुहोस्"
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3908,6 +3981,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "तपाईंले नयाँ अनुरोधमा दर सीमा भेटाउनु भएको छ। प्रयोगकर्ताहरु सामान्यतया २४-घण्टाको अवधिमा {{max_requests_per_user_per_day}} अनुरोधमा सिमित छन्। तपाईं {{can_make_another_request}}मा अर्को अनुरोध गर्न सक्षम हुनुहुनेछ।"
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4547,6 +4623,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} अनुरोध"
diff --git a/locale/ne_NP/app.po b/locale/ne_NP/app.po
index f2a8bc361e..656593c3bb 100644
--- a/locale/ne_NP/app.po
+++ b/locale/ne_NP/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Nepali (Nepal) (http://app.transifex.com/mysociety/alaveteli/la"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/nl/app.po b/locale/nl/app.po
index 191bc48492..03c0e7af95 100644
--- a/locale/nl/app.po
+++ b/locale/nl/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Edwin Bosveld , 2013,2016
# Gareth Rees , 2020
# Graeme Porteous , 2019,2021
@@ -43,7 +44,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Luis Villegas, 2022\n"
"Language-Team: Dutch (http://app.transifex.com/mysociety/alaveteli/language/nl"
@@ -480,6 +481,9 @@ msgstr "Alle opties hieronder kunnen voor de dubbele punt varietyyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Alles wat je op deze pagina invult, ook je naam, \n"
@@ -1609,6 +1625,9 @@ msgstr "Laatst bekeken verzoek: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Meer weten →"
@@ -2289,6 +2308,9 @@ msgstr ""
msgid "Rejected"
msgstr "Geweigerd"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Aangemeld blijven (gebruik dit niet op een openbare computer)"
@@ -2475,6 +2497,9 @@ msgstr "Doorzoek je bijdragen"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Stuur een follow-up bericht"
@@ -2511,6 +2536,30 @@ msgstr "Verstuur een bericht aan {{user_name}} om te zien hoe het werkt"
msgid "Sending..."
msgstr "Wordt verzonden..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Verzonden naar een overheidsinstantie door {{info_request_user}} on {{date}}."
@@ -2576,6 +2625,9 @@ msgstr "Log uit"
msgid "Sign up"
msgstr "Schrijf je in"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2630,6 +2682,9 @@ msgstr "Tot onze spijt kunnen wij je opmerking niet plaatsen. Probeer het later
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Tot onze spijt kunnen wij je Woo-verzoek niet verzenden. Probeer het later alsjeblieft opnieuw."
@@ -3051,9 +3106,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Er is een limiet aan het aantal verzoeken dat je per dag kunt versturen, omdat we niet willen dat de overheidsinstanties gebombardeerd worden met grote aantallen ongepaste verzoeken. Als je van mening bent dat je een goede reden hebt dat de limiet voor jou moet worden opgehoogd, gelieve ons te contacteren."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Er is voorlopig nog niets te tonen."
@@ -3280,6 +3341,9 @@ msgstr ""
"Deze tabel toont de technische details van de interne gebeurtenissen m.b.t. dit verzoek op {{site_name}}. Deze gegevens zouden gebruikt kunnen worden om informatie te verzamelen over de \n"
" snelheid waarmee overheidsinstanties besluiten op verzoeken, het aantal verzoeken die per post beantwoord moeten worden, enzovoort."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Deze gebruiker wordt tijdelijk geweerd van {{site_name}} "
@@ -3425,9 +3489,15 @@ msgstr "Vandaag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Te veel verzoeken"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Recente topspelers"
@@ -3783,6 +3853,9 @@ msgstr "Formuleer een follow-up bericht over je Woo-verzoek aan {{authority_name
msgid "Write your request in simple, precise language."
msgstr "Formuleer je verzoek eenvoudig en nauwkeurig."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3912,6 +3985,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Je hebt het maximaal toegestane aantal verzoeken verstuurd. Het aantal verzoeken is beperkt tot {{max_requests_per_user_per_day}} per 24u. Je kunt weer een nieuw verzoek doen op {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4534,6 +4610,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} commentaar"
msgstr[1] "{{number_of_comments}} opmerkingen"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} vraag"
diff --git a/locale/nl_BE/app.po b/locale/nl_BE/app.po
index c3465f8bdc..56c9bf2a88 100644
--- a/locale/nl_BE/app.po
+++ b/locale/nl_BE/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Christophe Van Gheluwe , 2017
# claude transparencia , 2017-2018,2021
# Edwin Bosveld , 2013,2016
@@ -43,7 +44,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: louisecrow , 2017\n"
"Language-Team: Dutch (Belgium) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -478,6 +479,9 @@ msgstr "Alle opties hieronder kunnen voor de dubbele punt varietyyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Alles wat u op deze pagina invult, ook uw naam, \n"
@@ -1610,6 +1626,9 @@ msgstr "Laatst bekeken aanvraag: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Meer weten →"
@@ -2290,6 +2309,9 @@ msgstr ""
msgid "Rejected"
msgstr "Geweigerd"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Aangemeld blijven (gebruik dit niet op een openbare computer)"
@@ -2479,6 +2501,9 @@ msgstr "Zoek uw bijdragen"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Verzend een opvolgbericht"
@@ -2515,6 +2540,30 @@ msgstr "Zend het bericht aan {{user_name}}, enkel om te zien hoe het werkt"
msgid "Sending..."
msgstr "Wordt verzonden..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Verzonden naar een overheidsinstantie door {{info_request_user}} on {{date}}."
@@ -2580,6 +2629,9 @@ msgstr "Deconnecteer"
msgid "Sign up"
msgstr "Schrijf u in"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2638,6 +2690,9 @@ msgstr "Tot onze spijt kunnen wij uw commentaar thans niet toevoegen. Probeer a.
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Tot onze spijt kunnen wij uw aanvraag nu niet verzenden. Probeer a.u.b. later opnieuw."
@@ -3065,9 +3120,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Er staat een limiet op het aantal aanvragen dat u per dag kunt uitvoeren, omdat we niet willen dat de overheidsinstellingen gebombardeerd worden met een ongepast aantal aanvragen. Als u meent dat u een goede reden heeft om deze limiet voor u te verhogen, gelieve dan ons te contacteren."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Er is voorlopig nog niets te tonen."
@@ -3294,6 +3355,9 @@ msgstr ""
"Deze tabel toont de technische details van de interne gebeurtenissen m.b.t. deze aanvraag uitgevoerd via {{site_name}}. Deze gegevens zouden kunnen gebruikt worden om informatie op te stellen aangaande de \n"
" snelheid waarmee de overheidsinstellingen antwoorden, het aantal aanvragen die een antwoord per post vereisen en veel meer."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3426,9 +3490,15 @@ msgstr "Vandaag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Te veel aanvragen"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "De meest recente spelers"
@@ -3786,6 +3856,9 @@ msgstr "Formuleer uw WOB follow-up bericht aan {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Formuleer uw vraag eenvoudig en nauwkeurig."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3915,6 +3988,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "U heeft de limiet voor nieuwe aanvragen bereikt. De gebruikers zijn beperkt tot {{max_requests_per_user_per_day}} aanvragen per 24u. U kan een nieuwe aanvraag doen op {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4543,6 +4619,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} commentaar"
msgstr[1] "{{number_of_comments}} commentaren"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} vraag"
diff --git a/locale/nn/app.po b/locale/nn/app.po
index eeb2210c11..8533c5c868 100644
--- a/locale/nn/app.po
+++ b/locale/nn/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# andreli , 2013
# Hans-Petter Fjeld , 2014
# b99f4c81950a40007b4adaea695ecb99_1c02644 , 2015
@@ -55,7 +56,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: velmont , 2015\n"
"Language-Team: Norwegian Nynorsk (http://app.transifex.com/mysociety/alaveteli"
@@ -500,6 +501,9 @@ msgstr "Alle alternativa nedanfor kan bruka variety eller your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Alt som du skriv inn på denne tenesta, inkluderte namnet ditt,\n"
@@ -1627,6 +1643,9 @@ msgstr "Siste førespurnad du såg på: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Lær meir →"
@@ -2314,6 +2333,9 @@ msgstr ""
msgid "Rejected"
msgstr "Avvist"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Hugs meg (lèt deg loggast inn lengre, ikkje bruk dette på ei offentleg datamaskin)"
@@ -2503,6 +2525,9 @@ msgstr "Søk i bidraga dine"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Send ei oppfølging"
@@ -2539,6 +2564,30 @@ msgstr "Send melding til {{user_name}} berre for å sjå korleis det fungerer"
msgid "Sending..."
msgstr "Sender..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Sendt til ei styresmakt av {{info_request_user}} den {{date}}."
@@ -2604,6 +2653,9 @@ msgstr "Logg ut"
msgid "Sign up"
msgstr "Lag konto"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2664,6 +2716,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3095,9 +3150,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Det er ei grense på mengd førespurnader du kan laga på éin dag, fordi vi ikkje ynskjer at offentlege styresmakter skal oversymjast med ei stort mengd upassande førespurnader. Dersom du synest du har ein god grunn til at grensa skal aukast i tilfellet ditt, ver venleg og ta kontakt."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Det er ikkje noko å visa endå."
@@ -3322,6 +3383,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Denne tabellen viser dei tekniske detaljane til interne hendingar som skjedde med denne førespurnaden på {{site_name}}. Dette kan brukast til å generera informasjon om der raskt ulike etatar svarar på førespurnader, mengd førespurnader som krev papirpostsvar og mykje meir."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3455,9 +3519,15 @@ msgstr "Idag"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "For mange førespurnader"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3818,6 +3888,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Skriv førespurnaden i enkelt, nøyaktig språk."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3947,6 +4020,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Du har treft grensa for mengd nye førespurnader. Brukarar er ordinært avgrensa til {{max_requests_per_user_per_day}} førespurnader i perioden til-ein 24 timar. Du kan gjera ein ny førespurnad {{can_maka_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4587,6 +4663,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/pap/app.po b/locale/pap/app.po
index 1830a6c612..85a6e940f4 100644
--- a/locale/pap/app.po
+++ b/locale/pap/app.po
@@ -31,13 +31,14 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Luis Villegas, 2022
# Luis Villegas, 2022
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Luis Villegas, 2022\n"
"Language-Team: Papiamento (http://app.transifex.com/mysociety/alaveteli/langua"
@@ -448,6 +449,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -610,6 +614,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -673,6 +680,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -937,6 +947,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -1006,6 +1019,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1533,6 +1549,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2207,6 +2226,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2393,6 +2415,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2429,6 +2454,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2494,6 +2543,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2548,6 +2600,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2965,9 +3020,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3188,6 +3249,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3314,9 +3378,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3663,6 +3733,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3792,6 +3865,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4412,6 +4488,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/pl/app.po b/locale/pl/app.po
index 45c60625fb..98d1a5e342 100644
--- a/locale/pl/app.po
+++ b/locale/pl/app.po
@@ -31,13 +31,14 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Ewa Modrzejewska , 2013
# Ewa Modrzejewska , 2013
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Ewa Modrzejewska , 2013\n"
"Language-Team: Polish (http://app.transifex.com/mysociety/alaveteli/language/p"
@@ -440,6 +441,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -602,6 +606,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -665,6 +672,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -929,6 +939,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -998,6 +1011,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1525,6 +1541,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2199,6 +2218,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2385,6 +2407,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2421,6 +2446,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2486,6 +2535,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2540,6 +2592,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2957,9 +3012,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3180,6 +3241,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3306,9 +3370,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3655,6 +3725,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3784,6 +3857,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4404,6 +4480,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/pt_BR/app.po b/locale/pt_BR/app.po
index 90356dcb4b..41eb8567e5 100644
--- a/locale/pt_BR/app.po
+++ b/locale/pt_BR/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# elaste <3laste2000@gmail.com>, 2012
# serramassuda , 2012
# Bruno , 2012
@@ -76,7 +77,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Vítor Márcio Paiva de Sousa Baptista , 2013\n"
@@ -504,6 +505,9 @@ msgstr "Todas as opções abaixo podem usar variedade ou your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tudo o que você publicar nesta página, incluindo seu nome, será exibido publicamente neste site para sempre ( por quê? )."
@@ -1600,6 +1616,9 @@ msgstr "Último pedido visualizado: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2274,6 +2293,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2460,6 +2482,9 @@ msgstr "Buscar suas contribuições"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Enviar um mensagem de acompanhamento"
@@ -2496,6 +2521,30 @@ msgstr "Enviar mensagem para {{user_name}} veja como isso funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2561,6 +2610,9 @@ msgstr "Sair"
msgid "Sign up"
msgstr "Cadastrar"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2615,6 +2667,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3037,9 +3092,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Há um limite de pedidos de informação que você pode fazer em um dia, porque não queremos que as autoridades públicas sejam bombardeadas por um número grande de pedidos inapropriados. Se você considera ter uma boa razão para seu limite ser ampliado, por favor nos contate."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3265,6 +3326,9 @@ msgstr ""
"Esta tabela mostra detalhes técnicos dos eventos internos que\n"
"aconteceram para esta requisição no {{site_name}}. Isto pode ser usado para gerar informação sobre a velocidade com a qual autoridades respondem às requisições, o número de requisições que requerem uma resposta por correio e muito mais."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3393,9 +3457,15 @@ msgstr "Hoje"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Excessivas requisições"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3742,6 +3812,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escreva seu pedido de forma simples."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3871,6 +3944,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Você atingiu o raro limite de pedidos novos. Usuários estão normalmente limitados a {{max_requests_per_user_per_day}} pedidos em um período de 24 horas. Você poderá fazer outro pedido em {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4513,6 +4589,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/pt_PT/app.po b/locale/pt_PT/app.po
index 14e72b4f63..90948c9941 100644
--- a/locale/pt_PT/app.po
+++ b/locale/pt_PT/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Bruno , 2012
# Carlos Vieira , 2011
# danielabsilva , 2011
@@ -60,7 +61,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Vítor Márcio Paiva de Sousa Baptista , 2013\n"
@@ -488,6 +489,9 @@ msgstr "Todas as opções abaixo podem usar variedade ou your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Tudo o que você publicar nesta página, incluindo seu nome, será exibido publicamente neste site para sempre ( por quê? )."
@@ -1588,6 +1604,9 @@ msgstr "Último pedido visualizado: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2262,6 +2281,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Lembre-se de mim (mantém-te autenticado por mais tempo; não utilizar num computador público)"
@@ -2451,6 +2473,9 @@ msgstr "Buscar suas contribuições"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Enviar um mensagem de acompanhamento"
@@ -2487,6 +2512,30 @@ msgstr "Enviar mensagem para {{user_name}} veja como isso funciona"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Enviado a uma entidade por {{info_request_user}} em{{date}}."
@@ -2553,6 +2602,9 @@ msgstr "Sair"
msgid "Sign up"
msgstr "Cadastrar"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2607,6 +2659,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3029,9 +3084,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Há um limite de pedidos de informação que você pode fazer em um dia, porque não queremos que as autoridades públicas sejam bombardeadas por um número grande de pedidos inapropriados. Se você considera ter uma boa razão para seu limite ser ampliado, por favor contacte-nos."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Ainda não existe informação para divulgar."
@@ -3259,6 +3320,9 @@ msgstr ""
"a velocidade com a qual as entidades respondem aos pedidos, o número de pedidos\n"
" que requerem uma resposta por correio e muito mais."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3387,9 +3451,15 @@ msgstr "Hoje"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Excessivas requisições"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3738,6 +3808,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Escreva seu pedido de forma simples."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3867,6 +3940,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Você atingiu o raro limite de pedidos novos. Usuários estão normalmente limitados a {{max_requests_per_user_per_day}} pedidos em um período de 24 horas. Você poderá fazer outro pedido em {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4511,6 +4587,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/ro_RO/app.po b/locale/ro_RO/app.po
index 643680e54e..2334cb923d 100644
--- a/locale/ro_RO/app.po
+++ b/locale/ro_RO/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Andra Ciuraru , 2016
# Andrei Cristian Petcu , 2012-2013
# Andrei Cristian Petcu , 2012-2013
@@ -60,7 +61,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Vitalie Zama , 2016\n"
"Language-Team: Romanian (Romania) (http://app.transifex.com/mysociety/alavetel"
@@ -501,6 +502,9 @@ msgstr "Toate opţiunile de mai jos pot utiliza varietatea sa
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "Cei mai buni jucători"
@@ -667,6 +671,9 @@ msgstr "Blocat pe acest site"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Grup de solicitări create de {{info_request_user}} la data de {{date}}."
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Începând cu"
@@ -730,6 +737,9 @@ msgstr "Anulaţi niste alerte {{site_name}} "
msgid "Cancel, return to your profile page"
msgstr "Anulează şi revino la pagina ta de profil"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Modificaţi emailul pe {{site_name}}"
@@ -998,6 +1008,9 @@ msgstr "Făcut >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Descărcaţi un fisier .zip cu toată corespondenţa"
@@ -1071,6 +1084,9 @@ msgstr "Istoric evenimente"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "Fiecare cetățean are dreptul să acceseze informațiile deținute de instituțiile publice."
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Tot ce introduci pe această pagină, inclusiv numele tău, \n"
@@ -1649,6 +1665,9 @@ msgstr "Ultima cerere vizionată {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Învață mai multe →"
@@ -2338,6 +2357,9 @@ msgstr ""
msgid "Rejected"
msgstr "Respins"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Ține-mă minte (te menține autentificate o perioadă mai lungă; nu folosi pe un computer public)"
@@ -2527,6 +2549,9 @@ msgstr "Caută contribuţia ta"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Trimiteţi o urmărire"
@@ -2563,6 +2588,30 @@ msgstr "Trimite un mesaj către {{user_name}} doar să vedeţi cum funcţioneaz
msgid "Sending..."
msgstr "Se trimite..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Trimis către o instituție publică de utilizatorul {{info_request_user}} la data {{date}}."
@@ -2629,6 +2678,9 @@ msgstr "Ieşire din cont"
msgid "Sign up"
msgstr "Înscriere "
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2688,6 +2740,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3115,9 +3170,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Există o limită a numărului de cereri pe care le puteţi face într-o zi, deoarece nu dorim ca autorităţile publice să fie bombardate cu un mare număr de cereri inadecvate. Dacă consideraţi că aveţi un motiv întemeiat pentru a cere mărirea acestei limite, vă rugăm contactaţi."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Încă nu este nimic de afișat."
@@ -3347,6 +3408,9 @@ msgstr ""
"viteza cu care autorităţile răspund la solicitări, la numărul de solicitări\n"
"care au nevoie de un răspuns scris şi multe altele."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3479,9 +3543,15 @@ msgstr "Azi"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Prea multe cereri"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Topul utilizatorilor."
@@ -3850,6 +3920,9 @@ msgstr "Scrie un mesaj ulterior instituției {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Formulează solicitarea ta într-un limbaj precis, simplu."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3979,6 +4052,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Aţi atins limita maximă pentru cereri. Utilizatorii sunt de obicei limitaţi la {{max_requests_per_user_per_day}} cereri într-un interval de 24 de ore. Veţi putea face o nouă cerere în {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4634,6 +4710,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/rw/app.po b/locale/rw/app.po
index 70c142f126..7cc01ea7bc 100644
--- a/locale/rw/app.po
+++ b/locale/rw/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Clarisse Umutesi Mwitegereze , 2014-2015
# Gareth Rees , 2015
# Graeme Porteous , 2020
@@ -44,7 +45,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Stephen Abbott Pugh , 2015\n"
"Language-Team: Kinyarwanda (http://app.transifex.com/mysociety/alaveteli/langu"
@@ -491,6 +492,9 @@ msgstr "Amahitamo yose akurikira ashobora gukoreshwaho impindukayour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Ibintu byose ushyira kuri uru rubuga, harimo amazina yawe,\n"
@@ -1638,6 +1654,9 @@ msgstr "Ikibazo giheruka kurebwa: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Menya byinshi →"
@@ -2327,6 +2346,9 @@ msgstr ""
msgid "Rejected"
msgstr "Cyanzwe"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Munyibuke (ituma ukomeza kuba ku murongo igihe kirekire; ntuyikoreshe kuri mudasobwa rusange)"
@@ -2516,6 +2538,9 @@ msgstr "Shaka inyunganizi zawe"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Ohereza ubutumwa bwo gurikirana"
@@ -2552,6 +2577,30 @@ msgstr "Oherereza ubutumwa {{user_name}} kureba gusa uko ikora "
msgid "Sending..."
msgstr "Inyandiko irikugenda…"
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Byohererejwe umuyobozi na {{info_request_user}} kuwa {{date}}."
@@ -2617,6 +2666,9 @@ msgstr "Sohoka"
msgid "Sign up"
msgstr "Funguza"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2677,6 +2729,9 @@ msgstr "Mutwihanganire ntidushoboye kongeraho ubusobanuro.Muze kongere mu gihe k
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Mwihangane,ntabow dushoboye kohereza ikibazo cyanyu.Muze kongera mu gihe kiri imbere."
@@ -3110,9 +3165,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Hari umubare ntarengwa w'ibibazo ushobora kubaza ku munsi, kuberako tutifuza ko abayobozi babazwa ibibazo byinshi bidakwiye. Niba wumva ifite impamvu ifatika yatuma usaba guhabwa umubare w'ibibazo birenze, ushobora kutwandikira."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Nta kintu cyo kugaragaza kiraboneka."
@@ -3341,6 +3402,9 @@ msgstr ""
"gihe abayobozi bafata mu gusubiza ibibazo, umubare w'ibibazo\n"
"bisubizwa hakoreshejwe iposita n'ibindi byinshi."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3475,9 +3539,15 @@ msgstr "Uyu munsi"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Ibibazo byinshi cyane"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Abakinyi bitwaye neze mu buryo buhambaye"
@@ -3844,6 +3914,9 @@ msgstr "Andika ubutumwa bukurikirana ibyo wasabye kuri {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Andika ikibazo cyawe mu magambo yoroshye kandi urasa ku ntego."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3973,6 +4046,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Wagejeje umubare w'ibibazo ntarengwa. Abakoresha uru rubuga basanzwe bemerewe ibibazo {{max_requests_per_user_per_day}} mu gihe cy'amasaha 24. Ushobora kubaza ikindi kibazo mu {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4623,6 +4699,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} ibyasabwe"
diff --git a/locale/se/app.po b/locale/se/app.po
index 5f6a049876..b2d1782b0a 100644
--- a/locale/se/app.po
+++ b/locale/se/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Northern Sami (http://app.transifex.com/mysociety/alaveteli/lan"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/si/app.po b/locale/si/app.po
index 4666056385..76022a6555 100644
--- a/locale/si/app.po
+++ b/locale/si/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Sinhala (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/sk/app.po b/locale/sk/app.po
index 6ba0834140..8faccf37e7 100644
--- a/locale/sk/app.po
+++ b/locale/sk/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Slovak (http://app.transifex.com/mysociety/alaveteli/language/s"
@@ -437,6 +438,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -599,6 +603,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -662,6 +669,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -926,6 +936,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -995,6 +1008,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1522,6 +1538,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2196,6 +2215,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2382,6 +2404,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2418,6 +2443,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2483,6 +2532,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2537,6 +2589,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2954,9 +3009,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3177,6 +3238,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3303,9 +3367,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3652,6 +3722,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3781,6 +3854,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4401,6 +4477,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/sl/app.po b/locale/sl/app.po
index c732b21090..3fea9a9725 100644
--- a/locale/sl/app.po
+++ b/locale/sl/app.po
@@ -31,9 +31,11 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Ana Šemerl Harmel, 2022
# Ana Šemerl Harmel, 2022
# Jernej Trebežnik, 2023
+# Jernej Trebežnik, 2023
# Liz Conlan , 2018
# louisecrow , 2014
# louisecrow , 2014
@@ -47,9 +49,9 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
-"Last-Translator: Jernej Trebežnik, 2023\n"
+"Last-Translator: zejn , 2013\n"
"Language-Team: Slovenian (http://app.transifex.com/mysociety/alaveteli/languag"
"e/sl/)\n"
"MIME-Version: 1.0\n"
@@ -473,6 +475,9 @@ msgstr "Pri vseh izbirah spodaj lahko uporabite variety ali your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Vse kar vpisujete na tej strani, vključno z vašim imenom, bo za vedno javno objavljeno na tej strani (zakaj?)."
@@ -1599,6 +1616,9 @@ msgstr "Zadnji pregledani zahtevek: {{request_url}}"
msgid "Latest"
msgstr "Najnovejše"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Več informacij →"
@@ -2285,6 +2305,9 @@ msgstr "Predpisi"
msgid "Rejected"
msgstr "Zavrnjeno"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Zapomni si me ( dlje časa boste ostali prijavljeni; ne uporabljajte v javno dostopnem računalniku)"
@@ -2474,6 +2497,9 @@ msgstr "Iščite po vaših prispevkih"
msgid "Section"
msgstr "Oddelek"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Pošljite odziv"
@@ -2510,6 +2536,30 @@ msgstr "Pošlji sporočilo {{user_name}}, da vidite kako deluje"
msgid "Sending..."
msgstr "Pošiljanje..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Poslal na en organ {{info_request_user}} v {{date}}."
@@ -2577,6 +2627,9 @@ msgstr "Odjava"
msgid "Sign up"
msgstr "Nov račun"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr "Prijave iz Tor so blokirane zaradi obsežne zlorabe. Prosimo, stopite v stik z nami, če je to za vas težava."
@@ -2637,6 +2690,9 @@ msgstr "Oprostite, trenutno ne moremo dodati vašega zaznamka. Prosimo poskusite
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr "Oprostite, trenutno ne moremo ustvariti vašega uporabniškega računa. Prosimo poskusite ponovno kasneje."
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Oprostite, vaše zahteve trenutno ne moremo poslati. Prosimo poskusite ponovno kasneje."
@@ -3059,9 +3115,15 @@ msgstr "Obstaja več kot ena oseba ki uporablja to stran in i
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Število pripisov, ki jih lahko naredite v enem dnevu je omejeno, ker ne želimo, da bi bilo spletno mesto bombardirano z velikim številom neprimernih pripisov. Če menite, da imate upravičen razlog za dvig te omejitve nas kontaktirajte "
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Obstaja omejitev na število dnevnih zahtevkov, ki jih lahko naredite, ker ne želimo javnih organov zasuti z veliko količino zahtevkov z neprimernimi zahtevami. Če se vam zdi, da imate upravičen razlog za dvig omejitve, nas kontaktirajte."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Ni ničesar za prikazati."
@@ -3286,6 +3348,9 @@ msgstr "Ta stran s statistikami o javnih organih je trenutno v preizkusni fazi,
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Ta tabela prikazuje tehnične podrobnosti internih dogodkov, ki so se dogajali na tem zahtevku na {{site_name}}. To lahko uporabite, da zgenerirate informacije o odzivnosti oz. hitrosti, s katero organi odgovarjajo na zahteve, število zahtev ki zahtevajo poštno pošiljanje in še mnogo več."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Uporabnik je bil izključen iz {{site_name}} "
@@ -3414,9 +3479,15 @@ msgstr "Danes"
msgid "Too many annotations"
msgstr "Preveč opomb"
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Preveč zahtevkov"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Najboljši nedavni prosilci"
@@ -3769,6 +3840,9 @@ msgstr "Napišite nadaljnje sporočilo za dostop do informacij javnega značaja
msgid "Write your request in simple, precise language."
msgstr "Zapišite vaš zahtevek v enostavnem in nedvoumnem jeziku."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Da"
@@ -3907,6 +3981,9 @@ msgstr "Dosegli ste limit komentarjev. Uporabniki so ponavadi omejeni na {{comme
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Prišli ste do omejitve števila novih zahtevkov. Uporabniki so običajno omejeni na {{max_requests_per_user_per_day}} na 24 urno obdobje. Nov zahtevek boste lahko naredili v {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Zapustili ste projekt."
@@ -4563,6 +4640,11 @@ msgstr[1] "{{number_of_comments}} komentarjev"
msgstr[2] "{{number_of_comments}} komentarjev"
msgstr[3] "{{number_of_comments}} komentarjev"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} zahteva"
diff --git a/locale/sq/app.po b/locale/sq/app.po
index aac84b18dd..28b028c912 100644
--- a/locale/sq/app.po
+++ b/locale/sq/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# arianit , 2022
# arianit , 2012
# arianit , 2012,2022
@@ -50,7 +51,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Valon , 2011\n"
"Language-Team: Albanian (http://app.transifex.com/mysociety/alaveteli/language"
@@ -482,6 +483,9 @@ msgstr "Te gjitha opsionet si me poshte mund te perdorin varietyyour name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Çdo gjë që ke shkruar në këtë faqe, përfshi edhe emrin tënd, \n"
@@ -1584,6 +1600,9 @@ msgstr "Kerkesa e fundit e pare: {{request_url}}"
msgid "Latest"
msgstr "Më të fundit"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Meso me teper →"
@@ -2265,6 +2284,9 @@ msgstr "Rregullorja"
msgid "Rejected"
msgstr "Refuzuar"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Më kutjo mua (të mban signed in më gjatë; mos e përdorni në kompjutera publik)"
@@ -2454,6 +2476,9 @@ msgstr "Kërko kontributet e tua"
msgid "Section"
msgstr "Seksioni"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Dërgo mesazh vijues"
@@ -2490,6 +2515,30 @@ msgstr "Dërgo mesazh tek {{user_name}} vetëm për të parë se si funksionon"
msgid "Sending..."
msgstr "Duke derguar..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Derguar tek nje institucion nga {{info_request_user}} me {{date}}."
@@ -2555,6 +2604,9 @@ msgstr "Ç'kyçu"
msgid "Sign up"
msgstr "Regjistrohu"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr "Regjistrimet nga Tor janë bllokuar për shkak të keqpërdorimit të gjerë. Ju lutemi na kontaktoni nëse ky është një problem për ju."
@@ -2611,6 +2663,9 @@ msgstr "Na vjen keq që për momentin nuk mund të shtojmë shënimin. Provoni p
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr "Na vjen keq, për momentin nuk jemi të gjendje të krijojmë llogarinë tuaj. Provo më vonë."
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Na vjen keq, për momentin nuk mund të dërgojmë kërkesën. Provo prap më vonë."
@@ -3036,9 +3091,15 @@ msgstr "Ka më shumë se një person që përdor këtë faqe dhe ka këtë emër
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Ekziston një kufi në numrin e shënimeve që mund të bëni brenda një dite, sepse ne nuk duam që faqja të bombardohet me një numër të madh shënimesh të papërshtatshme. Nëse mendoni se keni një arsye të mirë për të kërkuar heqjen e kufirit në rastin tuaj, ju lutemi na kontaktoni."
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Ka nje kufi lidhur me numrin e kerkesave qe mund te dergoni ne nje dite, sepse nuk duam qe institucionet publike te bombardohen me nje numer te madh kerkesash te papershtatshme. Nese ju mnedoni se keni asye te forta per te kerkuar anullimin e kufirit per rastin tuaj, ju lutem na kontaktoni."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Nuk ka ende asgje per t'u shfaqur"
@@ -3264,6 +3325,9 @@ msgstr ""
"shpejtësisë me të cilën institucionet i përgjigjen kërkesave, numrit të kërkesave\n"
"që kërkojne përgjigje postale dhe gjëra të tjera."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Ky përdorues është pezulluar nga {{site_name}} "
@@ -3392,9 +3456,15 @@ msgstr "Sot"
msgid "Too many annotations"
msgstr "Shumë shënime"
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Shumë kërkesa"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Top lojtarë e rishtëm"
@@ -3747,6 +3817,9 @@ msgstr "Shkruaj mesazhin tënd pasues QDP te {{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "Shkruaje kërkesën tënde me gjuhë të thjeshtë, dhe të saktë."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Po"
@@ -3878,6 +3951,9 @@ msgstr "Keni arritur kufirin e tarifës për shënimet. Përdoruesit zakonisht k
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Keni mberritur ne kufirin e kerkesave te reja. Perdoruesit zakonisht jane te kufizuar ne dergimin e {{max_requests_per_user_per_day}} kerkesave per nje periudhe 24 oreshe. Ju do keni mundesi te beni nje kerkese tjeter ne{{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Keni lënë projektin."
@@ -4514,6 +4590,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} koment"
msgstr[1] "{{number_of_comments}} komente"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} kërkesë"
diff --git a/locale/sr/app.po b/locale/sr/app.po
index a9290ce0e9..4e5df020e8 100644
--- a/locale/sr/app.po
+++ b/locale/sr/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Serbian (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -437,6 +438,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -599,6 +603,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -662,6 +669,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -926,6 +936,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -995,6 +1008,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1522,6 +1538,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2196,6 +2215,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2382,6 +2404,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2418,6 +2443,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2483,6 +2532,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2537,6 +2589,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2954,9 +3009,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3177,6 +3238,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3303,9 +3367,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3652,6 +3722,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3781,6 +3854,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4401,6 +4477,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/sr@latin/app.po b/locale/sr@latin/app.po
index 8d542df7df..d595f5cf1c 100644
--- a/locale/sr@latin/app.po
+++ b/locale/sr@latin/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Aleksandar Krstić , 2015
# Goran Rakic , 2013
# Goran Vučković , 2013
@@ -47,7 +48,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Goran Vučković , 2013\n"
"Language-Team: Serbian (Latin) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -495,6 +496,9 @@ msgstr "Sve opcije ispod mogu da koriste variety ili la
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -663,6 +667,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Počevši sa"
@@ -726,6 +733,9 @@ msgstr "Otkaži neka {{site_name}} upozorenja"
msgid "Cancel, return to your profile page"
msgstr "Otkaži i vrati se na stranicu sa profilom korisnika"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Promenite e-mail adresu na {{site_name}}"
@@ -994,6 +1004,9 @@ msgstr "Urađeno >>"
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Preuzmite svu korespondenciju u zip fajlu"
@@ -1067,6 +1080,9 @@ msgstr "Istorija promena"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Sve što unesete na ovu stranicu, uključujući i Vaše ime, \n"
@@ -1640,6 +1656,9 @@ msgstr "Poslednji pregledani zahtev: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2329,6 +2348,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2518,6 +2540,9 @@ msgstr "Tražite Vaše doprinose"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Pošaljite reakciju"
@@ -2554,6 +2579,30 @@ msgstr "Pošalji poruku za {{user_name}} samo da vidite kako radi"
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2619,6 +2668,9 @@ msgstr "Odjavite se"
msgid "Sign up"
msgstr "Registrujte se"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2679,6 +2731,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3113,9 +3168,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Postoji ograničenje broja zahteva koje možete podneti u jednom danu, pošto želimo da izbegnemo da javne ustanove budu bombardovane velikim brojem neprikladnih zahteva. Ako mislite da u Vašem slučaju ovo ograničenje treba ukloniti, molimo da nam se javite."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3345,6 +3406,9 @@ msgstr ""
"brzine kojom ustanove odgovaraju na zahteve, broja zahteva\n"
"koji zahtevaju poštanski odgovor - i mnogo drugih namena."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3477,9 +3541,15 @@ msgstr "Danas"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Previše zahteva"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3847,6 +3917,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Pišite Vaš zahtev jednostavnim, preciznim jezikom."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3976,6 +4049,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Dostigli ste limit broja unetih zahteva dnevno. Uobičajeni limit za korisnike sistema je {{max_requests_per_user_per_day}} podnetih zahteva u periodu od 24h. Novi zahtev ćete moći podneti {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4628,6 +4704,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/sv/app.po b/locale/sv/app.po
index bfa2b190fd..397d901fca 100644
--- a/locale/sv/app.po
+++ b/locale/sv/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# 03992e16f8df6e39b9d1cc0ff635887e, 2016
# Elenor Weijmar, 2018
# Elenor Weijmar, 2018-2022
@@ -54,7 +55,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Mattias Axell , 2015,2019-2022\n"
"Language-Team: Swedish (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -474,6 +475,9 @@ msgstr "Alla alternativen nedan kan använda variety eller your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Allt som du anger på denna sida, inklusive ditt namn, kommer att visas offentligt på denna hemsida för evigt"
@@ -1563,6 +1579,9 @@ msgstr "Senast visade begäran: {{request_url}}"
msgid "Latest"
msgstr "Senaste"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Lär dig mer →"
@@ -2240,6 +2259,9 @@ msgstr "Reglering"
msgid "Rejected"
msgstr "Nekad"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Kom ihåg mig (håller dig inloggad längre; använd inte i en publik dator i offentlig miljö)"
@@ -2426,6 +2448,9 @@ msgstr "Sök dina bidrag"
msgid "Section"
msgstr "Sektion"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Skicka en uppföljning"
@@ -2462,6 +2487,30 @@ msgstr "Skicka meddelande till {{user_name}} bara för att se hur det fungerar"
msgid "Sending..."
msgstr "Skickar..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "Skickat till en myndighet av {{info_request_user}} den {{date}}."
@@ -2527,6 +2576,9 @@ msgstr "Logga ut"
msgid "Sign up"
msgstr "Registrera dig"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr "Registreringar från Tor har blockerats på grund av extensiva missbruk. Vänligen kontakta oss anonymt om detta är ett problem för dig."
@@ -2581,6 +2633,9 @@ msgstr "Ursäkta, vi kan för närvarande inte lägga till din anteckning. Vänl
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr "Förlåt, vi kan för närvarande inte skapa ditt konto. Vänligen försök igen senare."
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "Ursäkta, vi kan för närvarande inte skicka din begäran. Vänligen försök igen senare."
@@ -2998,9 +3053,15 @@ msgstr "Det finns fler än en person som använder denna sida o
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Det finns en gräns för antalet kommentarer du kan göra på en dag. Om du känner att du har en bra anledning att begära att gränsen hävs i ditt fall, vänligen hör av dig."
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Det finns en gräns för antalet förfrågningar som du kan göra på en dag. Detta eftersom myndigheterna inte ska överbelastas med för stort antal förfrågningar. Om du har en bra anledning att få begränsningen borttagen i ditt fall, vänligen ta kontakt med oss."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Det finns inget att visa än."
@@ -3221,6 +3282,9 @@ msgstr "Denna sida för statistik om förfrågningar och myndigheter på Handlin
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "Denna tabell visar de tekniska detaljerna av de interna händelser som hänt denna begäran på {{site_name}}. Detta kan användas för att generera information om den hastighet myndigheter har för att svara på förfrågningar, antalet förfrågningar som kräver ett postsvar och mycket mer."
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "Denna användare har blivit avstängd från {{site_name}} "
@@ -3347,9 +3411,15 @@ msgstr "Idag"
msgid "Too many annotations"
msgstr "För många kommentarer"
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "För många förfrågningar"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "Nyligen hjälpsamma användare"
@@ -3696,6 +3766,9 @@ msgstr "Skriv ditt uppföljningssvar angående begäran om allmän handling till
msgid "Write your request in simple, precise language."
msgstr "Skriv din begäran i enkelt, tydligt språk."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "Ja"
@@ -3825,6 +3898,9 @@ msgstr "Du har nått gränsen för anteckningar/kommentarer. Användare är vanl
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Du har nått gränsen för att göra nya förfrågningar. Användare är vanligtvis begränsade till {{max_requests_per_user_per_day}} förfrågningar under en 24-timmarsperiod. Du kommer att kunna göra förfrågningar igen om {{can_make_another_request}}."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "Du har lämnat projektet."
@@ -4455,6 +4531,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}} kommentar"
msgstr[1] "{{number_of_comments}} kommentarer"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} begäran"
diff --git a/locale/sw_KE/app.po b/locale/sw_KE/app.po
index 61d4551c1c..317750236b 100644
--- a/locale/sw_KE/app.po
+++ b/locale/sw_KE/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Swahili (Kenya) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/tr/app.po b/locale/tr/app.po
index 5ad6032425..c400b1651d 100644
--- a/locale/tr/app.po
+++ b/locale/tr/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Baran Ozgul , 2012
# Baran Ozgul , 2012
# Baran Ozgul , 2012
@@ -45,7 +46,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Senol Kaya , 2018\n"
"Language-Team: Turkish (http://app.transifex.com/mysociety/alaveteli/language/"
@@ -477,6 +478,9 @@ msgstr "Aşağıdaki tüm seçenekler iki nokta üst üste işaretinden önce your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "Bu sayfada adınız dahil girdiğiniz her türlü bilgi sonsuza kadar bu web sitesindehalka açık şekilde görünür olacaktır. "
@@ -1585,6 +1601,9 @@ msgstr "Görüntülenen en son başvuru: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "Daha fazla bilgi →"
@@ -2261,6 +2280,9 @@ msgstr ""
msgid "Rejected"
msgstr "Reddedildi"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Beni hatırla (siteye giriş yaptıktan sonra, daha uzun süre kalmanızı sağlar. Halka açık bir bilgisayarda kullanmayın)"
@@ -2452,6 +2474,9 @@ msgstr "Kendi katkılarınızı arayın"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Bir takip iletisi gönderin"
@@ -2488,6 +2513,30 @@ msgstr "Şu adrese mesaj gönder {{user_name}} nasıl çalıştığını bir gö
msgid "Sending..."
msgstr "Gönderiliyor..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "{{info_request_user}} tarafından {{date}} tarihinde {{authority_count}} kuruluşa gönderildi"
@@ -2553,6 +2602,9 @@ msgstr "Hesabınızdan çıkış yapın"
msgid "Sign up"
msgstr "Hesap oluşturun"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2611,6 +2663,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3032,9 +3087,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Bir gün içinde yapabileceğiniz bilgi edinme başvurusu sınırlıdır çünkü kamu kurum ve kuruluşlarının çok sayıda gönderilmiş uygunsuz başvuruyla bir mesaj bombardmanına maruz kalmasını istemiyoruz. Eğer sizin durumunuzda bu sınırın kaldırılması için iyi bir neden olduğunu düşünüyorsanız lütfen bizimle iletişime geçin."
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "Henüz gösterilecek bir şey yok. "
@@ -3260,6 +3321,9 @@ msgstr ""
" {{site_name}} sitesinde bu başvuruyla ilgili site içinde gerçekleşmiş adımların teknik detaylarını görebilirsiniz. Bu tablo, kamu kuruluşlarının başvurulara cevap verme hızı\n"
", postayla cevap verilmesi gereken başvuru sayısı ve birçok başka konuda bilgi üretmek için kullanılabilir. "
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3396,9 +3460,15 @@ msgstr "Bugün"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Çok fazla sayıda başvuru"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3755,6 +3825,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Başvurunuzu sade, net bir dille yazın."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3884,6 +3957,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Yeni başvurulara uygulanan sınıra eriştiniz. Kullancılar normal koşullarda 24 saatlik bir süre zarfında en çok {{max_requests_per_user_per_day}} başvuru yapabilir. {{can_make_another_request}} sonra yeni bir başvuru yapabilirsiniz. "
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4522,6 +4598,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/tr_TR/app.po b/locale/tr_TR/app.po
index a7d2b4bdb6..766f786bca 100644
--- a/locale/tr_TR/app.po
+++ b/locale/tr_TR/app.po
@@ -31,12 +31,13 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Senol Kaya , 2018
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Senol Kaya , 2018\n"
"Language-Team: Turkish (Turkey) (http://app.transifex.com/mysociety/alaveteli/"
@@ -469,6 +470,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -631,6 +635,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -694,6 +701,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -958,6 +968,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -1027,6 +1040,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1554,6 +1570,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2228,6 +2247,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2414,6 +2436,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2450,6 +2475,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2515,6 +2564,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2569,6 +2621,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2986,9 +3041,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3209,6 +3270,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3335,9 +3399,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3684,6 +3754,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3813,6 +3886,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4433,6 +4509,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/uk/app.po b/locale/uk/app.po
index b1ad59a63e..893b2120a8 100644
--- a/locale/uk/app.po
+++ b/locale/uk/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Ferents , 2013
# Ferents , 2013
# Gareth Rees , 2017
@@ -46,7 +47,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Natalie Hiirulainen , 2012,2014,2016-2019"
",2021\n"
@@ -480,6 +481,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -644,6 +648,9 @@ msgstr "Забанено"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "Група запитів створена користувачем {{info_request_user}} {{date}}"
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "Ті, що починаються з"
@@ -707,6 +714,9 @@ msgstr "Скасувати деякі повідомлення сайту"
msgid "Cancel, return to your profile page"
msgstr "Скасувати, повернутися на сторінку профілю"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "Змінити електронну адресу на сайті"
@@ -975,6 +985,9 @@ msgstr "Зроблено "
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "Завантажити zip-архів усієї переписки"
@@ -1048,6 +1061,9 @@ msgstr "Історія"
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
"Усе, що ви введете на цій сторінці (включно з вашим іменем), \n"
@@ -1614,6 +1630,9 @@ msgstr "Останній переглянутий запит: {{request_url}}"
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2297,6 +2316,9 @@ msgstr ""
msgid "Rejected"
msgstr "Відхилено"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "Запам’ятати мене"
@@ -2485,6 +2507,9 @@ msgstr "Пошук у вашій активності на сайті"
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "Надішліть додатковий запит"
@@ -2521,6 +2546,30 @@ msgstr "Надіслати повідомлення до {{user_name}} прос
msgid "Sending..."
msgstr "Надислаю..."
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2586,6 +2635,9 @@ msgstr "Вийти"
msgid "Sign up"
msgstr "Зареєструватися"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2640,6 +2692,9 @@ msgstr "Вибачте, зараз ми не можемо додати ваш к
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -3059,9 +3114,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "Ми встановили обмеження на кількість запитів, які можна відправитипротягом одного дня. Ви можете попросити про зняття цього обмеження, написавши нам. Ваше прохання має бути обґрунтованим"
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3290,6 +3351,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3418,9 +3482,15 @@ msgstr "Сьогодні"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "Забагато запитів"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3781,6 +3851,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr "Використовуйте в запиті просту, зрозумілу мову."
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3910,6 +3983,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "Ви перевищили кількість дозволених запитів. Користувачі не можуть надсилати більш ніж{{max_requests_per_user_per_day}} запитів протягом 24 годин."
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4567,6 +4643,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}} запит"
diff --git a/locale/vi/app.po b/locale/vi/app.po
index 32b0c17bc0..04d91a44e1 100644
--- a/locale/vi/app.po
+++ b/locale/vi/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# Anh Phan , 2013
# Anh Phan , 2013
# Anh Phan , 2013
@@ -40,7 +41,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Anh Phan , 2013\n"
"Language-Team: Vietnamese (http://app.transifex.com/mysociety/alaveteli/langua"
@@ -441,6 +442,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -603,6 +607,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -666,6 +673,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -930,6 +940,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -999,6 +1012,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1526,6 +1542,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2200,6 +2219,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2386,6 +2408,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2422,6 +2447,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2487,6 +2536,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2541,6 +2593,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2958,9 +3013,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3181,6 +3242,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3309,9 +3373,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3658,6 +3728,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3787,6 +3860,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4407,6 +4483,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/yue/app.po b/locale/yue/app.po
index a60183730b..d4105ee8b3 100644
--- a/locale/yue/app.po
+++ b/locale/yue/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Cantonese (http://app.transifex.com/mysociety/alaveteli/languag"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/zh_CN/app.po b/locale/zh_CN/app.po
index f037af0802..32eb98a0d5 100644
--- a/locale/zh_CN/app.po
+++ b/locale/zh_CN/app.po
@@ -31,11 +31,12 @@
# Translators:
# Translators:
# Translators:
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Graeme Porteous \n"
"Language-Team: Chinese (China) (http://app.transifex.com/mysociety/alaveteli/l"
@@ -436,6 +437,9 @@ msgstr ""
msgid "All time"
msgstr ""
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr ""
@@ -598,6 +602,9 @@ msgstr ""
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr ""
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr ""
@@ -661,6 +668,9 @@ msgstr ""
msgid "Cancel, return to your profile page"
msgstr ""
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr ""
@@ -925,6 +935,9 @@ msgstr ""
msgid "Download Data"
msgstr ""
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr ""
@@ -994,6 +1007,9 @@ msgstr ""
msgid "Every citizen has the right to access information held by public authorities."
msgstr ""
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr ""
@@ -1521,6 +1537,9 @@ msgstr ""
msgid "Latest"
msgstr ""
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr ""
@@ -2195,6 +2214,9 @@ msgstr ""
msgid "Rejected"
msgstr ""
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr ""
@@ -2381,6 +2403,9 @@ msgstr ""
msgid "Section"
msgstr ""
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr ""
@@ -2417,6 +2442,30 @@ msgstr ""
msgid "Sending..."
msgstr ""
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] ""
@@ -2482,6 +2531,9 @@ msgstr ""
msgid "Sign up"
msgstr ""
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2536,6 +2588,9 @@ msgstr ""
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr ""
@@ -2953,9 +3008,15 @@ msgstr ""
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr ""
@@ -3176,6 +3237,9 @@ msgstr ""
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr ""
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr ""
@@ -3302,9 +3366,15 @@ msgstr ""
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr ""
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr ""
@@ -3651,6 +3721,9 @@ msgstr ""
msgid "Write your request in simple, precise language."
msgstr ""
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr ""
@@ -3780,6 +3853,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr ""
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr ""
@@ -4400,6 +4476,11 @@ msgid_plural "{{number_of_comments}} comments"
msgstr[0] ""
msgstr[1] ""
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] ""
diff --git a/locale/zh_HK/app.po b/locale/zh_HK/app.po
index 1385349dfc..ba7161085d 100644
--- a/locale/zh_HK/app.po
+++ b/locale/zh_HK/app.po
@@ -31,6 +31,7 @@
# Translators:
# Translators:
# Translators:
+# Translators:
# beckymak , 2015
# caxekis , 2013
# caxekis , 2013
@@ -51,7 +52,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2011-03-09 17:48+0000\n"
"Last-Translator: Yan Hin So , 2020\n"
"Language-Team: Chinese (Hong Kong) (http://app.transifex.com/mysociety/alavete"
@@ -459,6 +460,9 @@ msgstr "以下所有選項可在冒號前用variety或l
msgid "All time"
msgstr "歷來"
+msgid "All time best contributors"
+msgstr ""
+
msgid "All time best players"
msgstr "歷來最佳玩家"
@@ -621,6 +625,9 @@ msgstr "禁止進入本網站"
msgid "Batch created by {{info_request_user}} on {{date}}."
msgstr "{{info_request_user}}於{{date}}建立本批量要求。"
+msgid "Before you start"
+msgstr ""
+
msgid "Beginning with"
msgstr "開始"
@@ -684,6 +691,9 @@ msgstr "取消{{site_name}}的一些提示"
msgid "Cancel, return to your profile page"
msgstr "取消並返回個人簡介"
+msgid "Cannot send messages"
+msgstr ""
+
msgid "Change email on {{site_name}}"
msgstr "更換在{{site_name}}使用的電郵地址"
@@ -948,6 +958,9 @@ msgstr "完成 >>"
msgid "Download Data"
msgstr "下載資料"
+msgid "Download Leaderboard Data"
+msgstr ""
+
msgid "Download a zip file of all correspondence"
msgstr "下載含全部回覆的壓縮檔案"
@@ -1017,6 +1030,9 @@ msgstr "過往活動"
msgid "Every citizen has the right to access information held by public authorities."
msgstr "每一位公民都有權向公共機構索取資料。"
+msgid "Everything that you enter on this page, including your name ({{user_name}}), will be displayed publicly on this website forever"
+msgstr ""
+
msgid "Everything that you enter on this page, including your name, will be displayed publicly on this website forever"
msgstr "你在本頁輸入的所有資料(包括你的姓名),將會在本站永久公開顯示。"
@@ -1540,6 +1556,9 @@ msgstr "最後已讀要求:{{request_url}}"
msgid "Latest"
msgstr "最新"
+msgid "Latest news and campaigns"
+msgstr ""
+
msgid "Learn more →"
msgstr "了解更多 →"
@@ -2213,6 +2232,9 @@ msgstr "規例"
msgid "Rejected"
msgstr "拒絕提供資料"
+msgid "Related blog posts"
+msgstr ""
+
msgid "Remember me (keeps you signed in longer; do not use on a public computer)"
msgstr "記住我(延長保留你的登入狀態;不要在公共電腦上使用此功能)"
@@ -2399,6 +2421,9 @@ msgstr "搜尋你提供的資料"
msgid "Section"
msgstr "部份"
+msgid "See all →"
+msgstr ""
+
msgid "Send a followup"
msgstr "跟進要求"
@@ -2435,6 +2460,30 @@ msgstr "向{{user_name}}發出訊息,以體驗通訊系統"
msgid "Sending..."
msgstr "傳送中……"
+msgid "Sent a follow up to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent a follow up to {{public_body_name}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_link}} again."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again, using a new contact address."
+msgstr ""
+
+msgid "Sent request to {{public_body_name}} again."
+msgstr ""
+
msgid "Sent to one authority by {{info_request_user}} on {{date}}."
msgid_plural "Sent to {{authority_count}} authorities by {{info_request_user}} on {{date}}."
msgstr[0] "{{info_request_user}}於{{date}}發至{{authority_count}}個公共機構。"
@@ -2499,6 +2548,9 @@ msgstr "登出"
msgid "Sign up"
msgstr "登記"
+msgid "Signing your request"
+msgstr ""
+
msgid "Signups from Tor have been blocked due to extensive misuse. Please contact us if this is a problem for you."
msgstr ""
@@ -2553,6 +2605,9 @@ msgstr "抱歉,我們現時無法加入你的備註,請稍後再作備註。
msgid "Sorry, we're currently unable to create your account. Please try again later."
msgstr ""
+msgid "Sorry, we're currently unable to send your message. Please try again later."
+msgstr ""
+
msgid "Sorry, we're currently unable to send your request. Please try again later."
msgstr "抱歉,我們現時無法寄出你的要求,請稍後再寄。"
@@ -2970,9 +3025,15 @@ msgstr "有多過一個人利用此網站及擁有此名稱。
msgid "There is a limit on the number of annotations you can make in a day because we don’t want the site to be bombarded with large numbers of inappropriate annotations. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr ""
+msgid "There is a limit on the number of messages you can send in a day because we don’t want users to be bombarded with large numbers of inappropriate messages. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
+msgstr ""
+
msgid "There is a limit on the number of requests you can make in a day, because we don’t want public authorities to be bombarded with large numbers of inappropriate requests. If you feel you have a good reason to ask for the limit to be lifted in your case, please get in touch."
msgstr "因為我們不希望公共機構收到過量不恰當的要求,所以你每天能夠提出的要求設有上限。如果你認為有足夠理由要求撤銷上限, 請聯絡我們。"
+msgid "There is also a limit on the speed at which you are able to create annotations. Please try again later if you have not hit your daily limit."
+msgstr ""
+
msgid "There is nothing to display yet."
msgstr "暫未有內容顯示。"
@@ -3191,6 +3252,9 @@ msgstr "目前仍在試驗這個在公共機構統計的部份,請用家謹記
msgid "This table shows the technical details of the internal events that happened to this request on {{site_name}}. This could be used to generate information about the speed with which authorities respond to requests, the number of requests which require a postal response and much more."
msgstr "此列表顯示了些內部事件的技術細節,那些事件都曾出現於載列在{{site_name}}的本項要求。這些細節或用以了解公共機構的回應速度、需以郵寄方式回覆要求的數目等。"
+msgid "This user does not accept user to user messages."
+msgstr ""
+
msgid "This user has been suspended from {{site_name}} "
msgstr "此用戶已被{{site_name}}封鎖。"
@@ -3317,9 +3381,15 @@ msgstr "今天"
msgid "Too many annotations"
msgstr ""
+msgid "Too many messages"
+msgstr ""
+
msgid "Too many requests"
msgstr "過多要求"
+msgid "Top recent contributors"
+msgstr ""
+
msgid "Top recent players"
msgstr "近期的頂級玩家"
@@ -3664,6 +3734,9 @@ msgstr "撰寫索取資料要求,並傳予{{authority_name}}"
msgid "Write your request in simple, precise language."
msgstr "請以顯淺易明的文字撰寫要求。"
+msgid "Writing your request"
+msgstr ""
+
msgid "Yes"
msgstr "是"
@@ -3790,6 +3863,9 @@ msgstr ""
msgid "You have hit the rate limit on new requests. Users are ordinarily limited to {{max_requests_per_user_per_day}} requests in any rolling 24-hour period. You will be able to make another request in {{can_make_another_request}}."
msgstr "你已達到發出新要求的上限。一般用戶只可在連續24小時內提出最多{{max_requests_per_user_per_day}}個請求。你可於{{can_make_another_request}}再提出請求。"
+msgid "You have hit the rate limit on user messages. Users are ordinarily limited to {{message_limit}} messages per day."
+msgstr ""
+
msgid "You have left the project."
msgstr "你已離開項目。"
@@ -4393,6 +4469,11 @@ msgid "{{number_of_comments}} comment"
msgid_plural "{{number_of_comments}} comments"
msgstr[0] "{{number_of_comments}}則評論"
+msgid "{{number_of_contributions}} contribution"
+msgid_plural "{{number_of_contributions}} contributions"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "{{number_of_requests}} request"
msgid_plural "{{number_of_requests}} requests"
msgstr[0] "{{number_of_requests}}項要求"
diff --git a/locale_alaveteli_pro/app.pot b/locale_alaveteli_pro/app.pot
index 7aa3aec457..ed8ad754b4 100644
--- a/locale_alaveteli_pro/app.pot
+++ b/locale_alaveteli_pro/app.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2017-01-20 17:40+0000\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -436,6 +436,9 @@ msgstr ""
msgid "Friendly support"
msgstr ""
+msgid "From"
+msgstr ""
+
msgid "From this screen you can get a helpful overview of your requests, and use quick actions to keep them up to date. Why not start your first one now?"
msgstr ""
@@ -499,9 +502,6 @@ msgstr ""
msgid "Important info about requests to this authority"
msgstr ""
-msgid "Introductory Pricing"
-msgstr ""
-
msgid "Investigating asbestos use in schools"
msgstr ""
diff --git a/locale_alaveteli_pro/en/app.po b/locale_alaveteli_pro/en/app.po
index b4e7bd1f09..d386eec5e9 100644
--- a/locale_alaveteli_pro/en/app.po
+++ b/locale_alaveteli_pro/en/app.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: alaveteli\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-12-22 13:14+0000\n"
+"POT-Creation-Date: 2023-04-20 14:26+0100\n"
"PO-Revision-Date: 2017-01-20 17:40+0000\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -436,6 +436,9 @@ msgstr "For journalists, academics and power users"
msgid "Friendly support"
msgstr "Friendly support"
+msgid "From"
+msgstr ""
+
msgid "From this screen you can get a helpful overview of your requests, and use quick actions to keep them up to date. Why not start your first one now?"
msgstr "From this screen you can get a helpful overview of your requests, and use quick actions to keep them up to date. Why not start your first one now?"
@@ -499,9 +502,6 @@ msgstr "Image credits:"
msgid "Important info about requests to this authority"
msgstr "Important info about requests to this authority"
-msgid "Introductory Pricing"
-msgstr "Introductory Pricing"
-
msgid "Investigating asbestos use in schools"
msgstr "Investigating asbestos use in schools"
From a9fd74b67734861c078582df2a2bedd64085c91d Mon Sep 17 00:00:00 2001
From: Graeme Porteous
Date: Fri, 28 Apr 2023 11:41:22 +0100
Subject: [PATCH 289/289] Bump Alaveteli to 0.43.0.0
---
config/initializers/alaveteli.rb | 2 +-
doc/CHANGES.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index 11dab0a91c..c2e41bd542 100644
--- a/config/initializers/alaveteli.rb
+++ b/config/initializers/alaveteli.rb
@@ -10,7 +10,7 @@
load "util.rb"
# Application version
-ALAVETELI_VERSION = '0.42.0.1'
+ALAVETELI_VERSION = '0.43.0.0'
# Add new inflection rules using the following format
# (all these examples are active by default):
diff --git a/doc/CHANGES.md b/doc/CHANGES.md
index 110f76542e..7e6d47193f 100644
--- a/doc/CHANGES.md
+++ b/doc/CHANGES.md
@@ -1,4 +1,4 @@
-# develop
+# 0.43.0.0
## Highlighted Features