diff options
author | Aidan Epstein <aidan@jmad.org> | 2020-03-30 16:24:20 -0700 |
---|---|---|
committer | Aidan Epstein <aidan@jmad.org> | 2020-03-30 17:24:36 -0700 |
commit | dd3e528b2fdca8bc0c328fe1f06c0de25b5569c0 (patch) | |
tree | 9c24f3b95c4b8dbdba836e634b881a0d7f4dfd87 /wee_slack.py | |
parent | 3ee201b6d3d3f89cb99fb3f2bde54bc355a3e619 (diff) | |
download | wee-slack-dd3e528b2fdca8bc0c328fe1f06c0de25b5569c0.tar.gz |
Fix a couple bugs in mark_read.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index 9ae0cfa..560e075 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1598,9 +1598,6 @@ class SlackChannelCommon(object): return self.messages[ts].hash def mark_read(self, ts=None, update_remote=True, force=False, post_data={}): - if config.thread_messages_in_channel and getattr(self, thread_channels): - for channel in self.thread_channels.values(): - channel.mark_read(ts, update_remote, force, post_data) if self.new_messages or force: if self.channel_buffer: w.buffer_set(self.channel_buffer, "unread", "") @@ -1962,6 +1959,12 @@ class SlackChannel(SlackChannelCommon): del self.typing[user] return typing + def mark_read(self, ts=None, update_remote=True, force=False, post_data={}): + if config.thread_messages_in_channel and update_remote: + for thread_channel in self.thread_channels.values(): + thread_channel.mark_read(ts=ts, update_remote=update_remote, force=force, post_data=post_data) + super(SlackChannel, self).mark_read(ts=ts, update_remote=update_remote, force=force, post_data=post_data) + def user_joined(self, user_id): # ugly hack - for some reason this gets turned into a list self.members = set(self.members) @@ -3166,7 +3169,7 @@ def process_thread_marked(message_json, eventrouter, team, channel, metadata): thread_ts = subscription.get("thread_ts") channel = team.channels.get(subscription.get("channel")) if ts and thread_ts and channel: - thread_channel = channel.thread_channels.get(thread_ts) + thread_channel = channel.thread_channels.get(SlackTS(thread_ts)) if thread_channel: thread_channel.mark_read(ts=ts, force=True, update_remote=False) else: dbg("tried to mark something weird {}".format(message_json)) |