rocketchat: Only set message content if it exists.

Not sure where those come from since we discovered this with production
data.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
This commit is contained in:
Florian Pritz 2022-06-29 15:42:51 +02:00 committed by Tim Abbott
parent 1cc2764d45
commit c308799133

View File

@ -648,7 +648,15 @@ def process_messages(
def message_to_dict(message: Dict[str, Any]) -> Dict[str, Any]:
rc_sender_id = message["u"]["_id"]
sender_id = user_id_mapper.get(rc_sender_id)
content = message["msg"]
if "msg" in message:
content = message["msg"]
else: # nocoverage
content = "This message imported from Rocket.Chat had no body in the data export."
logging.info(
"Message %s contains no message content: %s",
message["_id"],
message,
)
if message.get("reactions"):
reactions = list_reactions(message["reactions"])