diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-09-17 12:30:48 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | c102376e7b3052126680465c3f99c1b3818ed697 (patch) | |
tree | aebe387ef1f6d79a3f07df7f68e5f2ad3e78ebd8 /slack/slack_message.py | |
parent | 94ef876bd1b1c94e03b389183160bf8373b96114 (diff) | |
download | wee-slack-c102376e7b3052126680465c3f99c1b3818ed697.tar.gz |
Make sure thread prefix is rendered even though parent isn't fetched
Diffstat (limited to 'slack/slack_message.py')
-rw-r--r-- | slack/slack_message.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/slack/slack_message.py b/slack/slack_message.py index c36e052..bb4d141 100644 --- a/slack/slack_message.py +++ b/slack/slack_message.py @@ -175,7 +175,7 @@ class SlackMessage: def parent_message(self) -> Optional[SlackMessage]: if not self.is_reply or self.thread_ts is None: return None - return self.conversation.messages[self.thread_ts] + return self.conversation.messages.get(self.thread_ts) @property def is_bot_message(self) -> bool: @@ -591,17 +591,17 @@ class SlackMessage: return "" def _create_thread_prefix(self) -> str: - parent_message = self.parent_message - if not parent_message: + if not self.is_reply or self.thread_ts is None: return "" + thread_hash = self.conversation.message_hashes[self.thread_ts] broadcast_text = ( shared.config.look.thread_broadcast_prefix.value if self.is_thread_broadcast else "" ) - text = f"[{broadcast_text}{parent_message.hash}]" - return with_color(nick_color(str(parent_message.hash)), text) + " " + text = f"[{broadcast_text}{thread_hash}]" + return with_color(nick_color(thread_hash), text) + " " def _create_thread_string(self) -> str: if "reply_count" not in self._message_json: |