aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorAidan Epstein <aidan@jmad.org>2020-03-27 13:23:53 -0700
committerAidan Epstein <aidan@jmad.org>2020-03-27 13:23:53 -0700
commit9a7d5a9298cc95335910391caa732e0c5eecc904 (patch)
tree29c001ab6987dde4e9c67781875c4e7106fed330 /wee_slack.py
parentc361259e2dc5bf105d382faa8cf6dcf78b57ccf2 (diff)
downloadwee-slack-9a7d5a9298cc95335910391caa732e0c5eecc904.tar.gz
Store thread last_reads in parent_message, so that they survive buffer closes.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 2f88440..3a650e3 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2241,10 +2241,17 @@ class SlackThreadChannel(SlackChannelCommon):
self.members = self.parent_message.channel.members
self.team = self.parent_message.team
self.last_line_from = None
- self.last_read = self.parent_message.message_json.get("last_read", SlackTS())
self.new_messages = False
@property
+ def last_read(self):
+ return self.parent_message.last_read
+
+ @last_read.setter
+ def last_read(self, ts):
+ self.parent_message.last_read = ts
+
+ @property
def identifier(self):
return self.parent_message.channel.identifier
@@ -2441,6 +2448,7 @@ class SlackMessage(object):
self.sender, self.sender_plain = senders[0], senders[1]
self.ts = SlackTS(message_json['ts'])
self.subscribed = message_json.get("subscribed", False)
+ self.last_read = message_json.get("last_read", SlackTS())
def __hash__(self):
return hash(self.ts)
@@ -3050,7 +3058,7 @@ def subprocess_thread_message(message_json, eventrouter, team, channel, history_
parent_message.thread_channel.buffer_prnt(message.sender, parent_message.thread_channel.render(message), message.ts, history_message=history_message, tag_nick=message.sender_plain)
elif message.ts > channel.last_read and message.has_mention():
parent_message.notify_thread(action="mention", sender_id=message_json["user"])
- elif message.ts > parent_message.message_json.get("last_read", SlackTS()) and parent_message.subscribed:
+ elif message.ts > parent_message.last_read and parent_message.subscribed:
parent_message.notify_thread(action="subscribed", sender_id=message_json["user"])
if config.thread_messages_in_channel or message_json["subtype"] == "thread_broadcast":