mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
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 d5e28bcd28
)
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user