aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-30 21:02:00 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-06-04 21:40:59 +0200
commit5af26f4a6da871b6e69446e66afdf047110836e3 (patch)
tree18bd6afc208bad4495b073e44638d029728899ad
parentd0d6daf3a758be6ff2b80985460a3d1046b76b00 (diff)
downloadwee-slack-5af26f4a6da871b6e69446e66afdf047110836e3.tar.gz
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.
-rw-r--r--wee_slack.py2
1 files changed, 1 insertions, 1 deletions
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()