RealRaven2000 / QuickFolders

Thunderbird Add-on: QuickFolders
http://quickfolders.org/
Other
49 stars 9 forks source link

Display correct number of moved mails (after quickMove) #354

Closed aarnolds closed 1 year ago

aarnolds commented 1 year ago

In former times the number of moved mails was shown in the dialog showing the target folder. Could this be enabled again?

Background: I'm using Thunderbird with 2 IMAP accounts, hundreds of local folders and hundreds of messages moved and deleted every day. I found that mails are moved to wrong folders from time to time. Unfortunately I didn't find any systematic explanation when and why this is happening yet. Sometimes I don't even recognize that this happens and find these misrouted mails by chance a long time later in the wrong folder. To prevent this I jump to the target folders regularly after moving mails. This wastes a lot of time. It would be of great help to see a confirmation about the number of mails moved in the message window shown after each move telling the folder to which messages were moved.

Thank and kind regards,

Ado

RealRaven2000 commented 1 year ago

I don't think QuickFolders ever had a feature that showed the number of moved mails on the tab. But the question is are you talking about manual moves or using an automated filter rule? In the later case you can look up the filter log on the message filters dialog: it will tell you which filter was responsible for moving emails to a certain place.

image

Do you think something similar would be helpful to have for mails that were moved via quickMove / dropping to QuickFolder tabs?

aarnolds commented 1 year ago

I'm talking about manual moves using Shift-M+some-letters-of-foldername or Shift-M+=+Cursor-Keys or (very seldomly) dropping mails to tabs. I don't use automated filters.

I thought to remember seeing messages like "5 messages moved to ..." til some months ago. Perhaps it was just a wishful dream.

Thanks for your quick reply!

RealRaven2000 commented 1 year ago

you could try the licenses tab

maybe that will bring the notifications back...

aarnolds commented 1 year ago

I can't reach the setting of these config parameters with a right click in the "Licences" Tab (that shows a window with options "Select All", "Redirect", "Signature Switch") but with the Thunderbird "Config Editor". "extensions.quickfolders.quickMove.premium.silentMode" is set to false. And that's not my problem. When moving mails, I see the message window "Mail moved to folder ...".

My request didn't mention that this window is missing, but if it would be possible to have the number of moved messages shown additionally in that window.

RealRaven2000 commented 1 year ago

I can't reach the setting of these config parameters with a right click in the "Licences" Tab (that shows a window with options "Select All", "Redirect", "Signature Switch") but with the Thunderbird "Config Editor".

ok - well the tab is in QuickFolders Options - directly accessible from the tools menu:

image

"extensions.quickfolders.quickMove.premium.silentMode" is set to false. And that's not my problem. When moving mails, I see the message window "Mail moved to folder ...". My request didn't mention that this window is missing, but if it would be possible to have the number of moved messages shown additionally in that window.

Ok, I will see what I can do. Maybe I can modify the message accordingly! bear in mind that it is only shown on screen temporarily - I have it disabled here, but do these accumulate in the Windows sidebar if not dismissed manually?

aarnolds commented 1 year ago

RealRaven2000 wrote on 25.04.23 12:32: ...

Ok, I will see what's possible. Maybe I can modify the message accordingly! bear in mind that it is only shown on screen temporarily - I have it disabled here, but do these accumulate in the Windows sidebar if not dismissed manually?

No, they disappear after ~15s.

RealRaven2000 commented 1 year ago

I need to check if there is a Windows notification API for permanent messages... It would be cool if there was such a thing in the actual mail extension APIs. A lot of people detest these messages by the way, so it needs to be implemented carefully...

RealRaven2000 commented 1 year ago

Just leaving the screenshot here that you kindly provided:

quickMove-msg

So this is the OS notification, which depends on what kind of Operating System you are running. I am sure I can change the text!

RealRaven2000 commented 1 year ago

