mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-31 16:14:53 +00:00
feat(mail): filter messages by tags (labels)
Fixes #3323 Fixes #3835 Fixes #5338
This commit is contained in:
@@ -400,6 +400,12 @@
|
||||
if (this.$flaggedOnly)
|
||||
options.flaggedOnly = 1;
|
||||
|
||||
var labels = _.filter(_.keys(this.$filteredLabels), function (k) {
|
||||
return !!_this.$filteredLabels[k];
|
||||
});
|
||||
if (labels.length)
|
||||
options.labels = labels;
|
||||
|
||||
// Restart the refresh timer, if needed
|
||||
if (!Mailbox.$virtualMode) {
|
||||
var refreshViewCheck = Mailbox.$Preferences.defaults.SOGoRefreshViewCheck;
|
||||
@@ -675,6 +681,29 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function getLabels
|
||||
* @memberof Mailbox.prototype
|
||||
* @desc Fetch the list of labels associated to the mailbox. Use the cached value if available.
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Mailbox.prototype.getLabels = function() {
|
||||
var _this = this;
|
||||
|
||||
if (this.$labels)
|
||||
return this.$labels;
|
||||
|
||||
this.$filteredLabels = {};
|
||||
return Mailbox.$$resource.fetch(this.id, 'labels').then(function(data) {
|
||||
_this.$labels = data;
|
||||
return _this.$labels;
|
||||
});
|
||||
};
|
||||
|
||||
Mailbox.prototype.filteredByLabel = function() {
|
||||
return _.includes(this.$filteredLabels, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $flagMessages
|
||||
* @memberof Mailbox.prototype
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
this.messageDialog = null; // also access from Message controller
|
||||
this.mode = { search: false, multiple: 0 };
|
||||
|
||||
if (!Mailbox.$virtualMode)
|
||||
this.selectedFolder.getLabels(); // fetch labels from server
|
||||
|
||||
_registerHotkeys(hotkeys);
|
||||
|
||||
// Expunge mailbox when leaving the Mail module
|
||||
|
||||
Reference in New Issue
Block a user