ransome1 / sleek

todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)
https://github.com/ransome1/sleek/wiki
MIT License
1.29k stars 99 forks source link

Prevent duplicate notifications #581

Closed callegar closed 7 months ago

callegar commented 7 months ago

Bug Report

When you archive the completed TODOs, sleek repeats every notification. This is a minor nuisance.

App Version: 2.0.2

Platform: Linux

Installation Method: Appimage

Bug Description: See above.

Steps to Reproduce:

  1. Assure that you have some completed todo
  2. Assure that you have some pending todo with a close or overdue due date
  3. Archive completed todo
  4. See a notification appear for every pending task with a close by due date even if these notifications had already been provided before

Expected Behavior: Archiving todo should not cause notifications

Actual Behavior: Archiving todo makes the todo file change which causes sleek to re-notify everything.

Additional Information:

Screenshots: [If applicable, include screenshots that demonstrate the bug.]

ransome1 commented 7 months ago

@callegar I am not able to reproduce this.

I am missing a step?

ransome1 commented 7 months ago

One thing I can confirm is that, if you have due todos, sleek will send notifications once per app session; However, if you restart sleek, the notifications will be send again.

That is not ideal. In a better world, the notification already sent must be persisted so that one todo will only trigger one single notification and not more than one, despite if the app is restarted or not. Maybe this is what you are experiencing?

callegar commented 7 months ago

My bad, I have not explained how to reproduce correctly.

Suppose that you have a todo.txt file with many todos (say 50) and that among these a non negligible proportion is very close to the due date or even overdue (say 20). When you start sleek, it immediately triggers a notification by the desktop environment about the almost due or overdue tasks (so you get these 20 notifications, many but expected). Then, I believe that the idea would be to periodically use notifications to offer reminders. However, if at the same time you have some completed tasks, when you archive the completed tasks you immediately get again the 20 notifications about the close to due date or overdue tasks (even if they had been notified just some second before). Namely, I am getting the impression that the act of archiving (and thus changing the todo.txt file) causes the file to be re-read, which in turns causes all the notifications to be triggered immediately regardless of whether there is some notification period.

This is just a very minor nuisance, but I thought it would have been nice to report it anyway. Incidentally, the problem seems to be indirectly relaxed by the 2.0.3 RC, which is brisker when the todo list gets large and as such lowers the pressure to archive frequently the completed tasks.

ransome1 commented 7 months ago

@callegar the notification feature has been further changed in https://github.com/ransome1/sleek/releases/tag/v2.0.3-rc.4

Can you please try to reproduce your initial issue?

Also: Do you for any reason have your archiving file open in sleek?

Then, I believe that the idea would be to periodically use notifications to offer reminders.

I also wrote a documentation, which describes how it works: https://github.com/ransome1/sleek/wiki/Notifications-and-badges

ransome1 commented 7 months ago

Feel free to re-open if the initial problem still occurs.