aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/incoming_message.rb
Commit message (Collapse)AuthorAgeLines
* Use mb_chars to prevent slicing multibyte chars under ruby 1.8Louise Crow2015-05-15-1/+1
| | | | | | | | | | 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""
* Refactor the application of masks and censor rules to messages.Louise Crow2014-12-15-142/+16
| | | | | | | | | | Seems more logical to make this one method that figures out what to do based on file type. Plus, incoming message does so many things, it seemed like having these related methods be separate would make them easier to read and understand. Also, email, mobile and login substitution texts weren't being translated. Finally, I think passing the censor rules and masks as arguments is a first step in some more decoupling of models.
* Add fix for Apple Mail with attachments Gareth Rees2014-11-04-2/+4
|
* Merge branch 'replace-xxx-todo' into rails-3-developGareth Rees2014-06-16-10/+10
|\
| * Rename XXX comments with TODO:Gareth Rees2014-06-10-10/+10
| | | | | | | | Picks these up in `rake notes` and adds semantic meaning
* | Allow a message with more than one event to be destroyed.hotfix/0.18.0.2Louise Crow2014-06-06-7/+8
|/ | | | Fixes #1569
* Merge remote-tracking branch ↵Louise Crow2014-02-24-15/+16
|\ | | | | | | 'opennewzealand_github/feature/encode-utf8-messages' into rails-3-develop
| * Add test for _get_attachment_text_internal with invalid utf-8Rowan Crawford2014-02-23-7/+8
| |
| * encode does no work if it thinks it's already utf-8 (even if invalid)Rowan Crawford2014-02-10-8/+8
| | | | | | | | Also use duck typing for whether we should use encode
* | Handle gmail-style quoting from the HTML part of a mail.Louise Crow2014-01-22-0/+4
|/ | | | | | | We already handled this type of quoting when coming directly from a text part of a mail, but when we choose the HTML part as the main part and then convert it to text, the 'On [date] <email> person said:' part can get split over two lines.
* Use calls to write_attributeLouise Crow2013-11-12-4/+4
| | | | | | Under the Rails hood, using the setters for attributes now involves calling the getters too, (for a will_change? check), so these calls became circular - use write_attribute instead.
* Hide hidden outgoing messages in download.Louise Crow2013-09-16-4/+0
|
* 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/+1
| | | | | | 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 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
|
* Add new code and specs for hiding attachments.Louise Crow2013-09-16-0/+4
|
* 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/+4
|
* Adding prominence_reason to IncomingMessage.Louise Crow2013-09-16-0/+1
|
* Refactor common logic about prominence and access.Louise Crow2013-09-16-7/+1
| | | | 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
|
* 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-7/+6
|
* 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.
* 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.
* 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
|
* Change email address in header of source code to hello@mysociety.orgMatthew Landauer2013-03-26-1/+1
|
* Replace use of Iconv in Ruby 1.9 to get rid of deprecation warningsHenare Degan2013-03-16-7/+23
|
* We need to reload here in Rails 3.1 (caching?)Henare Degan2013-03-03-0/+3
|
* Rename Configuration class to avoid conflict with ActiveSupport::ConfigurableHenare Degan2013-03-03-4/+4
|
* In Ruby 1.9.3 we need to explicitly require iconv because it's not ↵Henare Degan2013-02-28-1/+1
| | | | implicitly loaded via Mail
* Fix calculation of attachment sizes in Ruby 1.9.3Henare Degan2013-02-27-3/+0
| | | | | | | | force_encoding is generally not a good idea and I can't see what it's trying to achieve here so... Revert "Use the character set of the attachment to encode the string that we're pulling out of the file before converting it to our default encoding." This reverts commit 3729f2053d4c04396d440a9c368bed174e9c9605.
* Merge branch 'develop' into rails-3-spikeHenare Degan2013-02-15-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock app/controllers/general_controller.rb app/controllers/track_controller.rb app/models/outgoing_message.rb app/models/public_body.rb app/models/user.rb app/views/general/frontpage.rhtml config/environment.rb config/initializers/inflections.rb config/initializers/mime_types.rb db/migrate/094_remove_old_tags_foreign_key.rb lib/timezone_fixes.rb spec/models/request_mailer_spec.rb spec/views/request/list.rhtml_spec.rb
| * Rescue an invalid character exception when handling what appears to be badly ↵Louise Crow2013-02-06-1/+1
| | | | | | | | encoded data.
* | Merge branch 'rails_xss' into rails-3-spikeMatthew Landauer2013-01-25-0/+1
|\| | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock config/environment.rb lib/i18n_fixes.rb
| * Merge remote-tracking branch 'mysociety/develop' into rails_xssMatthew Landauer2013-01-15-386/+90
| |\
| | * Handle case where info request doesn't have a user_nameLouise Crow2013-01-07-0/+1
| | |
* | | Activerecord 3 small api change for find_or_create_byMatthew Landauer2013-01-04-1/+1
| | |
* | | Merge branch 'rails_xss' into rails-3-spikeMatthew Landauer2013-01-04-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile Gemfile.lock app/views/request/_hidden_correspondence.rhtml app/views/request/hidden.rhtml app/views/request/new_please_describe.rhtml app/views/user/show.rhtml lib/i18n_fixes.rb
| * | html content of messages and comments are html safeMatthew Landauer2013-01-03-1/+1
| | |
* | | We don't need to specify the attribute againHenare Degan2012-12-12-1/+1
| |/ |/| | | | | Makes FoiAttachment model specs pass
* | Add alternative sanitization for Ruby 1.9Louise Crow2012-12-06-23/+57
| |