Application.Controller: Fix deleting conversations from search

When deleteing messages from the search folder, all most be removed
(not just in-folder) since none of the messages will be in-folder.
This commit is contained in:
Michael Gratton 2020-03-13 15:57:20 +11:00
parent bf0bbf488e
commit 87e2255bb3

View file

@ -809,9 +809,10 @@ internal class Application.Controller : Geary.BaseObject {
public async void delete_conversations(Geary.FolderSupport.Remove target,
Gee.Collection<Geary.App.Conversation> conversations)
throws GLib.Error {
yield delete_messages(
target, conversations, to_in_folder_email_ids(conversations)
);
var messages = target.properties.is_virtual
? to_all_email_ids(conversations)
: to_in_folder_email_ids(conversations);
yield delete_messages(target, conversations, messages);
}
public async void delete_messages(Geary.FolderSupport.Remove target,
@ -1586,6 +1587,18 @@ internal class Application.Controller : Geary.BaseObject {
return messages;
}
private Gee.Collection<Geary.EmailIdentifier>
to_all_email_ids(Gee.Collection<Geary.App.Conversation> conversations) {
Gee.Collection<Geary.EmailIdentifier> messages =
new Gee.LinkedList<Geary.EmailIdentifier>();
foreach (Geary.App.Conversation conversation in conversations) {
foreach (Geary.Email email in conversation.get_emails(NONE)) {
messages.add(email.id);
}
}
return messages;
}
private void on_account_available(Geary.AccountInformation info) {
Geary.Account? account = null;
try {