| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ruby can natively decode uuencoded text with String#unpack. [1] This
avoids the uuencode program dependency and avoids writing tempfiles.
The actual implementation is taken from mail [2]. The UnixToUnix module
is not available in our bundled version of mail.
This commit includes a spec to illustrate the failure of uuencode(1) to
decode the particular attachment in incoming-request-bad-uuencoding-2.
email. Parsing with uuencode returns the following error:
External Command: Error from command "uudecode -o /dev/stdout
/tmp/foiuu20150530-14811-u6j936":
uudecode: /tmp/foiuu20150530-14811-u6j936: No `end' line
The file _is_ created and appears to be OK, but the exit code is 1. This
causes AlaveteliExternalCommand to fail and return nil.
See #2508 [3] for the bug report.
[1] http://ruby-doc.org/core-1.8.7/String.html#method-i-unpack
[2] https://github.com/mikel/mail/blob/bc4c9bb9321e9d36a678692f2f562d3146b63f78/lib/mail/encodings/unix_to_unix.rb#L7
[3] https://github.com/mysociety/alaveteli/issues/2508
|
|
|
|
|
| |
each instead of for
remove self
avoid explicit return
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I think I was wrong in a83b379fd2d676172855825d0592937b234371e2 in
assuming that all email gets properly encoded for transfer. Looking
at the mail gem load method
https://github.com/mikel/mail/blob/b159e0a542962fdd5e292a48cfffa560d7cf412e/lib/mail/mail.rb#L175a,
it reads raw email content from a file in binary mode. So this commit
makes both reading and writing the raw_email a binary mode operation
and adds a data_as_text method for displaying the data in the admin
interface that coerces it to valid utf-8.
|
|/ |
|
|
|
|
|
|
|
|
|
|
| |
mb_chars provides a multibyte-aware wrapper for strings. It should
have no effect on ruby 1.9.3 and above. Although ruby 1.8.7 wouldn't
raise errors on a badly sliced multibyte string, on upgrading to ruby
1.9.3 and above, string operations such as gsub, match and join may
produce ArgumentErrors with the message "invalid byte sequence in UTF-8".
Additionally, a database with 'UTF-8' encoding may produce the error
"PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8""
|
|\
| |
| |
| | |
into hotfix/0.21.0.30
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Stops the RequestMailer trying to send a stopped_responses mail if the
To: address can’t be parsed from the incoming message.
ArgumentError:
An SMTP To address is required to send a message. Set the message
smtp_envelope_to, to, cc, or bcc address.
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Prevents mailin exiting with an error code of 75 and sending error
reports to the team@ email address.
|
| |
| |
| |
| | |
Extract email collection to explaining variable
|
|/
|
|
|
|
|
| |
Without this line, strings created in the file will use the default
external encoding set by the ENV variable LANG. When processes are
forked or run in cron, this may not be preserved, so better to
set explicitly.
|
|
|
|
|
| |
If you run an Alaveteli in a region where we can’t show holiday
suggestions the holiday import page breaks. This commit rescues from
an unavailable region so that we display a friendly error message.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prevents loading of all outgoing messages related to the info request.
Before
OutgoingMessage Load (1.5ms) SELECT "outgoing_messages".* FROM
"outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137
ORDER BY created_at
After
OutgoingMessage Load (0.8ms) SELECT "outgoing_messages".* FROM
"outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137
ORDER BY created_at LIMIT 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reduces the amount of queries to associated objects by directly checking the
database before setting the default body content.
Before
> info_request.outgoing_messages
OutgoingMessage Load (0.4ms) SELECT "outgoing_messages".* FROM "outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137 ORDER BY created_at
InfoRequest Load (0.5ms) SELECT "info_requests".* FROM "info_requests" WHERE "info_requests"."id" = 137 LIMIT 1
PublicBody Load (0.5ms) SELECT "public_bodies".* FROM "public_bodies" WHERE "public_bodies"."id" = 16 LIMIT 1
HasTagString::HasTagStringTag Load (0.4ms) SELECT "has_tag_string_tags".* FROM "has_tag_string_tags" WHERE "has_tag_string_tags"."model_id" = 16 AND (model = 'PublicBody')
CensorRule Load (0.4ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."info_request_id" IS NULL AND "censor_rules"."public_body_id" IS NULL AND "censor_rules"."user_id" IS NULL
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 13 LIMIT 1
(0.5ms) SELECT COUNT(*) FROM "censor_rules" WHERE "censor_rules"."user_id" = 13
CensorRule Load (0.5ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."info_request_id" = 137 ORDER BY created_at desc
CensorRule Load (0.5ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."public_body_id" = 16 ORDER BY created_at desc
InfoRequest Load (0.5ms) SELECT "info_requests".* FROM "info_requests" WHERE "info_requests"."id" = 137 LIMIT 1
PublicBody Load (0.5ms) SELECT "public_bodies".* FROM "public_bodies" WHERE "public_bodies"."id" = 16 LIMIT 1
HasTagString::HasTagStringTag Load (0.6ms) SELECT "has_tag_string_tags".* FROM "has_tag_string_tags" WHERE "has_tag_string_tags"."model_id" = 16 AND (model = 'PublicBody')
CensorRule Load (0.5ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."info_request_id" IS NULL AND "censor_rules"."public_body_id" IS NULL AND "censor_rules"."user_id" IS NULL
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = 13 LIMIT 1
(0.5ms) SELECT COUNT(*) FROM "censor_rules" WHERE "censor_rules"."user_id" = 13
CensorRule Load (0.4ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."info_request_id" = 137 ORDER BY created_at desc
CensorRule Load (0.5ms) SELECT "censor_rules".* FROM "censor_rules" WHERE "censor_rules"."public_body_id" = 16 ORDER BY created_at desc
=> [#<OutgoingMessage id: 36, info_request_id: 137, body: "Some information please", status: "sent", message_type: "initial_request", created_at: "2015-04-17 10:50:21", updated_at: "2015-04-17 10:50:21", last_sent_at: "2015-04-17 10:50:21", incoming_message_followup_id: nil, what_doing: "normal_sort", prominence: "normal", prominence_reason: nil>, #<OutgoingMessage id: 37, info_request_id: 137, body: "Dear Example Public Body 6,\r\n\r\nc'mooooooonnnnnn\r\n\r\n...", status: "sent", message_type: "followup", created_at: "2015-04-20 12:18:30", updated_at: "2015-04-20 12:18:30", last_sent_at: "2015-04-20 12:18:30", incoming_message_followup_id: 30, what_doing: "normal_sort", prominence: "normal", prominence_reason: nil>]
After
> info_request.outgoing_messages
OutgoingMessage Load (0.8ms) SELECT "outgoing_messages".* FROM "outgoing_messages" WHERE "outgoing_messages"."info_request_id" = 137 ORDER BY created_at
=> [#<OutgoingMessage id: 36, info_request_id: 137, body: "Some information please", status: "sent", message_type: "initial_request", created_at: "2015-04-17 10:50:21", updated_at: "2015-04-17 10:50:21", last_sent_at: "2015-04-17 10:50:21", incoming_message_followup_id: nil, what_doing: "normal_sort", prominence: "normal", prominence_reason: nil>, #<OutgoingMessage id: 37, info_request_id: 137, body: "Dear Example Public Body 6,\r\n\r\nc'mooooooonnnnnn\r\n\r\n...", status: "sent", message_type: "followup", created_at: "2015-04-20 12:18:30", updated_at: "2015-04-20 12:18:30", last_sent_at: "2015-04-20 12:18:30", incoming_message_followup_id: 30, what_doing: "normal_sort", prominence: "normal", prominence_reason: nil>]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eliminates the following Bullet warnings:
2015-04-21 11:42:26[WARN] /categorise/play
N+1 Query detected
user: vagrant
InfoRequest => [:public_body]
Add to your finder: :includes => [:public_body]
N+1 Query method call stack
/home/vagrant/alaveteli/app/views/request/_request_listing_single.html.erb:16:in `_app_views_request__request_listing_single_html_erb__949797960_70091194573720'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:46:in `_app_views_request_game_play_html_erb___279307748_70091194720080'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:45:in `each'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:45:in `_app_views_request_game_play_html_erb___279307748_70091194720080'
/home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory'
/home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
2015-04-21 11:42:26[WARN] /categorise/play
N+1 Query detected
user: vagrant
InfoRequest => [:user]
Add to your finder: :includes => [:user]
N+1 Query method call stack
/home/vagrant/alaveteli/app/views/request/_request_listing_single.html.erb:17:in `_app_views_request__request_listing_single_html_erb__949797960_70091194573720'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:46:in `_app_views_request_game_play_html_erb___279307748_70091194720080'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:45:in `each'
/home/vagrant/alaveteli/app/views/request_game/play.html.erb:45:in `_app_views_request_game_play_html_erb___279307748_70091194720080'
/home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory'
/home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
|
| |
|
|
|
|
| |
In practice, it's just confusing if you've been away from the site.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Now that we use global CSRF authenticity checks, searches were logging
logged-in users out as the form is an HTML form, not a Rails-generated
form with a CSRF token. So form submission raised an InvalidAuthenticityToken
error and reset their session. We could generate the form in Rails, but we
also want to minimise the number of non-logged in people who have a
session cookie, so that varnish can cache pages extensively. So we don't
want to put the CSRF token for the search form in everyone's session.
|
|\
| |
| |
| |
| | |
Conflicts:
config/initializers/alaveteli.rb
|
| |
| |
| |
| | |
Thanks to @RichardTaylor for reporting.
|
|/
|
|
| |
Needs to be restored as part of https://github.com/mysociety/alaveteli/issues/2137.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
They shouldn't be in public_body, as the styles are used in more places
|
|\ |
|
| |
| |
| |
| | |
Closes Â#434.
|
| |
| |
| |
| |
| |
| | |
They're only visible in the admin interface. See
https://github.com/mysociety/alaveteli/issues/1353
for details.
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
Fixes submission of form containing both existing and new
translations
|
| | |
|
|/ |
|
|\
| |
| |
| |
| | |
Conflicts:
app/views/public_body/show.html.erb
|
| | |
|
| |
| |
| |
| |
| | |
There's only one call to this function in the rest of the code. That
has 'html' set to true.
|
|\ \ |
|
| | | |
|
| | |
| | |
| | |
| | | |
They don't have a public body, so use the config param directly.
|
|\ \ \
| |/ /
|/| | |
|
| |/ |
|
| | |
|
| | |
|