aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
Commit message (Collapse)AuthorAgeLines
* Restrict old_unclassified methods to normal prominence.0.13.0.3hotfix/0.13.0.3Louise Crow2013-09-18-1/+11
| | | | Fixes #1082.
* 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
| |
| * How we would handle event states if we added a state_update event whenever a ↵Matthew Landauer2013-04-20-1/+1
| | | | | | | | user classifies a request
| * Simple solution to bugs shown up in tests in last 2 commitsMatthew Landauer2013-04-18-1/+1
| |
* | Split the string interpolation and translation into two steps so that the ↵Louise Crow2013-06-24-2/+5
| | | | | | | | translation gets picked up by rake gettext:find. Add a bit more explanation.
* | Merge branch 'hotfix/0.11.0.14' into rails-3-developLouise Crow2013-06-19-1/+1
|\ \
| * | Allow the HTML display of the body of an email to handle the case where the ↵0.11.0.14hotfix/0.11.0.14Louise Crow2013-06-19-1/+1
| | | | | | | | | | | | body is only quoted text and there is no subject.
* | | Merge branch 'hotfix/0.11.0.7' into rails-3-developLouise Crow2013-06-10-1/+1
|\| | | | | | | | | | | | | | Conflicts: spec/models/info_request_spec.rb
| * | Cope with replying to a message with a missing or empty SubjectMark Longair2013-06-07-1/+1
| | | | | | | | | | | | | | | | | | Conflicts: spec/models/info_request_spec.rb
* | | Merge branch 'hotfix/0.11.0.4' into rails-3-developLouise Crow2013-06-10-1/+3
|\| |
| * | Merge branch 'release/0.11'0.11.0.3Louise Crow2013-06-04-1174/+281
| |\ \
| * | | Return a string from user.name always to avoid any complications with other ↵hotfix/0.9.0.5Louise Crow2013-05-28-1/+3
| | | | | | | | | | | | | | | | functions calling gsub on the result. SafeBuffer won't work with gsub until Rails 3.2 https://github.com/rails/rails/commit/b4a6e2f8442ceda118367f9a61c38af754be1cbf
| * | | Bugfix for the case where a suspended user sends a contact message. Their ↵hotfix/0.9.0.2Louise Crow2013-05-07-1/+1
| | | | | | | | | | | | | | | | name (with the '(account suspended)' suffix) is marked by the translation call as HTML safe, so escapes the angled brackets when they are appended to it in the contact mailer code. Use string interpolation instead.
| * | | Mark ban text as html safeLouise Crow2013-04-29-1/+1
| | | |
* | | | Handle request for json for an external request. Closes #973.Louise Crow2013-06-07-1/+5
| | | |
* | | | Merge remote-tracking branch ↵Louise Crow2013-06-04-0/+15
|\ \ \ \ | | | | | | | | | | | | | | | 'openaustralia_github/more_info_on_report_request' into rails-3-develop
| * | | | Reasons that request can be reported now stored in modelMatthew Landauer2013-03-22-0/+6
| | | | |
| * | | | Wrap in a transactionMatthew Landauer2013-03-22-3/+5
| | | | |
| * | | | Extract methodMatthew Landauer2013-03-22-0/+7
| | | | |
* | | | | Merge remote-tracking branch ↵Louise Crow2013-06-04-26/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | 'openaustralia_github/inline_search_method_refactor' into rails-3-develop
| * | | | | Remove unused methodMatthew Landauer2013-03-25-11/+0
| | | | | |
| * | | | | Inline method InfoRequest.full_searchMatthew Landauer2013-03-25-15/+0
| |/ / / /
* | | | | Merge remote-tracking branch ↵Louise Crow2013-06-04-19/+4
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | 'openaustralia_github/small_email_hash_refactor' into rails-3-develop
| * | | | | Inline method and simplify logicMatthew Landauer2013-03-29-19/+4
| | |_|_|/ | |/| | |
* | | | | Merge remote-tracking branch ↵Louise Crow2013-05-30-19/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | 'openaustralia_github/remove_random_request_action' into rails-3-develop
| * | | | | Remove apparently unused action for showing random requestMatthew Landauer2013-03-22-19/+0
| | |/ / / | |/| | |
* | | | | Merge branch 'feature/new-string-for-translation' into rails-3-developLouise Crow2013-05-30-7/+15
|\ \ \ \ \ | |_|_|_|/ |/| | | |
| * | | | Allow the default text of an internal review request to be translated.Louise Crow2013-05-07-7/+15
| | | | |
* | | | | When extracting attachments for an incoming message and getting the body of ↵Louise Crow2013-05-29-7/+16
| | | | | | | | | | | | | | | | | | | | the main part in order to look for uuencoded text, make sure that we're getting that main part from the reparsed attachments, and not getting an obsolete attachment. Fixes #958.
* | | | | Check that display_filename matches URL part number or fallbackMark Longair2013-05-24-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the display_filename of the attachment found from the URL part number doesn't match the passed in display_filename then the email may have been reparsed, causing a reordering. In that case, look to see if there is another attachment that uniquely matches that filename, and, if so, return that other attachment. If no matching uniquely matching filename is found, redirect to the incoming message, rather than returning a 404.
* | | | | Refactor IncomingMessage.get_attachment_by_url_part_numberMark Longair2013-05-24-6/+1
| | | | |
* | | | | Move the mapi requires to where they're really neededMark Longair2013-05-22-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling of outlook-packed attachments would fail from rake tasks or in the console without requiring 'mapi/msg' and 'mapi/convert' beforehand. Instead, require them in the source file where they're actually used.
* | | | | Avoid an FoiAttachment validation failure under Rails 3Mark Longair2013-05-16-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under Rails 3, the uudecoded FoiAttachment in this test fails validation at the self.save! in IncomingMessage.parse_raw_email, although the FoiAttachment has been correctly created and saved to the database in _uudecode_and_save_attachments. Forcing a reload=true on self.foi_attachments fixes this. Thanks to Louise Crow for finding the fix for this problem.
* | | | | Move "require 'alaveteli_file_types'" into the initializerMark Longair2013-05-16-1/+0
| | | | |
* | | | | Make efforts to ensure that we're usually dealing with UTF-8 stringsMark Longair2013-05-16-1/+6
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of these changes is to make sure that the Mail backend, like the TMail backend it replaces, will return text parts encoded in UTF-8 if possible. The other change is to ensure that when text attachments are reloaded from disk, we attempt to convert them to UTF-8.
* | | | Mark ban text as html safeLouise Crow2013-04-25-1/+1
| | | |
* | | | Merge branch 'release/0.9' into rails-3-developLouise Crow2013-04-24-2/+13
|\ \ \ \ | |_|/ / |/| | / | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile.lock app/controllers/public_body_controller.rb app/mailers/track_mailer.rb app/views/request/_hidden_correspondence.html.erb app/views/request/_sidebar.html.erb app/views/request/hidden.html.erb app/views/request/new_please_describe.html.erb app/views/request/preview.html.erb app/views/user/show.html.erb config/environment.rb config/routes.rb spec/controllers/public_body_controller_spec.rb
| * | Restore call to N_Louise Crow2013-04-23-1/+1
| | |
| * | Fix the deadlock on dealing with incoming emailMark Longair2013-04-18-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #336 There was an occasional deadlock when two emails for the same request came in near-simultaneously; two processes would be started via script/mailin, each to deal with one email which are both updating the same InfoRequest. The error would look like: 2013-04-07 09:19:03 BST [13398]: [2-1] DETAIL: Process 13398 waits for ShareLock on transaction 36193647; blocked by process 13397. Process 13397 waits for ExclusiveLock on tuple (390,35) of relation 32918788 of database 32918687; blocked by process 13398. Process 13398: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.139515', "awaiting_description" = 't' WHERE "id" = 156200 Process 13397: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.143624', "awaiting_description" = 't' WHERE "id" = 156200 This arose from the following section of code: ActiveRecord::Base.transaction do raw_email = RawEmail.new incoming_message.raw_email = raw_email incoming_message.info_request = self incoming_message.save! raw_email.data = raw_email_data raw_email.save! self.awaiting_description = true params = { :incoming_message_id => incoming_message.id } if !rejected_reason.empty? params[:rejected_reason] = rejected_reason.to_str end self.log_event("response", params) self.save! end Matthew Somerville explained what was happening here in the issue report; to repeat his explanation from the bug report, both processes enter the transaction block and acquire a ShareLock on self with: incoming_message.info_request = self incoming_message.save! However, in order to update the self.awaiting_description field of the InfoRequest, with: self.awaiting_description = true [...] self.save! ... the ShareLock needs to be upgraded to an ExclusiveLock, but both will wait until the other's ShareLock is released, which would only happen at the end of the transaction. We can avoid this deadlock by using SELECT ... FOR UPDATE for the row in info_requests. In Rails 3.2.0 there is ActiveRecord support for this (via with_lock and lock! on a model instance) but so as not to require upgrading rails, I'm just using raw SQL.
| * | Update outgoing message signoff translationLouise Crow2013-04-16-1/+1
| | |
| * | Merge branch 'feature/final-consistent-translation-interpolation' into developLouise Crow2013-04-16-1/+1
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: app/models/outgoing_message.rb app/views/general/search.rhtml app/views/public_body/list.rhtml app/views/public_body/show.rhtml app/views/public_body/view_email.rhtml app/views/request/_after_actions.rhtml app/views/request/_followup.rhtml app/views/request/_sidebar.rhtml app/views/request/new.rhtml app/views/request/select_authority.rhtml app/views/request/upload_response.rhtml locale/aln/app.po locale/app.pot locale/ar/app.po locale/bs/app.po locale/ca/app.po locale/cs/app.po locale/cy/app.po locale/de/app.po locale/en/app.po locale/en_IE/app.po locale/es/app.po locale/eu/app.po locale/fr/app.po locale/gl/app.po locale/hu_HU/app.po locale/id/app.po locale/nb_NO/app.po locale/pt_BR/app.po locale/ro_RO/app.po locale/sl/app.po locale/sq/app.po locale/sr@latin/app.po locale/tr/app.po locale/uk/app.po
| | * | In translation strings replace %{} with {{}} formattingMatthew Landauer2013-04-15-1/+1
| | | |
| | * | In translation strings replace %{} with {{}} formattingMatthew Landauer2013-04-09-1/+1
| | | |
| * | | As much as possible use I18n.locale for getting the localeMatthew Landauer2013-04-02-2/+2
| | | |
| * | | Small refactorMatthew Landauer2013-04-02-6/+1
| | | |