aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-30 12:36:03 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-06-04 21:40:59 +0200
commita81b86428556cc078d7d434775e6f76985f706fa (patch)
tree29cef87938e643dcac68d207fd3c0aedd179e153 /wee_slack.py
parenta3c377ad044d7e643033273a516296d8cce03920 (diff)
downloadwee-slack-a81b86428556cc078d7d434775e6f76985f706fa.tar.gz
Set last_read when (un)subscribing to a thread
When you subscribe to a thread, I think it's safe to assume that you have read the messages or want to treat the messages as read, and this is what the web client does. I'm not sure what the point of sending last_read for unsubscribe is, but the web client does so, and it was easiest to do it for both.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 1b9e67b..4ad843d 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -4480,8 +4480,9 @@ def subscribe_helper(current_buffer, args, usage, api):
print_message_not_found_error(args)
return w.WEECHAT_RC_OK_EAT
- s = SlackRequest(team, api,
- {"channel": channel.identifier, "thread_ts": message.ts}, channel=channel)
+ last_read = next(reversed(message.submessages), message.ts)
+ post_data = {"channel": channel.identifier, "thread_ts": message.ts, "last_read": last_read}
+ s = SlackRequest(team, api, post_data, channel=channel)
EVENTROUTER.receive(s)
return w.WEECHAT_RC_OK_EAT