v3 notification preferences: PUT with email_cadence but no notification_channel raises KeyError (500)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 66/100
Hướng nghiên cứu
Bắt đầu với PUT tới /api/notifications/v3/configurations/ bằng payload trong issue, payload này sẽ tái hiện KeyError trong _prepare_update_data. So sánh phương thức này và _log_preference_update_event với _prepare_response_data, phương thức đã suy ra email_cadence làm kênh, rồi kiểm tra UserNotificationPreferenceUpdateAllSerializer.validate(). Hoàn thành khi yêu cầu thành công với kênh được suy ra, hoặc trả về 400 nêu tên trường. Maintainer cần chọn hành vi mong muốn trước khi thực hiện thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
PUT /api/notifications/v3/configurations/ with an e-mail cadence and no notification_channel:
{"notification_app": "discussion", "notification_type": "grouped_notification",
"email_cadence": "Weekly"}
passes validation, then fails in the view:
KeyError: 'notification_channel'
in _prepare_update_data
Internal Server Error: /api/notifications/v3/configurations/
With "notification_channel": "email_cadence" added, the same update succeeds (200). The account MFE always sends the channel, so this is only reachable through the API.
Cause: UserNotificationPreferenceUpdateAllSerializer.validate() deliberately lets email_cadence stand in for the channel (it only requires notification_channel when there is no email_cadence), and NotificationPreferencesViewV3._prepare_response_data infers channel = 'email_cadence' in that case. But _prepare_update_data and _log_preference_update_event both read validated_data['notification_channel'] directly, so the request 500s before the update is applied.
Expected: infer email_cadence as the channel in _prepare_update_data and _log_preference_update_event, as _prepare_response_data already does (or, if the channel is meant to be mandatory, require it in the serializer so the client gets a 400 naming the field).
Environment: Tutor main, image of 2026-09-18; code unchanged on master as of 2026-10-13. Found by the Open edX end-to-end test suite.
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 4.4k
- Merge trung bình
- 2 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 40
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openedx/openedx-platform
-
Discussion API: missing thread returns 500 (ForumV2RequestError not mapped to ThreadNotFoundError)Có thể làm lại được @mbhavu2007-lang đã nhận 16 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openedx/openedx-platform#39225 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
openedx/openedx-platform#39169 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
openedx/openedx-platform#39084 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 82/100
openedx/openedx-platform#38792 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openedx/openedx-platform#38544 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openedx/openedx-platform
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
btclib-org/btclib-wallet#1045 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area-templates triage:bot-seen triage:needs-human
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
microsoft/aspire#22356 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Train] An elastic ScalingConfig(num_workers=(0, 0)) is accepted and the run waits foreverCó thể đã có người làm @wguo7 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ray-project/ray#68217 ·
Maintainer thường phản hồi trong vòng 2 ngày