Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolved key error in notification pref apis #36064

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/notifications/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def update_notification_fields(
if field in source_config:
target_config[field] |= source_config[field]
if "email_cadence" in source_config:
if isinstance(target_config["email_cadence"], str) or not target_config["email_cadence"]:
if not target_config.get("email_cadence") or isinstance(target_config.get("email_cadence"), str):
target_config["email_cadence"] = set()

target_config["email_cadence"].add(source_config["email_cadence"])
Expand Down Expand Up @@ -263,7 +263,7 @@ def aggregate_notification_configs(existing_user_configs: List[Dict]) -> Dict:
# if email_cadence is mixed, set it to "Mixed"
for app in result_config:
for type_key, type_config in result_config[app]["notification_types"].items():
if len(type_config["email_cadence"]) > 1:
if len(type_config.get("email_cadence", [])) > 1:
result_config[app]["notification_types"][type_key]["email_cadence"] = "Mixed"
else:
result_config[app]["notification_types"][type_key]["email_cadence"] = (
Expand Down
Loading