aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-30 12:50:34 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-06-04 21:40:59 +0200
commitd0d6daf3a758be6ff2b80985460a3d1046b76b00 (patch)
treea7c1504edc5aa0942b961aa3596da8af56fb85bb /wee_slack.py
parenta81b86428556cc078d7d434775e6f76985f706fa (diff)
downloadwee-slack-d0d6daf3a758be6ff2b80985460a3d1046b76b00.tar.gz
Fetch message replies if subscribed latest_reply > last_read
When using conversations.history (which doesn't include replies), we want to fetch the replies for a thread even if thread_messages_in_channel is off if the user is subscribed to the thread and it has unread messages, so we can notify for new replies. Technically, we could notify without fetching the history, but it's easier to just fetch the history so the normal notification check is run, and when the thread has unread messages, the user probably wants to read them, so it's nice that they don't have to wait for history when opening the thread.
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 4ad843d..d831ed9 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3057,8 +3057,9 @@ def handle_history(message_json, eventrouter, team, channel, metadata, includes_
channel.got_history = True
for message in reversed(message_json["messages"]):
message = process_message(message, eventrouter, team, channel, metadata, history_message=True)
- if (not includes_threads and config.thread_messages_in_channel
- and message and message.number_of_replies()):
+ if (not includes_threads and message and message.number_of_replies() and
+ (config.thread_messages_in_channel or message.subscribed and
+ SlackTS(message.message_json.get("latest_reply", 0)) > message.last_read)):
channel.get_thread_history(message.ts, metadata["slow_queue"], metadata["no_log"])
channel.pending_history_requests.discard(channel.identifier)