aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
* Add Comment#first_three_wordsuser_commentGareth Rees2015-05-20-0/+18
| | | | This was a demo method for AlaveteliCon 2015
* Merge branch 'set-file-encodings' into rails-3-developLouise Crow2015-05-15-47/+466
|\
| * Add source file encoding for all ruby files.Louise Crow2015-05-15-47/+467
| | | | | | | | | | | | This is important under ruby 1.9 in order to determine the encoding that will be used for new strings created in the code in the file.
* | Merge branch 'multibyte-safe-slice' into rails-3-developLouise Crow2015-05-15-1/+13
|\ \
| * | Use mb_chars to prevent slicing multibyte chars under ruby 1.8Louise Crow2015-05-12-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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""
* | | Merge branch 'cron-warning-no-data' into rails-3-developLouise Crow2015-05-15-0/+6
|\ \ \
| * | | Detect empty databases and report sensible warning.Petter Reinholdtsen2015-05-13-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | On a fresh installation with no reports yet, the cron job emit lots of gnuplot errors, causing new site admins to worry what is going wrong. Detect the situation and give a more clear warning about the problem instead.
* | | | Merge branch 'hotfix/0.21.0.30' into rails-3-developLouise Crow2015-05-15-1/+2
|\ \ \ \
| * | | | Bump alaveteli version0.21.0.30hotfix/0.21.0.30Louise Crow2015-05-15-1/+1
| | | | |
| * | | | Merge branch 'master' of ssh://git.mysociety.org/data/git/public/alaveteli ↵Louise Crow2015-05-15-4/+33
| |\ \ \ \ | | | | | | | | | | | | | | | | | | into hotfix/0.21.0.30
| | * \ \ \ Merge branch 'hotfix/0.21.0.29'0.21.0.29Gareth Rees2015-05-13-4/+1
| | |\ \ \ \
| * | | | | | Add UTF-8 encoding line.hotfix/0.29.0.30Louise Crow2015-05-15-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | Merge branch 'hotfix/0.21.0.29' into rails-3-developGareth Rees2015-05-13-4/+1
|\ \ \ \ \ \ \ | | |_|/ / / / | |/| | | | |
| * | | | | | Bump alaveteli versionGareth Rees2015-05-13-1/+1
| | | | | | |
| * | | | | | Remove mistakenly committed specGareth Rees2015-05-13-3/+0
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | Mistakenly committed from previous version of da6c11531a761847ee129f92677a44fdb02de04e
| * | | | | Merge branch 'hotfix/0.21.0.28'0.21.0.28Gareth Rees2015-05-13-4/+36
| |\ \ \ \ \ | | |/ / / / | |/| | | |
* | | | | | Merge branch 'hotfix/0.21.0.28' into rails-3-developGareth Rees2015-05-13-4/+36
|\ \ \ \ \ \ | | |/ / / / | |/| | | |
| * | | | | Bump alaveteli versionhotfix/0.21.0.28Gareth Rees2015-05-13-1/+1
| | | | | |
| * | | | | Discard rejected responses with malformed From:Gareth Rees2015-05-13-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | | | | Add explaining commentsGareth Rees2015-05-13-0/+2
| | | | | |
| * | | | | Sensible error messageGareth Rees2015-05-13-1/+1
| | | | | |
| * | | | | Put emails with malformed To: field in holding penGareth Rees2015-05-13-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prevents mailin exiting with an error code of 75 and sending error reports to the team@ email address.
| * | | | | Use each instead of forGareth Rees2015-05-13-1/+2
| |/ / / / | | | | | | | | | | | | | | | Extract email collection to explaining variable
* | | | | Merge branch '2241-admin-summary-performance' into rails-3-developGareth Rees2015-05-13-62/+117
|\ \ \ \ \ | |_|/ / / |/| | | |
| * | | | Remove summary stats from admin summary pageGareth Rees2015-05-12-23/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They're duplicated on /admin/summary and a bit slow [1]. [1] https://wiki.postgresql.org/wiki/Slow_Counting
| * | | | Use database attributes to find public_response_eventsGareth Rees2015-05-12-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user system total real old 1.070000 0.280000 1.350000 ( 1.657773) new 0.560000 0.120000 0.680000 ( 0.743485)
| * | | | Remove N+1 QueryGareth Rees2015-05-07-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the following bullet warning: N+1 Query detected PublicBody => [:translations] Add to your finder: :includes => [:translations] N+1 Query method call stack /home/vagrant/alaveteli/app/helpers/link_to_helper.rb:70:in `public_body_url' /home/vagrant/alaveteli/app/helpers/link_to_helper.rb:74:in `public_body_path' /home/vagrant/alaveteli/app/helpers/admin_helper.rb:28:in `public_body_both_links' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:148:in `_app_views_admin_general_index_html_erb__1495531968_70090875267640' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:145:in `each' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:145:in `_app_views_admin_general_index_html_erb__1495531968_70090875267640' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
| * | | | Use existing attributeGareth Rees2015-05-07-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `last_event_time` is set as a result of calling `InfoRequest.find_in_state`. This commit adds an explicit accessor that converts it to a `DateTime` and uses it in the view, preventing an extra query for each `InfoRequest` in the result set. Before: Completed 200 OK in 14908.9ms (Views: 14625.3ms | ActiveRecord: 69.8ms) After: Completed 200 OK in 2481.0ms (Views: 2437.1ms | ActiveRecord: 5.2ms)
| * | | | Reduce N+1 queries getting holding pen requestsGareth Rees2015-05-07-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the following bullet warning: N+1 Query detected IncomingMessage => [:raw_email] Add to your finder: :includes => [:raw_email] N+1 Query method call stack /home/vagrant/alaveteli/app/models/incoming_message.rb:115:in `parse_raw_email!' /home/vagrant/alaveteli/app/models/incoming_message.rb:150:in `sent_at' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:54:in `_app_views_admin_general_index_html_erb___48164640_70115534664600' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:42:in `_app_views_admin_general_index_html_erb___48164640_70115534664600' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call' Improved view rendering times: Before: Completed 200 OK in 2813.9ms (Views: 1697.3ms | ActiveRecord: 9.5ms) Completed 200 OK in 2548.6ms (Views: 1838.2ms | ActiveRecord: 8.2ms) After: Completed 200 OK in 2185.9ms (Views: 276.0ms | ActiveRecord: 7.5ms) Completed 200 OK in 2216.3ms (Views: 100.3ms | ActiveRecord: 7.6ms)
| * | | | Line length of holding pen messages sectionGareth Rees2015-05-07-3/+11
| | | | |
| * | | | Reduce N+1 queries getting update body requestsGareth Rees2015-05-07-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the following bullet warnings: N+1 Query detected PublicBodyChangeRequest => [:public_body] Add to your finder: :includes => [:public_body] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:65:in `get_public_body_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:8:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:225:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:224:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call' N+1 Query detected PublicBodyChangeRequest => [:user] Add to your finder: :includes => [:user] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:57:in `get_user_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:46:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:225:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:224:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
| * | | | Reduce N+1 queries getting new body requestsGareth Rees2015-05-07-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the following Bullet warnings: N+1 Query detected PublicBodyChangeRequest => [:public_body] Add to your finder: :includes => [:public_body] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:65:in `get_public_body_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:8:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:191:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:190:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call' N+1 Query detected PublicBodyChangeRequest => [:user] Add to your finder: :includes => [:user] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:57:in `get_user_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:46:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:191:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:190:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
| * | | | Line length of new bodies sectionGareth Rees2015-05-07-9/+24
| | | | |
| * | | | Line length of update authorities sectionGareth Rees2015-05-07-7/+24
| | | | |
| * | | | Improve speed of collecting bodies with no emailGareth Rees2015-05-07-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user system total real old 0.050000 0.020000 0.070000 ( 0.088856) new 0.020000 0.000000 0.020000 ( 0.018556)
* | | | | Merge branch 'initial_request_text-2' into rails-3-developGareth Rees2015-05-12-41/+166
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | InfoRequest#initial_request_text performanceGareth Rees2015-05-12-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passes the InfoRequest's CensorRules directly to the OutgoingMessage. user system total real old 0.010000 0.010000 0.020000 ( 0.020827) new 0.010000 0.000000 0.010000 ( 0.016633)
| * | | | Use a sequence for InfoRequest factoryGareth Rees2015-05-12-2/+3
| | | | | | | | | | | | | | | | | | | | Avoids unique name constraint
| * | | | Allow optional censor rules to be passed to #bodyGareth Rees2015-05-12-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we’re in the context of an InfoRequest and want the OutgoingMessage#body, we can pass the rules in explicitly to avoid looking up the info request again. Otherwise it falls back to the existing behaviour.
| * | | | Add a non-mutating #apply_to_textGareth Rees2015-05-12-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Still need to `return nil if text_to_censor.nil?` because `gsub!` returns `nil` rather than the original text if it does not make a substitution.
| * | | | Use #raw_body sugar methodGareth Rees2015-05-12-1/+1
| | | | |
| * | | | Extract text cleaning from #body methodGareth Rees2015-05-12-9/+10
| | | | |
| * | | | Improve OutgoingMessage#body specsGareth Rees2015-05-12-21/+70
| | | | |
| * | | | InfoRequest#initial_request_text minor improvementGareth Rees2015-05-12-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | system total real old 0.810000 0.300000 1.110000 ( 1.358172) new 0.970000 0.090000 1.060000 ( 1.292340)
* | | | | Remove debug lineLouise Crow2015-05-12-1/+0
|/ / / /
* | | | Merge remote-tracking branch 'petter_github/debian-wheezy-font-pkg' into ↵Louise Crow2015-05-12-0/+1
|\ \ \ \ | | | | | | | | | | | | | | | rails-3-develop
| * | | | Add the ttf-bitstream-vera package to provide Vera.ttf to the cron jobs.Petter Reinholdtsen2015-05-09-0/+1
| | | | |
* | | | | Merge branch 'html-relative-path' into rails-3-developLouise Crow2015-05-12-3/+3
|\ \ \ \ \ | | |_|/ / | |/| | |
| * | | | Bump alaveteli version0.21.0.27hotfix/0.21.0.27Louise Crow2015-05-12-1/+1
| | | | |
| * | | | Use a relative path in call to pdftohtml.Louise Crow2015-05-11-2/+2
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | pdftohtml will use the file path as the basis for generating the image links in the generated HTML, so we want them to be relative, not absolute. Ruby 1.9 tempfile.path will generate an absolute path when given the current directory as the tmpdir, whilst 2.0 and 1.8 will use a relative one.