Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

realm_audit_log: Explicitly stringify dict before insertion.

Zixuan James Liad17096c9cb8
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index b11276bb4be..429504b36d7 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -633,7 +633,7 @@ def do_change_remote_server_plan_type(remote_server: RemoteZulipServer, plan_typ
event_type=RealmAuditLog.REMOTE_SERVER_PLAN_TYPE_CHANGED,
server=remote_server,
event_time=timezone_now(),
- extra_data={"old_value": old_value, "new_value": plan_type},
+ extra_data=str({"old_value": old_value, "new_value": plan_type}),
)
@@ -951,7 +951,7 @@ def attach_discount_to_realm(
acting_user=acting_user,
event_type=RealmAuditLog.REALM_DISCOUNT_CHANGED,
event_time=timezone_now(),
- extra_data={"old_discount": old_discount, "new_discount": discount},
+ extra_data=str({"old_discount": old_discount, "new_discount": discount}),
)
@@ -966,9 +966,7 @@ def update_sponsorship_status(
acting_user=acting_user,
event_type=RealmAuditLog.REALM_SPONSORSHIP_PENDING_STATUS_CHANGED,
event_time=timezone_now(),
- extra_data={
- "sponsorship_pending": sponsorship_pending,
- },
+ extra_data=str({"sponsorship_pending": sponsorship_pending}),
)
@@ -1213,7 +1211,5 @@ def update_billing_method_of_current_plan(
acting_user=acting_user,
event_type=RealmAuditLog.REALM_BILLING_METHOD_CHANGED,
event_time=timezone_now(),
- extra_data={
- "charge_automatically": charge_automatically,
- },
+ extra_data=str({"charge_automatically": charge_automatically}),
)
diff --git a/zerver/actions/create_realm.py b/zerver/actions/create_realm.py
index 48afc3e5134..b362ab23a7c 100644
--- a/zerver/actions/create_realm.py
+++ b/zerver/actions/create_realm.py
@@ -57,7 +57,7 @@ def do_change_realm_subdomain(
event_type=RealmAuditLog.REALM_SUBDOMAIN_CHANGED,
event_time=timezone_now(),
acting_user=acting_user,
- extra_data={"old_subdomain": old_subdomain, "new_subdomain": new_subdomain},
+ extra_data=str({"old_subdomain": old_subdomain, "new_subdomain": new_subdomain}),
)
# If a realm if being renamed multiple times, we should find all the placeholder
diff --git a/zerver/actions/realm_icon.py b/zerver/actions/realm_icon.py
index 1ba7cba42e8..f5f6e105123 100644
--- a/zerver/actions/realm_icon.py
+++ b/zerver/actions/realm_icon.py
@@ -20,7 +20,7 @@ def do_change_icon_source(
RealmAuditLog.objects.create(
realm=realm,
event_type=RealmAuditLog.REALM_ICON_SOURCE_CHANGED,
- extra_data={"icon_source": icon_source, "icon_version": realm.icon_version},
+ extra_data=str({"icon_source": icon_source, "icon_version": realm.icon_version}),
event_time=event_time,
acting_user=acting_user,
)
diff --git a/zerver/actions/realm_settings.py b/zerver/actions/realm_settings.py
index 8de623f4611..f61e30d2aa7 100644
--- a/zerver/actions/realm_settings.py
+++ b/zerver/actions/realm_settings.py
@@ -400,7 +400,7 @@ def do_change_realm_org_type(
realm=realm,
event_time=timezone_now(),
acting_user=acting_user,
- extra_data={"old_value": old_value, "new_value": org_type},
+ extra_data=str({"old_value": old_value, "new_value": org_type}),
)
event = dict(type="realm", op="update", property="org_type", value=org_type)
@@ -419,7 +419,7 @@ def do_change_realm_plan_type(
realm=realm,
event_time=timezone_now(),
acting_user=acting_user,
- extra_data={"old_value": old_value, "new_value": plan_type},
+ extra_data=str({"old_value": old_value, "new_value": plan_type}),
)
if plan_type == Realm.PLAN_TYPE_PLUS:
diff --git a/zerver/actions/user_settings.py b/zerver/actions/user_settings.py
index 92b68131a63..6418fea7d3f 100644
--- a/zerver/actions/user_settings.py
+++ b/zerver/actions/user_settings.py
@@ -300,7 +300,7 @@ def do_change_avatar_fields(
realm=user_profile.realm,
modified_user=user_profile,
event_type=RealmAuditLog.USER_AVATAR_SOURCE_CHANGED,
- extra_data={"avatar_source": avatar_source},
+ extra_data=str({"avatar_source": avatar_source}),
event_time=event_time,
acting_user=acting_user,
)