Update thread last_read mark.
@@ -114,7 +114,7 @@ SLACK_API_TRANSLATOR = {
"history": None,
"join": None,
"leave": None,
- "mark": None,
+ "mark": "subscriptions.thread.mark",
}
@@ -2266,9 +2266,16 @@ class SlackThreadChannel(SlackChannelCommon):
self.rename()
def mark_read(self, ts=None, update_remote=True, force=False):
+ if True or force: #TODO: Add check for new_messages here.
if self.channel_buffer:
w.buffer_set(self.channel_buffer, "unread", "")
w.buffer_set(self.channel_buffer, "hotlist", "-1")
+ if not ts:
+ ts = next(reversed(self.messages), SlackTS())
+ if update_remote:
+ s = SlackRequest(self.team, SLACK_API_TRANSLATOR[self.type]["mark"],
+ {"channel": self.identifier, "thread_ts": self.parent_message.ts, "ts": ts}, channel=self)
+ self.eventrouter.receive(s)
def buffer_prnt(self, nick, text, timestamp, tag_nick=None):
data = "{}\t{}".format(format_nick(nick, self.last_line_from), text)
@@ -3023,8 +3030,8 @@ def subprocess_thread_message(message_json, eventrouter, team, channel, history_
if parent_message.thread_channel and parent_message.thread_channel.active:
parent_message.thread_channel.buffer_prnt(message.sender, parent_message.thread_channel.render(message), message.ts, tag_nick=message.sender_plain)
- elif message.ts > channel.last_read and parent_message.subscribed: #TODO: What is the difference between this and message_replied, at least for alerting on threads?
- parent_message.notify_thread(action="subscribed", sender_id=message_json["user"]) #TODO: Update thread last read mark?
+ elif message.ts > channel.last_read and parent_message.subscribed:
+ parent_message.notify_thread(action="subscribed", sender_id=message_json["user"]) #TODO: Use thread last_read ts
elif message.ts > channel.last_read and message.has_mention():
parent_message.notify_thread(action="mention", sender_id=message_json["user"])
