kewisch / quickmove-extension

Quick Folder Move Add-on for Thunderbird
85 stars 26 forks source link

Searching in the folder list stopped working (for non-top-level folders?) #26

Closed tessarakt closed 1 year ago

tessarakt commented 4 years ago

I just upgraded to Thunderbird 74.0 beta 1. QFM version is 2.0.0pre1.

Now I now longer get proper results when searching in the folder list.

Steps to reproduce:

  1. In the message list, press Shift-G. => The popup appears, "Goto" is selected, the folder list contains some names (apparently recent folders). This is as expected.
  2. Wait long enough, then type "Pos". => Two "Posteingang" (German for "Inbox") folders are shown (for two different accounts). This is as expected.
  3. Type letters of any other folder. => List becomes empty. Expected would be: That folder is shown in the list.

Could this be related to this entry in the Changelog: "MailExtensions: Changed folder enumeration to return tree structure rather than list"?

tessarakt commented 4 years ago

Yes, that exactly.

If I change the code in folderlist.js as follows, it works:

  searchRecursively(lowerSearchTerm, folder) {
    if (folder.name.toLowerCase().includes(lowerSearchTerm)) {
      this._addFolder(folder, 0);
    }

    for (let subFolder of folder.subFolders) {
      this.searchRecursively(lowerSearchTerm, subFolder);
    }
  }

  addRecursively(folder) {
    let depth = (folder.path.match(/\//g) || []).length - 1;
    this._addFolder(folder, depth);

    for (let subFolder of folder.subFolders) {
      this.addRecursively(subFolder);
    }
  }

  repopulate() {
    let lowerSearchTerm = this.searchValue.toLowerCase();
    this._clearFolders();

    if (lowerSearchTerm) {
      for (let folder of this.allFolders) {
        this.searchRecursively(lowerSearchTerm, folder);
      }
    } else if (this.defaultFolders) {
      for (let folder of this.defaultFolders) {
        this._addFolder(folder, 0);
      }
    } else {
      for (let folder of this.allFolders) {
        this.addRecursively(folder);
      }
    }
  }
ei8fdb commented 3 years ago

@kewisch Firstly thank you for creating this extension, it makes managing my email much easier. ❤️ I heavily relied on this behaviour.

@tessarakt thanks for opening this issue. I've searched for folderlist.js in the directory where the extension exists but I cannot find this file. Where should this be located?

Is this fix in a format that it can be merged to bring this useful behaviour back?

tessarakt commented 3 years ago

@ei8fdb folderlist.js is part of the extension. The .xpi file is just a ZIP archive. You can unpack it, make the changes to folderlist.js, and then add it to the archive again.

kewisch commented 1 year ago

This should be fixed, please open a new issue if not