summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/pixelated/controllers/mails_controller.py4
-rw-r--r--service/test/support/integration/app_test_client.py4
-rw-r--r--service/test/support/integration/soledad_test_base.py4
-rw-r--r--web-ui/app/js/services/mail_service.js4
4 files changed, 11 insertions, 5 deletions
diff --git a/service/pixelated/controllers/mails_controller.py b/service/pixelated/controllers/mails_controller.py
index f990bcc2..7166a51d 100644
--- a/service/pixelated/controllers/mails_controller.py
+++ b/service/pixelated/controllers/mails_controller.py
@@ -80,9 +80,9 @@ class MailsController:
return respond_json(None, request)
def delete_mails(self, request):
- idents = json.loads(request.form['idents'])
+ idents = json.loads(request.content.read())['idents']
for ident in idents:
- self.delete_mail(ident)
+ self.delete_mail(request, ident)
return respond_json(None, request)
def send_mail(self, request):
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index b2824770..2a35a89f 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -110,8 +110,8 @@ class AppTestClient:
request = requestMock(path=path, method="PUT", body=body, headers={'Content-Type': ['application/json']})
return self._render(request)
- def delete(self, path):
- request = requestMock(path=path, method="DELETE")
+ def delete(self, path, body=""):
+ request = requestMock(path=path, body=body, headers={'Content-Type': ['application/json']}, method="DELETE")
return self._render(request)
def add_document_to_soledad(self, _dict):
diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py
index da9d74dc..40181664 100644
--- a/service/test/support/integration/soledad_test_base.py
+++ b/service/test/support/integration/soledad_test_base.py
@@ -66,6 +66,10 @@ class SoledadTestBase(unittest.TestCase):
res, req = self.client.delete("/mail/%s" % mail_ident)
return req
+ def delete_mails(self, idents):
+ res, req = self.client.delete("/mails", json.dumps({'idents': idents}))
+ return req
+
def mark_as_read(self, mail_ident):
res, req = self.client.post("/mail/%s/read" % mail_ident)
return req
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js
index fa36b0ac..58b70ed7 100644
--- a/web-ui/app/js/services/mail_service.js
+++ b/web-ui/app/js/services/mail_service.js
@@ -139,7 +139,9 @@ define(
monitoredAjax(this, '/mails', {
type: 'DELETE',
- data: {idents: JSON.stringify(mailIdents)}
+ dataType: 'json',
+ contentType: 'application/json; charset=utf-8',
+ data: JSON.stringify({idents: mailIdents})
}).done(this.triggerDeleted(dataToDelete))
.fail(this.errorMessage(i18n('Could not delete emails')));
};