summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Wagner <bwgpro@gmail.com>2015-02-23 11:37:52 -0300
committerBruno Wagner <bwgpro@gmail.com>2015-02-23 11:37:52 -0300
commit8fbf113c7d51fced6c066dd035f158c0ab919326 (patch)
tree0864a9e3df7cd25fad4992c3c6d77d702dcf632c
parent15d853a6b37ea6140fc540a28e4fbd874e27245c (diff)
Revert "Merge pull request #303 from pixelated-project/289"
This pull request added tag awareness to the checked mails, but we are not sure we want to go that way yet This reverts commit 791c08166dcf2a3f1f5040944831571c616c35bc, reversing changes made to 26be3c59b174eb9f1a6f73c67489738c7517ce8c.
-rw-r--r--web-ui/app/js/mail_list/ui/mail_list.js16
-rw-r--r--web-ui/app/js/services/mail_service.js21
2 files changed, 18 insertions, 19 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_list.js b/web-ui/app/js/mail_list/ui/mail_list.js
index 3f7a4da3..69327a57 100644
--- a/web-ui/app/js/mail_list/ui/mail_list.js
+++ b/web-ui/app/js/mail_list/ui/mail_list.js
@@ -43,7 +43,7 @@ define(
});
this.appendMail = function (mail) {
- var isChecked = this.attr.checkedMails[this.attr.currentTag] && mail.ident in this.attr.checkedMails[this.attr.currentTag];
+ var isChecked = mail.ident in this.attr.checkedMails;
MailItemFactory.createAndAttach(this.$node, mail, this.attr.currentMailIdent, this.attr.currentTag, isChecked);
};
@@ -117,29 +117,25 @@ define(
};
this.respondWithCheckedMails = function (ev, caller) {
- this.trigger(caller, events.ui.mail.hereChecked, {checkedMails: this.attr.checkedMails[this.attr.currentTag]});
+ this.trigger(caller, events.ui.mail.hereChecked, {checkedMails: this.attr.checkedMails});
};
this.updateCheckAllCheckbox = function () {
- debugger;
- this.trigger(document, events.ui.mails.hasMailsChecked, _.keys(this.attr.checkedMails[this.attr.currentTag]).length > 0);
+ this.trigger(document, events.ui.mails.hasMailsChecked, _.keys(this.attr.checkedMails).length > 0);
};
this.addToCheckedMails = function (ev, data) {
- if (!this.attr.checkedMails[this.attr.currentTag]) {
- this.attr.checkedMails[this.attr.currentTag] = {};
- }
- this.attr.checkedMails[this.attr.currentTag][data.mail.ident] = data.mail;
+ this.attr.checkedMails[data.mail.ident] = data.mail;
this.updateCheckAllCheckbox();
};
this.removeFromCheckedMails = function (ev, data) {
if (data.mails) {
_.each(data.mails, function (mail) {
- delete this.attr.checkedMails[this.attr.currentTag][mail.ident];
+ delete this.attr.checkedMails[mail.ident];
}, this);
} else {
- delete this.attr.checkedMails[this.attr.currentTag][data.mail.ident];
+ delete this.attr.checkedMails[data.mail.ident];
}
this.updateCheckAllCheckbox();
};
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js
index b8e72a7f..1fa41619 100644
--- a/web-ui/app/js/services/mail_service.js
+++ b/web-ui/app/js/services/mail_service.js
@@ -75,7 +75,7 @@ define(
};
- function extractMailIds(data) {
+ this.readMail = function (ev, data) {
var mailIdents;
if (data.checkedMails) {
mailIdents = _.map(data.checkedMails, function (mail) {
@@ -84,25 +84,28 @@ define(
} else {
mailIdents = [data.ident];
}
- return mailIdents;
- }
-
- this.readMail = function (ev, data) {
-
monitoredAjax(this, '/mails/read', {
type: 'POST',
- data: JSON.stringify({idents: extractMailIds(data)})
+ data: JSON.stringify({idents: mailIdents})
}).done(this.triggerMailsRead(data.checkedMails));
};
this.unreadMail = function (ev, data) {
+ var mailIdents;
+ if (data.checkedMails) {
+ mailIdents = _.map(data.checkedMails, function (mail) {
+ return mail.ident;
+ });
+ } else {
+ mailIdents = [data.ident];
+ }
monitoredAjax(this, '/mails/unread', {
type: 'POST',
- data: JSON.stringify({idents: extractMailIds(data)})
+ data: JSON.stringify({idents: mailIdents})
}).done(this.triggerMailsRead(data.checkedMails));
};
- this.triggerMailsRead = function () {
+ this.triggerMailsRead = function (mails) {
return _.bind(function () {
this.refreshMails();
this.trigger(document, events.ui.mails.uncheckAll);