From c2f95dc56a1c4ef12a5c767e99a5a29acc74f39c Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 19 Oct 2021 16:25:47 -0400 Subject: [PATCH] feat(mail): filter mailbox by flagged messages Fixes #1417 --- UI/MailerUI/English.lproj/Localizable.strings | 3 ++ UI/MailerUI/UIxMailListActions.m | 8 ++++- .../MailerUI/UIxMailFolderTemplate.wox | 33 ++++++++++++++++--- .../js/Mailer/Mailbox.service.js | 14 ++------ 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/UI/MailerUI/English.lproj/Localizable.strings b/UI/MailerUI/English.lproj/Localizable.strings index 821736d3d..c0535c391 100644 --- a/UI/MailerUI/English.lproj/Localizable.strings +++ b/UI/MailerUI/English.lproj/Localizable.strings @@ -169,6 +169,9 @@ /* Filter option in messages list */ "Show unread messages only" = "Show unread messages only"; +/* Filter option in messages list */ +"Show flagged messages only" = "Show flagged messages only"; + /* Tree */ "SentFolderName" = "Sent"; "TrashFolderName" = "Trash"; diff --git a/UI/MailerUI/UIxMailListActions.m b/UI/MailerUI/UIxMailListActions.m index 22d44c35f..447480e1b 100644 --- a/UI/MailerUI/UIxMailListActions.m +++ b/UI/MailerUI/UIxMailListActions.m @@ -427,7 +427,7 @@ NSArray *filters; NSString *searchBy, *searchInput, *searchString, *match; NSMutableArray *qualifiers, *searchArray; - BOOL unseenOnly; + BOOL unseenOnly, flaggedOnly; int nbFilters, i; request = [context request]; @@ -439,6 +439,7 @@ match = nil; filters = [content objectForKey: @"filters"]; unseenOnly = [[content objectForKey: @"unseenOnly"] boolValue]; + flaggedOnly = [[content objectForKey: @"flaggedOnly"] boolValue]; if (filters) { @@ -483,6 +484,11 @@ searchQualifier = [EOQualifier qualifierWithQualifierFormat: @"(not (flags = %@))", @"seen"]; [qualifiers addObject: searchQualifier]; } + if (flaggedOnly) + { + searchQualifier = [EOQualifier qualifierWithQualifierFormat: @"(flags = %@)", @"flagged"]; + [qualifiers addObject: searchQualifier]; + } if ([qualifiers count] > 1) { diff --git a/UI/Templates/MailerUI/UIxMailFolderTemplate.wox b/UI/Templates/MailerUI/UIxMailFolderTemplate.wox index 324d8f903..47eaed41c 100644 --- a/UI/Templates/MailerUI/UIxMailFolderTemplate.wox +++ b/UI/Templates/MailerUI/UIxMailFolderTemplate.wox @@ -73,10 +73,28 @@ - - mark_as_unread - + + + filter_list + + + + + + + + + + @@ -283,7 +301,12 @@ -
sort
+
+ + + sort + +
diff --git a/UI/WebServerResources/js/Mailer/Mailbox.service.js b/UI/WebServerResources/js/Mailer/Mailbox.service.js index 6aacacd65..f9d210263 100644 --- a/UI/WebServerResources/js/Mailer/Mailbox.service.js +++ b/UI/WebServerResources/js/Mailer/Mailbox.service.js @@ -342,17 +342,6 @@ return angular.isDefined(this.$selectedMessage); }; - /** - * @function toggleUnseenOnly - * @memberof Mailbox.prototype - * @desc Toggle filter by unseen messages only. Requires a round trip to the server. - */ - Mailbox.prototype.toggleUnseenOnly = function() { - var _this = this; - this.$unseenOnly = !this.$unseenOnly; - this.$filter(Mailbox.$query); - }; - /** * @function $filter * @memberof Mailbox.prototype @@ -408,6 +397,9 @@ if (this.$unseenOnly) options.unseenOnly = 1; + if (this.$flaggedOnly) + options.flaggedOnly = 1; + // Restart the refresh timer, if needed if (!Mailbox.$virtualMode) { var refreshViewCheck = Mailbox.$Preferences.defaults.SOGoRefreshViewCheck;