Skip to content

feat: add gravatar configuration to cfp settings#2128

Open
sarafarajnasardi wants to merge 13 commits intofossasia:devfrom
sarafarajnasardi:2119
Open

feat: add gravatar configuration to cfp settings#2128
sarafarajnasardi wants to merge 13 commits intofossasia:devfrom
sarafarajnasardi:2119

Conversation

@sarafarajnasardi
Copy link
Copy Markdown
Contributor

@sarafarajnasardi sarafarajnasardi commented Jan 26, 2026

Description
Implemented a new setting to enable/disable Gravatar support for speaker profile pictures in the Call for Participation (CfP) flow. This allows organizers to control whether speakers can retrieve their avatars via Gravatar.

Changes
Backend: Added cfp_enable_gravatar setting to the CfP model and updated the speaker profile form to respect it.
Organizer UI: Added a Settings column to the CfP configuration table with a toggle to enable/disable Gravatar.
Speaker UI: Updated the avatar template to conditionally render Gravatar options and fixed the preview visibility logic.

fixes #2119

Screencast.From.2026-01-26.18-07-12.mp4

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @sarafarajnasardi, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sarafarajnasardi sarafarajnasardi marked this pull request as ready for review January 26, 2026 12:24
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 introduces an event-level setting to enable or disable Gravatar usage for speaker profile pictures in the CfP flow, and wires it through the admin UI, forms, and templates so organisers can control whether Gravatar is offered.

Changes:

  • Added a cfp_enable_gravatar setting on CfP (with an enable_gravatar property) and surfaced it via CfPSettingsForm and the organiser “Speaker Information” settings table, including a dedicated toggle in the “Profile picture” row.
  • Updated SpeakerProfileForm and the avatar template to respect the new setting by conditionally showing the Gravatar checkbox, adjusting the “required avatar” validation message, and fixing avatar preview visibility and fallback src logic when only Gravatar is used.
  • Tightened the question toggle JavaScript to only attach AJAX handlers to elements that carry data-question-id, and added a defensive guard in the form-page toggle handler to avoid errors when related elements are missing.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/eventyay/base/models/cfp.py Adds cfp_enable_gravatar to the default CfP settings and a new enable_gravatar property that drives the rest of the Gravatar feature, defaulting to enabled for existing and new events.
app/eventyay/orga/forms/cfp.py Extends CfPSettingsForm with a cfp_enable_gravatar BooleanField, initialised from CfP.enable_gravatar, and persists it into cfp.settings during save.
app/eventyay/orga/templates/orga/cfp/forms.html Adds a “Settings” column to proposal and speaker information tables and inserts a toggle-style checkbox for cfp_enable_gravatar in the “Profile picture” row.
app/eventyay/person/forms/profile.py Makes the speaker profile form drop the get_gravatar field when Gravatar is disabled and adjusts the avatar-required validation message based on cfp.enable_gravatar.
app/eventyay/common/templates/common/avatar.html Conditionally renders the Gravatar checkbox and preview based on request.event.cfp.enable_gravatar, and updates the preview visibility and img src fallback logic for Gravatar-only avatars.
app/eventyay/static/orga/js/questionToggles.js Restricts AJAX toggle handlers to elements with data-question-id and adds a null-check guard in the form-page toggle logic to avoid accessing missing hidden inputs or dropdowns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we also need a description text in front of the toggle. Please add "Enable Gravatar".

@sarafarajnasardi
Copy link
Copy Markdown
Contributor Author

added
Screenshot From 2026-01-26 20-52-04

@sarafarajnasardi
Copy link
Copy Markdown
Contributor Author

@mariobehling Test coverage added for enable_gravatar property.

Replace direct user.avatar.url access with avatar_url property
for cleaner code while preserving gravatar functionality.

Signed-off-by: Sara Faraj <sarafaraj@users.noreply.github.com>
@sarafarajnasardi sarafarajnasardi force-pushed the 2119 branch 2 times, most recently from 9ec3600 to 7fc0439 Compare February 8, 2026 13:23
Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve conflicts.

@sarafarajnasardi sarafarajnasardi force-pushed the 2119 branch 2 times, most recently from 105164f to 9e756f1 Compare February 17, 2026 13:09
@sarafarajnasardi
Copy link
Copy Markdown
Contributor Author

@mariobehling I have resolved all the conflicts...

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Comment on lines +613 to +617
<td class="text-center">
<span class="mr-1">{% translate "Enable Gravatar" %}</span>
<label class="toggle-switch" aria-label="{% translate "Enable Gravatar" %}">
{{ sform.cfp_enable_gravatar }}
<span class="toggle-slider"></span>
Copy link
Copy Markdown
Member

@ArnavBallinCode ArnavBallinCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the above requested changes.

Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I reviewed the diff in detail. The overall feature makes sense, and the main Gravatar setting flow across model, organiser form, speaker form, and avatar template looks good.

Before merge, please tighten the scope of this PR. The changes in questionToggles.js and the broader tests/talk/conftest.py refactor do not appear to be directly related to the Gravatar feature and make the review harder. Please move those into separate PRs unless they are strictly required here.

In addition, please help us keep the contribution process efficient:

  • Avoid long running PRs. They become harder to review and manage over time and slow down the overall PR queue.
  • Focus on finishing and getting existing PRs merged before opening new ones.
  • As a guideline, contributors should typically not have more than 3 open PRs at the same time.

mariobehling and others added 2 commits March 20, 2026 14:23
Signed-off-by: Sarafaraj Nasardi <sarafarajnasardi786@gmail.com>
@sarafarajnasardi
Copy link
Copy Markdown
Contributor Author

Thank you for review and giving feedback. I have done the changes which you told and also made PR more clean. I will keep in mind to not add extra things in PR next time. Please tell if anything more is needed from my side...

- Implemented professional 9-column layout for Speaker Information table
- Added explicit column widths for robust alignment
- Restored 'Enable Gravatar' label text for better clarity
- Refactored fav-button.js to replace unsafe innerHTML with safe DOM manipulation

Signed-off-by: Sarafaraj Nasardi <sarafarajnasardi786@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Allow organisers to enable or disable Gravatar for speaker profile pictures

5 participants