-
Notifications
You must be signed in to change notification settings - Fork 135
chore: fixed featured sessions and 500 errors on sessions and reviews #1331
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: enext
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR enhances the featured sessions UI and fixes server errors by updating CSS and templates for proper alignment and URL handling, refining locale lookups in the Event model, and correcting JS request construction and CSRF header naming. Sequence diagram for toggling featured status with improved URL and CSRF handlingsequenceDiagram
actor User
participant "Session List Page"
participant "JavaScript (main.js)"
participant "Backend Server"
User->>"Session List Page": Loads page
"Session List Page"->>"JavaScript (main.js)": Renders featured checkbox with data-url and correct CSRF token
User->>"JavaScript (main.js)": Clicks featured checkbox
"JavaScript (main.js)"->>"Backend Server": POST to toggle_featured (using data-url, eventyay_csrftoken)
Backend Server-->>"JavaScript (main.js)": Returns status
"JavaScript (main.js)"->>User: Updates UI status
Class diagram for Event model locale lookup changesclassDiagram
class Event {
+available_content_locales() list
+named_content_locales() list
+named_plugin_locales() list
}
class settings {
LANGUAGES
}
class LANGUAGE_NAMES
Event --> settings : uses LANGUAGES
Event --> LANGUAGE_NAMES : uses LANGUAGE_NAMES in named_content_locales
File-Level Changes
Assessment against linked issues
Possibly 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.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `app/eventyay/static/orga/css/_layout.css:59-67` </location>
<code_context>
.submission_featured {
position: relative;
text-align: center;
+ vertical-align: middle;
+
+ .form-check {
</code_context>
<issue_to_address>
**suggestion:** Consider if vertical-align is effective for block-level elements.
'vertical-align: middle;' does not work as expected on divs. For vertical centering, consider using flexbox or grid instead.
```suggestion
.submission_featured {
position: relative;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.form-check {
display: inline-block;
margin: 0;
}
```
</issue_to_address>
### Comment 2
<location> `app/eventyay/base/models/event.py:2118` </location>
<code_context>
@cached_property
def named_content_locales(self) -> list:
locale_names = dict(self.available_content_locales)
# locale_names['en-us'] = locale_names['en']
locale_names.update(LANGUAGE_NAMES)
return [(code, locale_names.get(code, code)) for code in self.content_locales]
</code_context>
<issue_to_address>
**suggestion (code-quality):** Merge dictionary updates via the union operator ([`dict-assign-update-to-union`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/dict-assign-update-to-union/))
```suggestion
locale_names |= LANGUAGE_NAMES
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 featured session functionality and resolves 500 errors occurring on session and review pages by correcting CSRF token references and improving locale handling.
Key Changes:
- Updated CSRF token cookie name from
pretalx_csrftokentoeventyay_csrftokenin JavaScript - Enhanced featured session toggle UI with improved centering and styling
- Modified locale resolution logic to prevent 500 errors when content locales are not found
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/eventyay/static/orga/js/main.js | Updates CSRF token name and adds support for data-url attribute with fallback URL construction for featured toggle requests |
| app/eventyay/static/orga/css/_layout.css | Improves featured checkbox alignment with vertical centering and inline-flex layout |
| app/eventyay/orga/templates/orga/submission/list.html | Adds data-url attribute to featured toggle input and centers the featured column header |
| app/eventyay/base/models/event.py | Changes locale source from default_django_settings.LANGUAGES to settings.LANGUAGES and adds fallback for missing locale names |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| locale_names = dict(self.available_content_locales) | ||
| # locale_names['en-us'] = locale_names['en'] | ||
| return [(code, locale_names[code]) for code in self.content_locales] | ||
| locale_names |= LANGUAGE_NAMES |
Copilot
AI
Nov 22, 2025
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.
The merge operation locale_names |= LANGUAGE_NAMES is problematic because:
locale_namesis created fromdict(self.available_content_locales)(line 2157)available_content_localesalready usesdict(settings.LANGUAGES)(line 2151)LANGUAGE_NAMESis redefined at line 74 as{code: name for code, name in settings.LANGUAGES}
This means you're merging settings.LANGUAGES back into a dict that was already built from settings.LANGUAGES, making this operation redundant.
The intended behavior appears to be merging the imported LANGUAGE_NAMES from eventyay.common.language (which contains additional language names from settings.LANGUAGES_INFORMATION), but the redefinition at line 74 overwrites that import.
Suggestion: Remove the redefinition at line 74 to use the imported LANGUAGE_NAMES, which contains the enhanced language information from settings.LANGUAGES_INFORMATION.
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 check AI comments.
Fixes #1291 and solves 500 errors on sessions and review page
Summary by Sourcery
Improve UI and robustness of the featured session toggle and resolve server errors on session and review pages
Bug Fixes:
Enhancements: