From cb60bdd3ea44a71e53d19466fd57a48ed23317b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bellegarde?= Date: Sun, 23 Jul 2023 16:51:19 +0200 Subject: [PATCH] client: Application.Controller: Disable flood prevention after a small timeout Marking a message with same command is legit in those scenarios: - Previous mark command failed, we do not want Geary to be unable to mark message again - Multiple clients connected to same IMAP box: - Geary marked message as read - Another client marked it as unread - Geary is unable to mark it as read again --- src/client/application/application-controller.vala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client/application/application-controller.vala b/src/client/application/application-controller.vala index 7f0593d5..1c7d039d 100644 --- a/src/client/application/application-controller.vala +++ b/src/client/application/application-controller.vala @@ -1711,16 +1711,26 @@ internal class Application.ControllerCommandStack : CommandStack { private EmailCommand? last_executed = null; + private Geary.TimeoutManager last_executed_timeout; + public ControllerCommandStack() { + this.last_executed_timeout = new Geary.TimeoutManager.milliseconds( + 250, + () => { this.last_executed = null; } + ); + } + /** {@inheritDoc} */ public override async void execute(Command target, GLib.Cancellable? cancellable) throws GLib.Error { + this.last_executed_timeout.reset(); // Guard against things like Delete being held down by only // executing a command if it is different to the last one. if (this.last_executed == null || !this.last_executed.equal_to(target)) { this.last_executed = target as EmailCommand; + this.last_executed_timeout.start(); yield base.execute(target, cancellable); } }