| Commit message (Collapse) | Author | Age | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>]
|
|
|
|
| |
Models should not send emails
|
| |
|
|
|
|
|
|
|
|
|
| |
#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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Picks these up in `rake notes` and adds semantic meaning
|
|
|
|
|
|
| |
Also, wrap model creation in a transaction and do the message sending
separately - we may ultimately want to do this outside the request
cycle.
|
|
|
|
|
| |
Re-annotate models. Index InfoRequestBatches by user - we'll display the
batches for a user when they view their own requests.
|
| |
|
|
|
|
| |
These are regenerated with "bundle exec annotate"
|
|
|
|
| |
Fixes #1104.
|
|
|
|
|
|
| |
Conflicts:
app/views/request/_incoming_correspondence.html.erb
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
| | |
|
| | |
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
|/ |
|
|
|
|
|
|
| |
Conflicts:
app/models/incoming_message.rb
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Includes a couple of additional fixes:
* Remember to HTML-quote things that could come from users
* Fix form post action for editing users
|
|
|
|
| |
wombleton:feature/440_sparkly_admin_css)
|
|
|
|
| |
Next step: making it asynchronous, e.g. with a queue of things to purge via a cron job.
|
| |
|
|
|
|
| |
body name as they might in French. Fixes #134.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| | |
is not assigned till the object is saved. So we need to save it before
we send the message.
|
|/
|
|
|
|
| |
record the full Message-Id in the event log.
Closes #70.
|
|
|
|
| |
attribute.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|