From 7fc6235abe3382f1f1ac0f0b503fe3e392127636 Mon Sep 17 00:00:00 2001 From: Seaswimmer Date: Mon, 3 Jun 2024 00:15:17 -0400 Subject: [PATCH] fix(aurora): remove bot keys from the change import when importing from aurora --- aurora/importers/aurora.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/aurora/importers/aurora.py b/aurora/importers/aurora.py index e9622a4..1a1777d 100644 --- a/aurora/importers/aurora.py +++ b/aurora/importers/aurora.py @@ -72,11 +72,15 @@ class ImportAuroraView(ui.View): case["moderator_id"] = int(case["moderator_id"]) if "changes" not in case or not case["changes"]: - case["changes"] = [] + changes = [] else: - case["changes"] = json.loads(case["changes"]) - if isinstance(case["changes"], str): - case["changes"] = json.loads(case["changes"]) + changes = json.loads(case["changes"]) + if isinstance(changes, str): + changes: list[dict] = json.loads(changes) + + for change in changes: + if change.get("bot"): + del change["bot"] if "metadata" not in case: metadata = {} @@ -107,7 +111,7 @@ class ImportAuroraView(ui.View): resolved_by=case["resolved_by"], resolved_reason=case["resolve_reason"], expired=case["expired"], - changes=case["changes"], + changes=changes, metadata=metadata, database=database, )