aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/api_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-07-16 18:05:39 +0100
committerRobin Houston <robin.houston@gmail.com>2012-07-16 18:05:39 +0100
commitd4a700da1760fc2ba09cf19613a995569e4965ea (patch)
treeb270e7de2da98094599a3ed0bc421e36b316b0d4 /app/controllers/api_controller.rb
parent4490482cedf362390b25efe453232ac1b7dfce99 (diff)
Revert "In the API, when parsing posted responses, assume all multipart mail parts that are Tempfiles are attachments"
This change makes the tests fail, I think, and doesn’t have (IMHO) a desperately strong rationale, so let’s try it without for now. This reverts commit 4490482cedf362390b25efe453232ac1b7dfce99.
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r--app/controllers/api_controller.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 3244a4c12..6117435db 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -71,18 +71,10 @@ class ApiController < ApplicationController
end
- def _get_attachments_from_params(params)
- attachments = []
- params.each_pair do |k, v|
- attachments << v if v.is_a? Tempfile
- end
- return attachments
- end
-
def add_correspondence
request = InfoRequest.find(params[:id])
json = ActiveSupport::JSON.decode(params[:correspondence_json])
- attachments = _get_attachments_from_params(params)
+ attachments = params[:attachments]
direction = json["direction"]
body = json["body"]
@@ -155,6 +147,7 @@ class ApiController < ApplicationController
:filename => filename
)
end
+
mail = RequestMailer.create_external_response(request, body, sent_at, attachment_hashes)
request.receive(mail, mail.encoded, true)
end