aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
Commit message (Collapse)AuthorAgeLines
* Update the helpful model schema annotationsMark Longair2013-11-01-19/+22
| | | | These are regenerated with "bundle exec annotate"
* Add a rake task to import public bodies from a CSV fileMark Longair2013-10-15-0/+2
| | | | | | | | For importing a very large number of public bodies, it's mostly likely less frustrating to import them from the CSV file using this rake task instead of using the form in the admin interface. Fixes #1132
* Merge branch 'feature/email-subject-cleanup' into rails-3-developLouise Crow2013-10-07-8/+2
|\
| * Move special case to whatdotheyknow-themeLouise Crow2013-10-04-8/+2
| | | | | | | | | | Apart from anything else, we don't want translators to have to worry about the special case text. See https://github.com/mysociety/whatdotheyknow-theme/commit/2078febca5181ce3b1a9c0fae0123ae5f6448718 for the corresponding change to whatdotheyknow-theme.
* | Merge branch 'feature/followup-translators-notes' into rails-3-developLouise Crow2013-10-07-0/+3
|\ \
| * | Add some translator's notes on the use of 'follow up'.Louise Crow2013-10-04-0/+3
| |/
* / Fix upcasing of a non-US-ASCII first letter under Ruby 1.8Mark Longair2013-10-04-1/+1
|/ | | | | | | | In the rare circumstance that someone created a public body whose name started with a lower case letter outside [a-z] with Alaveteli running under Ruby 1.8, the letter would not be upcased correctly before saving to the first_letter column. This commit fixes that by using a Unicode-aware upcase function.
* Handle salutations with regexp special characters.Louise Crow2013-09-19-1/+1
| | | | Fixes #1104.
* Merge branch 'hotfix/0.13.0.3' into rails-3-developLouise Crow2013-09-18-1/+11
|\
| * Restrict old_unclassified methods to normal prominence.0.13.0.3hotfix/0.13.0.3Louise Crow2013-09-18-1/+11
| | | | | | | | Fixes #1082.
* | Merge branch 'feature/hide-individual-responses' into rails-3-developLouise Crow2013-09-17-198/+243
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile app/views/admin_request/edit_outgoing.html.erb config/packages doc/CHANGES.md doc/INSTALL.md spec/models/info_request_spec.rb spec/models/public_body_spec.rb
| * | Exclude hidden responses when calculating old_unclassifiedLouise Crow2013-09-16-4/+14
| | | | | | | | | | | | | | | Make old_unclassified_params method consistent with last_public_response_event and associated methods.
| * | Only include public messages in who_can_followup_toLouise Crow2013-09-16-0/+2
| | |
| * | Add public criteria for message event access methodsLouise Crow2013-09-16-16/+18
| | | | | | | | | | | | | | | | | | | | | get_last_response_event and get_last_outgoing_event are used in various places to determine which events to link to, use in queries etc. Restrict them to refer to the last publicly visible event of the relevant type, and rename them to make that clear.
| * | Hide hidden outgoing messages in download.Louise Crow2013-09-16-5/+3
| | |
| * | InfoRequestEvent.indexed_by_search consults OutgoingMessage.Louise Crow2013-09-16-0/+3
| | |
| * | Move indexed_by_search to MessageProminenceLouise Crow2013-09-16-4/+0
| | | | | | | | | | | | Add some tests that it's working on the outgoing message model.
| * | Add hidden messages for outgoing message.Louise Crow2013-09-16-1/+4
| | | | | | | | | | | | | | | | | | Conflicts: app/views/request/_incoming_correspondence.html.erb
| * | Create MessageProminence module.Louise Crow2013-09-16-6/+2
| | | | | | | | | | | | | | | | | | At least some of the logic for incoming and outgoing message prominence is going to be identical, so move it to a module they can both include and use.
| * | Move some download methods to InfoRequest.Louise Crow2013-09-16-0/+34
| | | | | | | | | | | | | | | | | | Use send_file to send zips. Also adds 'all_can_view_all_correspondence?' - is this request completely cachable, or do we need to cache different versions for different levels of privilege?
| * | Move display text generation to outgoing message.Louise Crow2013-09-16-2/+8
| | |
| * | Move a couple of complex conditionals to helper methods.Louise Crow2013-09-16-0/+9
| | | | | | | | | | | | We're about to reuse them for the text view.
| * | Normalize method spacing.Louise Crow2013-09-16-0/+3
| | |
| * | Extract calculation of last update hashLouise Crow2013-09-16-0/+4
| | |
| * | Add new code and specs for hiding attachments.Louise Crow2013-09-16-0/+4
| | |
| * | Add a possible event type 'edit_incoming'.Louise Crow2013-09-16-1/+1
| | | | | | | | | | | | This will cover changes in prominence to incoming messages.
| * | Make prominence states a constant so we can access them elsewhere.Louise Crow2013-09-16-5/+2
| | |
| * | Don't index hidden and requester_only incoming messages.Louise Crow2013-09-16-0/+8
| | |
| * | Adding prominence_reason to IncomingMessage.Louise Crow2013-09-16-0/+1
| | |
| * | Refactor common logic about prominence and access.Louise Crow2013-09-16-14/+2
| | | | | | | | | | | | Move it into the Ability module.
| * | Add a method to ask whether a user can view an incoming message.Louise Crow2013-09-16-0/+10
| | |
| * | Rename method to make it a bit more genericLouise Crow2013-09-16-5/+5
| | | | | | | | | | | | A super user will be able to see all hidden things, not just requests.
| * | Add response_event helperLouise Crow2013-09-16-0/+6
| | | | | | | | | | | | | | | Add a convenience method for getting the 'response' event associated with an incoming message.
| * | Add prominence to incoming message.Louise Crow2013-09-16-0/+7
| | |
| * | Re-annotate models with database fieldsLouise Crow2013-09-16-143/+124
| | |
| * | Remove prominence.Louise Crow2013-09-16-23/+0
| | | | | | | | | | | | | | | | | | | | | Add a migration to remove the unused column 'prominence' from info_request_events, remove validation of prominence, remove unused InfoRequestEvent.user_can_view? method. Remove references to InfoRequestEvent.prominence.
* | | Allow a unicode-only title in validationLouise Crow2013-09-17-1/+5
| | |
* | | Save cached columns once updated.Louise Crow2013-09-05-0/+6
| | |
* | | Don't dirty the first_letter attribute when not changed.Louise Crow2013-09-05-3/+14
| | |
* | | Don't re-index body when updating statsLouise Crow2013-09-05-0/+1
| | |
* | | Don't save versions of new counter cache columnsLouise Crow2013-09-05-1/+5
| | |
* | | Don't include NULL column values in the statisticsMark Longair2013-08-20-1/+1
| | | | | | | | | | | | | | | | | | | | | We were already excluding graphs where all the data was NULL but it's possible by directly manipulating the database to have some values NULL and some non-NULL, so exclude any NULL values anyway.
* | | Refactor calculation of statisticsMark Longair2013-08-20-0/+59
| | | | | | | | | | | | | | | | | | Move the calculation of statistics on public bodies into the PublicBody model, so that there's less logic in the controller.
* | | Improve calculation of PublicBody statistics columnsMark Longair2013-08-20-0/+11
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On PublicBody, we don't need to update info_requests_count because that's already done with :counter_cache. On the other hand, info_requests_successful_count and info_requests_not_held_count can't be updated easily with counter_cache (since they need conditions to be attached). Instead we update them in post_save and post_destroy, as suggested here: http://blog.douglasfshearer.com/post/17495285851/custom-counter-cache-with-conditions This also adds tests to ensure that the after_(save|destroy) callbacks are called and that they modify the counts correctly.
* | Comments on described_state and calculated_stateLouise Crow2013-08-15-3/+20
| | | | | | | | | | | | Add some notes on the logic and expectations around InfoRequest.described_state and calculate_status and InfoRequestEvent.described_state and calculated_state.
* | Make admin edits affect info_request_event described_states.Louise Crow2013-08-15-3/+4
| | | | | | | | | | | | | | Make sure that admin edits changing the described state of an info request are reflected in the latest_status and status values of info request events so that the info requests are retrieved correctly in status-based searches.
* | Allow 'edit' and 'status_update' calculated states to propagate.Louise Crow2013-08-15-4/+16
|/ | | | | | | | Update test expectations and add further test to explicitly show that we want the described status from a status update to be propagated to a preceding response, as well as being filled in in the status update itself (which is mostly to deal with the case where there isn't a preceding response). Make those changes to calculate_event_states
* Prevent erroneous internal error messages with multibyte characters under ↵Louise Crow2013-07-25-2/+2
| | | | ruby 1.8 by using mb_chars for length comparison - it counts multibyte characters.
* Merge remote-tracking branch ↵Louise Crow2013-07-23-11/+1
|\ | | | | | | | | | | | | 'openaustralia_github/tests_set_described_state' into rails-3-develop Conflicts: spec/models/info_request_spec.rb
| * Now record a state_update event *whenever* a user classifies a requestMatthew Landauer2013-04-20-10/+0
| |