From 8e57412dcd7fe8749ebed645e048309618ed01b5 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Thu, 18 Dec 2014 14:36:10 -0200 Subject: \#203 & #204 & #205: fixing client and api for buld mark as read/unread and delete, functional tests are still broken, investigating... --- web-ui/app/js/services/mail_service.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'web-ui/app/js/services') diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js index 58b70ed7..24bceb31 100644 --- a/web-ui/app/js/services/mail_service.js +++ b/web-ui/app/js/services/mail_service.js @@ -80,13 +80,13 @@ define( mailIdents = _.map(data.checkedMails, function (mail) { return mail.ident; }); - monitoredAjax(this, '/mails/read', { - type: 'POST', - data: {idents: JSON.stringify(mailIdents)} - }).done(this.triggerMailsRead(data.checkedMails)); } else { - monitoredAjax(this, '/mail/' + data.ident + '/read', {type: 'POST'}); + mailIdents = [data.ident]; } + monitoredAjax(this, '/mails/read', { + type: 'POST', + data: JSON.stringify({idents: mailIdents}) + }).done(this.triggerMailsRead(data.checkedMails)); }; this.unreadMail = function (ev, data) { @@ -95,13 +95,13 @@ define( mailIdents = _.map(data.checkedMails, function (mail) { return mail.ident; }); - monitoredAjax(this, '/mails/unread', { - type: 'POST', - data: {idents: JSON.stringify(mailIdents)} - }).done(this.triggerMailsRead(data.checkedMails)); } else { - monitoredAjax(this, '/mail/' + data.ident + '/read', {type: 'POST'}); + mailIdents = [data.ident]; } + monitoredAjax(this, '/mails/unread', { + type: 'POST', + data: JSON.stringify({idents: mailIdents}) + }).done(this.triggerMailsRead(data.checkedMails)); }; this.triggerMailsRead = function (mails) { @@ -137,8 +137,8 @@ define( return mail.ident; }); - monitoredAjax(this, '/mails', { - type: 'DELETE', + monitoredAjax(this, '/mails/delete', { + type: 'POST', dataType: 'json', contentType: 'application/json; charset=utf-8', data: JSON.stringify({idents: mailIdents}) -- cgit v1.2.3