From 5af26f4a6da871b6e69446e66afdf047110836e3 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 30 May 2020 21:02:00 +0200 Subject: Prevent multiple thread notifications when mentioned There are two situations where notify_thread is called multiple times where we only want to notify once. One is when we load history for a thread which has multiple unread messages, the other is when you become subscribed to a thread because you are mentioned in it. For the first case, we want to set last_notify to now, so we don't notify for the rest of the unread messages following the first. For the second, the message ts may be greater than now (same second, but greater minor part), so we want to set last_notify to the message ts. Therefore we set last_notify to max of these two. --- wee_slack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index d831ed9..9e1015a 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2815,7 +2815,7 @@ class SlackMessage(object): else: return - self.last_notify = SlackTS() + self.last_notify = max(message.ts, SlackTS()) if config.auto_open_threads: self.open_thread() -- cgit