From 36339b69988940ae8533c65b4b6b8d12cdd8bf64 Mon Sep 17 00:00:00 2001 From: PieterCK Date: Thu, 6 Mar 2025 18:01:41 +0700 Subject: [PATCH] slack_import: Fix thread conversion condition. Currently, threads in Slack direct messages will increment the `thread_counter` variable inside the thread conversion logic. Since we don't treat thread messages in Slack DMs differently than any other DM, threads in DM will only falsely increment the thread topic names in channels. This adds a condition that checks if the Slack message is a DM or not before executing the thread conversion logic. (cherry picked from commit d5e28bcd28bd9041d4ec64d40540f580fb14fe98) --- zerver/data_import/slack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/data_import/slack.py b/zerver/data_import/slack.py index 2d2d11d31b..f0acc0c9c0 100644 --- a/zerver/data_import/slack.py +++ b/zerver/data_import/slack.py @@ -1005,7 +1005,7 @@ def channel_message_to_zerver_message( # threads each generate a unique topic labeled by the date and # a counter among topics on that day. topic_name = "imported from Slack" - if convert_slack_threads and "thread_ts" in message: + if convert_slack_threads and not is_direct_message_type and "thread_ts" in message: thread_ts = datetime.fromtimestamp(float(message["thread_ts"]), tz=timezone.utc) thread_ts_str = thread_ts.strftime(r"%Y/%m/%d %H:%M:%S") # The topic name is "2015-08-18 Slack thread 2", where the counter at the end is to disambiguate