Just checked the code, the quickMove execution should actually already do this it is using the PluralForms library:

  execute: async function execute(targetFolderUri, parentName) {
    function showFeedback(actionCount, messageIdList, isCopy) {
      // show notification
      if (!actionCount) 
        return;

      let msg = 
        isCopy 
        ?  util.getBundleString("quickfoldersQuickCopiedMails")
        :  util.getBundleString("quickfoldersQuickMovedMails");
      let notify = PluralForm.get(actionCount, msg).replace("{1}", actionCount).replace("{2}", fld.prettyName);

These are the (fully localized) strings from messages.json:

  "quickfoldersQuickCopiedMails": {
    "message": "Mail copied to folder {2};{1} mails copied to folder {2}"
  },
  "quickfoldersQuickMovedMails": {
    "message": "Mail moved to folder {2};{1} mails moved to folder {2}"
  },

As you can see, for each case I have 2 alternative sentences (one for single mail and one for multiple mails). So I am wondering if there is an actual bug in the PluralForm execution... will report back.

RealRaven2000 commented 1 year ago

So it looks like the "actionCount" parameter is calculated wrongly. the messageIdList array has a single element, which then contains the list of messages. so it always counts the outer array (1 member) instead of what is contained. SHould eb easy enough to fix...

image

aarnolds commented 1 year ago

Do you remember my first note on April 24: "In former times the number of moved mails was shown in the dialog showing the target folder. Could this be enabled again?"

RealRaven2000 commented 1 year ago

Do you remember my first note on April 24: "In former times the number of moved mails was shown in the dialog showing the target folder. Could this be enabled again?"

Yeah, but the answers are a lot less trivial here. It is actually not caused by the routine that creates the message but the routine that moves Messages, it returns something that is unexpected which is opening a whole other can of worms - because it is expected to return an Array of message Ids (unique handles to emails) to act upon accordingly. Changing this potentially could fail stuff like the quickFilters filter assistant (generating filter rules from multiple mails) so I need to tread carefully here. Suffice to say this has absolute priority to fix ASAP.

RealRaven2000 commented 1 year ago

OK, the reason this happened - the underlying copy / move functions by THunderbird failed if the message came from differing folders (and you can gather emails from different folders before you actually carry out the quickMove operation). So I broke up the mails into portions with equal source folders (rather than having one copy operation for each message), and then copied the processed messages to a "results" Array, like this:

          messageIdList.push(origIds);  // <= successfully moved / copied
          QuickFolders.CopyListener.OnStopCopy(status); 

I assumed the Array "oridId" would be concatenated to the messageIdList Array, instead it is nested as a member. I need to investigate if there is any unwanted fallout when I fix this (apart from fixing the message issue).

To fix, I should do this instead:

          messageIdList.push(...origIds);  

looks fairly trivial :) but who knows about the consquences. I need to test that deeply because I do stuff with the resulting array...

RealRaven2000 commented 1 year ago

I added issue #385 to escalate the bug immediately.

RealRaven2000 commented 1 year ago

Test version for Thunderbird ESR102 below:

QuickFolders-mx-5.17.1pre2.zip


To test the version above, download the zip file, drag the file into Thunderbird Add-ons Manager, do not extract contents or if won't install.

RealRaven2000 commented 1 year ago

Sorry didn't mean to close this. I will close it when both 5.17.1 and 6.1 are released including this fix!

aarnolds commented 1 year ago

Great! The number of moved mails is shown again with QuickFolders-mx-6.1pre122. Thanks a lot!

quickMove-msg2

RealRaven2000 commented 1 year ago

Great! The number of moved mails is shown again with QuickFolders-mx-6.1pre122. Thanks a lot!

\o/ thanks for your patience. It also fixes the much more serious #385 - I had underestimated this one, so that one was also fixed thanks to your persistence!

RealRaven2000 commented 1 year ago

Fixed in 6.1 (published 08/08/2023) and 5.17.1 (published 07/08/2023)