diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-05-09 00:40:32 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-05-30 21:13:21 +0200 |
commit | b79099c6f76bc4f75dab1616a58a45dc6780cbf4 (patch) | |
tree | 63839977c35f0d04f861a061120e017c40986717 /wee_slack.py | |
parent | 01cbcd7d3dd536f3d0c89cad496d95ffc856b817 (diff) | |
download | wee-slack-b79099c6f76bc4f75dab1616a58a45dc6780cbf4.tar.gz |
Keep submessages from old message when storing new
Submessages (or replies) are not a part of the message anymore with
conversations.history, we have to call conversations.replies to get
them. So when fetching the channel history, the new message will have an
empty submessages. Keep the old, so we don't have to call
conversations.replies for each thread parent every time we call
conversations.history.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py index 47c907e..4cc18f5 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1997,6 +1997,11 @@ class SlackChannel(SlackChannelCommon): def store_message(self, message_to_store): if not self.active: return + + old_message = self.messages.get(message_to_store.ts) + if old_message and old_message.submessages and not message_to_store.submessages: + message_to_store.submessages = old_message.submessages + self.messages[message_to_store.ts] = message_to_store self.messages = OrderedDict(sorted(self.messages.items())) |