aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/outgoing_message.rb
Commit message (Collapse)AuthorAgeLines
* Improve performance initializing OutgoingMessageGareth Rees2015-04-27-1/+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>]
* Remove now-unused OutgoingMessage#send_messageGareth Rees2014-10-17-44/+0
| | | | Models should not send emails
* Extract resending a message from the modelGareth Rees2014-10-17-3/+3
|
* OutgoingMessage methods for async email sendingGareth Rees2014-10-14-0/+42
| | | | | | | | | #sendable? checks whether the message is in a state that we can send, otherwise it raises an appropriate exception. Not ideal (should just return false, but this is existing behaviour) #record_email_delivery updates the OutgoingMessage instance, logs an event with the InfoRequest and updates the InfoRequest state.
* Use dot rather than colon for method callGareth Rees2014-09-19-1/+1
|
* Group class methods before instance methodsGareth Rees2014-09-19-12/+12
|
* Remove uneeded code / Tidy upGareth Rees2014-09-19-66/+88
|
* Remove unused validationGareth Rees2014-09-19-1/+1
|
* Tidy OutgoingMessage macro methodsGareth Rees2014-09-19-22/+22
|
* Rename XXX comments with TODO:Gareth Rees2014-06-10-1/+1
| | | | Picks these up in `rake notes` and adds semantic meaning
* Add the specific salutations to each request.Louise Crow2013-12-04-5/+16
| | | | | | Also, wrap model creation in a transaction and do the message sending separately - we may ultimately want to do this outside the request cycle.
* Add InfoRequestBatch model.Louise Crow2013-12-04-0/+1
| | | | | Re-annotate models. Index InfoRequestBatches by user - we'll display the batches for a user when they view their own requests.
* Create a placeholder salutation for a batch request template.Louise Crow2013-12-04-1/+5
|
* Update the helpful model schema annotationsMark Longair2013-11-01-0/+2
| | | | These are regenerated with "bundle exec annotate"
* Handle salutations with regexp special characters.Louise Crow2013-09-19-1/+1
| | | | Fixes #1104.
* Add hidden messages for outgoing message.Louise Crow2013-09-16-0/+3
| | | | | | Conflicts: app/views/request/_incoming_correspondence.html.erb
* Move display text generation to outgoing message.Louise Crow2013-09-16-2/+8
|
* Re-annotate models with database fieldsLouise Crow2013-09-16-9/+8
|
* Allow the default text of an internal review request to be translated.Louise Crow2013-05-07-7/+15
|
* Merge branch 'release/0.9' into rails-3-developLouise Crow2013-04-24-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Update outgoing message signoff translationLouise Crow2013-04-16-1/+1
| |
* | Change email address in header of source code to hello@mysociety.orgMatthew Landauer2013-03-26-1/+1
| |
* | Rename Configuration class to avoid conflict with ActiveSupport::ConfigurableHenare Degan2013-03-03-1/+1
| |
* | Update to new mail sending APIHenare Degan2013-02-25-2/+2
| |
* | Merge branch 'develop' into rails-3-spikeHenare Degan2013-02-15-26/+26
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * OutgoingMessage model - Overwriting validate is deprecated in Rails 3Henare Degan2013-01-25-26/+28
| |
* | 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
| |
* | Method-style callbacks are deprecated for after_initializeHenare Degan2012-12-11-7/+10
|/
* remove s switch on regular expressions, which turns on SJIS encodingJames McKinney2012-11-01-1/+1
| | | | | | Conflicts: app/models/incoming_message.rb
* Remove svn tags that are out of date as we are now using gitMatthew Landauer2012-10-09-2/+0
|
* Extract configuration with defaults into one moduleMatthew Landauer2012-09-25-1/+1
|
* Further annotation correctionsSeb Bacon2012-05-24-1/+1
|
* Merge from wombleton:feature/440_sparkly_admin_cssSeb Bacon2012-05-23-0/+6
| | | | | | | Includes a couple of additional fixes: * Remember to HTML-quote things that could come from users * Fix form post action for editing users
* Remove trailing whitespace (to make a cleaner forthcoming merge with ↵Seb Bacon2012-05-15-7/+7
| | | | wombleton:feature/440_sparkly_admin_css)
* first stab at sending PURGE requests to upstream varnish for request pages. ↵Seb Bacon2012-03-13-1/+4
| | | | Next step: making it asynchronous, e.g. with a queue of things to purge via a cron job.
* Ensure model schema documentation is up to date.Seb Bacon2012-01-09-3/+3
|
* Internationalise the salution, making sure it's OK to miss out the public ↵Seb Bacon2011-08-15-2/+3
| | | | body name as they might in French. Fixes #134.
* merge IZ/Kosovo fork and refactorSeb Bacon2011-07-12-4/+4
|\
| * I18n string for modelsFaton Selishta2011-06-30-4/+4
| |
* | The generated Message-Id value uses the id of the OutgoingMessage, whichRobin Houston2011-07-08-4/+4
| | | | | | | | | | is not assigned till the object is saved. So we need to save it before we send the message.
* | Include the id of the OutgoingMessage in the SMTP Message-Id, andRobin Houston2011-07-07-4/+14
|/ | | | | | record the full Message-Id in the event log. Closes #70.
* Updating validations so that none expect automatic interpolation of the ↵Louise Crow2011-02-24-6/+6
| | | | attribute.
* Annotate models.Francis Irving2010-10-09-1/+1
|
* Factor out FOI officers FAQFrancis Irving2010-10-04-1/+1
|
* Option to set body without setting salutation.Francis Irving2010-10-04-0/+7
|
* Update model annotations.Francis Irving2010-09-15-1/+1
|
* Update model annotations.Francis Irving2010-07-27-1/+1
|
* Add specific draft attribute.Francis Irving2010-07-15-1/+1
|
* Update model annotations.Francis Irving2010-07-15-1/+1
|