aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-06-07 16:58:08 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-06-07 17:07:48 +0200
commit52b6d454ed6bf9dad95ffb3c8cba0b4b7156b853 (patch)
tree3539b30796dd2d21145ecc316ad57e30a23ae74f /wee_slack.py
parent25ea30b95ec188e230319e43662aef7cf937f7c0 (diff)
downloadwee-slack-52b6d454ed6bf9dad95ffb3c8cba0b4b7156b853.tar.gz
Set history_needs_update when receiving history
If wee-slack looses connection to the server while a history request is in the queue and reconnects before the history response is received, it will set history_needs_update to True and call get_history, but since a history request is pending, a new one won't be triggered so history_needs_update will remain True. Setting history_needs_update to False when receiving the history fixes this.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index cc2c80c..1663951 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3061,6 +3061,7 @@ def handle_mpimopen(mpim_json, eventrouter, team, channel, metadata, object_name
def handle_history(message_json, eventrouter, team, channel, metadata, includes_threads=True):
channel.got_history = True
+ channel.history_needs_update = False
for message in reversed(message_json["messages"]):
message = process_message(message, eventrouter, team, channel, metadata, history_message=True)
if (not includes_threads and message and message.number_of_replies() and
@@ -3092,6 +3093,8 @@ def handle_conversationsreplies(message_json, eventrouter, team, channel, metada
channel.pending_history_requests.discard(metadata.get('thread_ts'))
thread_channel = channel.thread_channels.get(metadata.get('thread_ts'))
if thread_channel and thread_channel.active:
+ thread_channel.got_history = True
+ thread_channel.history_needs_update = False
thread_channel.reprint_messages(history_message=True, no_log=metadata["no_log"])
if config.thread_messages_in_channel:
channel.reprint_messages(history_message=True, no_log=metadata["no_log"])