-
Notifications
You must be signed in to change notification settings - Fork 170
fix: fatal server error when creating room with channel (#1343) #1379
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
base: dev
Are you sure you want to change the base?
fix: fatal server error when creating room with channel (#1343) #1379
Conversation
Currently translated at 0.1% (3 of 4121 strings) Translation: eventyay/Eventyay Tickets Translate-URL: https://hosted.weblate.org/projects/open-event/eventyay-tickets/zh_Hant/
Currently translated at 0.2% (9 of 4121 strings) Translation: eventyay/Eventyay Tickets Translate-URL: https://hosted.weblate.org/projects/open-event/eventyay-tickets/zh_Hant/
Currently translated at 0.4% (18 of 4121 strings) Translation: eventyay/Eventyay Tickets Translate-URL: https://hosted.weblate.org/projects/open-event/eventyay-tickets/pl_INFORMAL/
Currently translated at 2.9% (123 of 4121 strings) Translation: eventyay/eventyay Translate-URL: https://hosted.weblate.org/projects/eventyay/eventyay/zh_Hant/
Currently translated at 2.9% (123 of 4121 strings) Translation: eventyay/eventyay Translate-URL: https://hosted.weblate.org/projects/eventyay/eventyay/zh_Hant/
The issue was caused by unconditional access to test_form.cleaned_data without checking if the form validation succeeded. When test_form.is_valid() returned False, accessing cleaned_data could raise AttributeError or return incomplete data, causing a 500 error. Solution: Added conditional check to only access cleaned_data when form is valid, otherwise use empty dict for initial values. This ensures the export page loads properly even when no valid GET parameters are provided. Changes: - Modified ExportMixin.exporters property in control/views/orders.py - Added validation check before accessing test_form.cleaned_data - Fallback to empty dict when form is invalid
Applied the same fix from issueto the organizer-level export
functionality. The ExportMixin in organizer.py had the identical issue
where test_form.cleaned_data was accessed without checking if the form
validation succeeded first.
This prevents potential HTTP 500 errors when accessing:
- /control/organizer/{organizer}/export/
Changes:
- Modified ExportMixin.exporters in control/views/organizer.py
- Added validation check before accessing test_form.cleaned_data
- Fallback to empty dict when form is invalid
- Use f-strings instead of string concatenation for better readability - Rename 'id' variable to 'identifier' to avoid shadowing builtin - Apply improvements to both orders.py and organizer.py Addresses Sourcery suggestions...
- Add JSON_FIELD_AVAILABLE setting based on database backend (postgresql = True) - Fix checkinlists exporter using old Event.items instead of Event.products - Resolves AttributeError when accessing export functionality
- Changed from if/else validation check to getattr() to preserve partial cleaned_data - This allows useful defaults even when form is partially invalid - Reverted unnecessary 'id' to 'identifier' rename in organizer.py - Renamed 'items' field to 'products' in checkinlists exporter for consistency - Updated form_data['items'] to form_data['products'] reference
…fossasia#1157) * Fix navigation button border radius inconsistency - Added border-radius: 0 to .header-nav class in orga/_layout.css - Makes Talk component navigation buttons match Tickets component style - Ensures consistent sharp corners across all navigation buttons - Maintains visual consistency throughout the platform Fixes fossasia#1156 * Add inset shadow on hover to match Tickets component - Added hover and active states with inset box-shadow - Matches the hover effect from btn-success in Tickets component - Uses rgba(0, 128, 0, 0.25) for green inset shadow * Fix navigation button active state to match Tickets component - Added .header-nav.active state with proper inset shadow - Fixed depth and consistency of hover, active, and current page states - Current page button now has same darker border effect as Tickets - All navigation buttons now have identical visual feedback * Improve CSS: use variables and remove important declarations * Fix CSS indentation formatting * Update app/eventyay/static/orga/css/_layout.css * Update app/eventyay/static/orga/css/_layout.css * Fix navigation buttons: sharp corners and inset shadow to match Tickets component --------- Co-authored-by: Mario Behling <[email protected]>
* talk: remove ticket/video URL fields * talk: normalize ticket base URL * Update app/eventyay/agenda/views/talk.py --------- Co-authored-by: Mario Behling <[email protected]>
…t-500-clean fix: unable to export order data – HTTP 500 error
…fossasia#1248) (fossasia#1357) Co-authored-by: Mario Behling <[email protected]>
i18n(translations): update localized strings from Weblate
…sasia#1321) * fix: Resolve multiple exporter failures after database migration * Update app/eventyay/base/exporters/waitinglist.py * removed redundant length checks in reports exporter * Update app/eventyay/plugins/ticketoutputpdf/exporters.py * Update app/eventyay/plugins/checkinlists/exporters.py * Update app/eventyay/plugins/badges/exporters.py * fix: remove duplicate JSON_FIELD_AVAILABLE definition --------- Co-authored-by: Mario Behling <[email protected]> Co-authored-by: Srivatsav Auswin <[email protected]>
…fossasia#1331) * fixed featured sessions and 500 errors on sessions and reviews * implemented suggestions --------- Co-authored-by: Mario Behling <[email protected]>
…a#997 (fossasia#1352) Co-authored-by: Mario Behling <[email protected]>
Co-authored-by: Mario Behling <[email protected]>
* urls fix * fix pages and schedule communication * implemented suggestions --------- Co-authored-by: Mario Behling <[email protected]>
Currently translated at 85.9% (3543 of 4121 strings) Translation: eventyay/eventyay Translate-URL: https://hosted.weblate.org/projects/eventyay/eventyay/pt_PT/
* Fix missing CSS regeneration * Update app/eventyay/eventyay_common/views/event.py --------- Co-authored-by: Mario Behling <[email protected]>
…iles (fossasia#1370) * fix(locale): Remove old translation files introduced by weblate The updated translation files are already available in the new `enext` system under `app/eventyay/locale`. * fix(locale): Merge redundant language files
i18n(translations): update localized strings from Weblate
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsures that when creating a room with an associated chat channel, the newly created Channel instance is attached to the in-memory Room object before audit logging/serialization, preventing lazy-loading-related fatal errors. Sequence diagram for room creation with attached channelsequenceDiagram
participant Caller
participant Service as EventService
participant Room
participant ChannelModel as Channel
participant Serializer as RoomConfigSerializer
participant AuditLogModel as AuditLog
Caller->>Service: _create_room(data, with_channel=True, permission_preset, creator)
Service->>Room: create Room instance
activate Room
Room-->>Service: room
deactivate Room
alt with_channel is True
Service->>ChannelModel: objects.create(event_id=room.event_id, room=room)
activate ChannelModel
ChannelModel-->>Service: channel
deactivate ChannelModel
Service->>Room: set channel on room (room.channel = channel)
end
Service->>Serializer: RoomConfigSerializer(room)
activate Serializer
Serializer-->>Service: serialized room data (includes channel id)
deactivate Serializer
Service->>AuditLogModel: objects.create(event_id=room.event_id, data=serialized room data)
activate AuditLogModel
AuditLogModel-->>Service: audit_log
deactivate AuditLogModel
Service-->>Caller: room
Class diagram for Room, Channel, AuditLog and RoomConfigSerializerclassDiagram
class Room {
int id
int event_id
Channel channel
}
class Channel {
int id
int event_id
Room room
}
class AuditLog {
int id
int event_id
string data
datetime created_at
}
class RoomConfigSerializer {
Room instance
dict data
RoomConfigSerializer(Room instance)
}
Room --> Channel : has_one
Channel --> Room : belongs_to
AuditLog --> Room : logs_changes_for
RoomConfigSerializer --> Room : serializes
RoomConfigSerializer ..> Channel : accesses_channel_via_room
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mariobehling
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please showcase functionality by providing screenshots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a fatal server error that occurred when creating a room with a chat channel enabled. The issue was caused by Django's ORM lazy-loading behavior when accessing the room.channel relationship during audit log serialization within an async context.
Key Changes:
- Explicitly assigns the newly created channel object to
room.channelin memory after channel creation - Ensures
RoomConfigSerializercan access the channel without triggering additional database queries
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9af4f31 to
59ca26d
Compare
|
@mariobehling Thanks for the review.
Since I am working in a cloud-based environment (Codespaces), I am currently blocked by a WebSocket restriction (Error 1006) which prevents the video frontend from rendering fully to capture a screenshot.
|
Description
Fixed a "Fatal Server Error" that occurred when creating a new room with a chat channel (e.g., "Chat" or "BigBlueButton" modules enabled).
The issue was caused because
RoomConfigSerializerattempted to access theroom.channelrelationship inside theAuditLogcreation step. Since thechannelobject was created but not manually attached to theroominstance in memory, the serializer triggered a lazy database lookup inside thesync_to_asynccontext, which likely failed or caused a race condition.Issues
Closes #1343
Fix
channelobject toroom.channelin memory before calling the serializer.RoomConfigSerializer(room).datacan serialize the channel ID without triggering additional database queries or failing.Type of Change
Summary by Sourcery
Bug Fixes: