mirror of https://github.com/zulip/zulip.git
slack import: Refactor handling of dropped messages.
This is a more coherent ordering, because some messages we skip lack a "text" attribute.
This commit is contained in:
parent
e759fd9be4
commit
acd3a364e1
|
@ -666,6 +666,12 @@ def channel_message_to_zerver_message(realm_id: int, users: List[ZerverFieldsT],
|
||||||
# Ignore messages without user names
|
# Ignore messages without user names
|
||||||
# These are Sometimes produced by slack
|
# These are Sometimes produced by slack
|
||||||
continue
|
continue
|
||||||
|
if message.get('subtype') in [
|
||||||
|
"channel_join",
|
||||||
|
"channel_leave",
|
||||||
|
"channel_name"
|
||||||
|
]:
|
||||||
|
continue
|
||||||
|
|
||||||
has_attachment = has_image = False
|
has_attachment = has_image = False
|
||||||
try:
|
try:
|
||||||
|
@ -689,14 +695,11 @@ def channel_message_to_zerver_message(realm_id: int, users: List[ZerverFieldsT],
|
||||||
# Process different subtypes of slack messages
|
# Process different subtypes of slack messages
|
||||||
if 'subtype' in message.keys():
|
if 'subtype' in message.keys():
|
||||||
subtype = message['subtype']
|
subtype = message['subtype']
|
||||||
if subtype in ["channel_join", "channel_leave", "channel_name"]:
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Subtypes which have only the action in the message should
|
# Subtypes which have only the action in the message should
|
||||||
# be rendered with '/me' in the content initially
|
# be rendered with '/me' in the content initially
|
||||||
# For example "sh_room_created" has the message 'started a call'
|
# For example "sh_room_created" has the message 'started a call'
|
||||||
# which should be displayed as '/me started a call'
|
# which should be displayed as '/me started a call'
|
||||||
elif subtype in ["bot_add", "sh_room_created", "me_message"]:
|
if subtype in ["bot_add", "sh_room_created", "me_message"]:
|
||||||
content = ('/me %s' % (content))
|
content = ('/me %s' % (content))
|
||||||
|
|
||||||
# For attachments with slack download link
|
# For attachments with slack download link
|
||||||
|
|
Loading…
Reference in New Issue