aboutsummaryrefslogtreecommitdiffstats
path: root/slack
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-30 23:24:55 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commitdce234ea366d688a0aa899aa1bc4cf56a2d1a009 (patch)
tree42d4dfb424a1f9407394a5e6db85460908a7d26e /slack
parent26f15a4a1572f529ff628df4e03dcd51da8f765a (diff)
downloadwee-slack-dce234ea366d688a0aa899aa1bc4cf56a2d1a009.tar.gz
Display the correct thread messages in channels
Both when filling from history and on new messages, only display thread messages in channels if they're either a thread broadcast or if the option to display thread messages in channels is enabled.
Diffstat (limited to 'slack')
-rw-r--r--slack/slack_conversation.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py
index 982f06a..20b1085 100644
--- a/slack/slack_conversation.py
+++ b/slack/slack_conversation.py
@@ -405,7 +405,8 @@ class SlackConversation:
await gather(*(message.render() for message in messages))
for message in reversed(messages):
- await self.print_message(message, backlog=True)
+ if self.should_display_message(message):
+ await self.print_message(message, backlog=True)
self.history_filled = True
self.history_pending = False
@@ -433,11 +434,18 @@ class SlackConversation:
return bool(weechat.config_string_to_boolean(buffer_value))
return shared.config.look.display_thread_replies_in_channel.value
+ def should_display_message(self, message: SlackMessage) -> bool:
+ return (
+ not message.is_reply
+ or message.is_thread_broadcast
+ or self.display_thread_replies()
+ )
+
async def add_new_message(self, message: SlackMessage):
# TODO: Remove old messages
self._messages[message.ts] = message
- if not message.is_reply or self.display_thread_replies():
+ if self.should_display_message(message):
if self.history_filled:
await self.print_message(message)
else: