diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-04-21 00:19:05 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-05-30 21:13:20 +0200 |
commit | 7ee1d84870adaa03a0c077e8bef3ff0ed54290d7 (patch) | |
tree | 9b5f44a665f8be92a6b680fd1a9f4f376e33209d | |
parent | d79f8e9942c14ddd326c32e8a21eea936789229a (diff) | |
download | wee-slack-7ee1d84870adaa03a0c077e8bef3ff0ed54290d7.tar.gz |
Only store ts in submessages
So we don't have references to the thread message instances both in
messages and submessages.
-rw-r--r-- | wee_slack.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index e402ca5..8ff66c3 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2342,7 +2342,7 @@ class SlackThreadChannel(SlackChannelCommon): self.eventrouter.receive(s) def main_message_keys_reversed(self): - return (message.ts for message in reversed(self.parent_message.submessages)) + return reversed(self.parent_message.submessages) def send_message(self, message, subtype=None, request_dict_ext={}): if subtype == 'me_message': @@ -2398,7 +2398,8 @@ class SlackThreadChannel(SlackChannelCommon): w.buffer_set(self.channel_buffer, "title", topic) def print_messages(self, history_message=False, no_log=False, force_render=False): - for message in chain([self.parent_message], self.parent_message.submessages): + messages = (self.messages[ts] for ts in self.parent_message.submessages) + for message in chain([self.parent_message], messages): self.prnt_message(message, history_message, no_log, force_render) def reprint_messages(self, history_message=False, no_log=True, force_render=False): @@ -3114,7 +3115,7 @@ def subprocess_thread_message(message_json, eventrouter, team, channel, history_ parent_message = channel.messages.get(SlackTS(parent_ts)) if parent_message: message = SlackThreadMessage(parent_message, message_json, team, channel) - parent_message.submessages.append(message) + parent_message.submessages.append(message.ts) channel.hash_message(parent_ts) channel.change_message(parent_ts) |