aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-24 00:57:37 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-09-24 01:19:48 +0200
commitfb0b974de5202176eacc281bd1f96295fcc64738 (patch)
treef4e9d1aae757609f0ca1938ac71f1e1f2f74bb25
parent2f43d1b6466c74e8774e2833214f847eb559f15a (diff)
downloadwee-slack-fb0b974de5202176eacc281bd1f96295fcc64738.tar.gz
fix: Set new_messages in set_unread_count_display
The new_messages property is used by mark_read to determine if it should excecute. When a channel is initially loaded, new_messages is set to False, and unread_count_display is set to the number of unread messages. new_messages is not set to True until a new message arrives. This means that if you call mark_read after loading a channel, but before a new message has arrived, it won't do anything, even if the channel had unread messages when it was loaded. By setting new_messages in set_unread_count_display, this is fixed.
-rw-r--r--wee_slack.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 90b56ac..0346e23 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1151,6 +1151,7 @@ class SlackChannel(object):
def set_unread_count_display(self, count):
self.unread_count_display = count
+ self.new_messages = bool(self.unread_count_display)
for c in range(self.unread_count_display):
if self.type == "im":
w.buffer_set(self.channel_buffer, "hotlist", "2")