Repository navigation
fix(rsvp): keep plugin avatars on RSVPs, mask anonymous ones - #2652
faisalahammad wants to merge 1 commit into
Conversation
- Register gatherpress_rsvp as an avatar comment type so core resolves RSVP avatars - Only replace the avatar for anonymous RSVPs seen without moderate_comments - Document RSVP visibility and the anonymous downgrade in process() Fixes GatherPress#2575
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test Coverage Report✅ All coverage checks passed! ✅ PHP Coverage✅ JavaScript CoverageThis comment is automatically updated on each push. |
wppoland
left a comment
There was a problem hiding this comment.
LGTM! Registering gatherpress_rsvp via get_avatar_comment_types so core resolves RSVP avatars directly (and preserves third-party pre_get_avatar_data providers like local avatar plugins), while only masking with force_default => true and found_avatar => false in modify_avatar_for_gatherpress_rsvp() when gatherpress_rsvp_anonymous is set and the viewer lacks Rsvp::CAPABILITY, is a much cleaner design. The new developer documentation section and unit tests look great too.
Fixes #2575
Proposed changes:
gatherpress_rsvpis now added to theget_avatar_comment_typesfilter, so core resolves RSVP avatars like it does for normal comments. Before this, core skipped the RSVP type andRsvp_Response::modify_avatar_for_gatherpress_rsvp()always set the avatar URL itself, which replaced avatars from other plugins (for example local avatar plugins usingpre_get_avatar_data), even for admins.modify_avatar_for_gatherpress_rsvp()now only steps in for an anonymous RSVP when the viewer cannotmoderate_comments. In that case it forces the default avatar. This is still needed because the masked comment keeps itsuser_id, so core alone would find the real avatar.Rsvp::process()andconstrain_rsvp_intent()explaining that an anonymous request is saved as public when the event does not allow anonymous RSVPs, and that callers must checkgatherpress_enable_anonymous_rsvpbefore callingprocess()if that matters to them.docs/developer/rsvp/README.mdcovering the single capability rule, where masking happens, and the avatar flow.Small behavior change: RSVP avatars now follow the site's default avatar setting, so an RSVP with no account and no email gets that default instead of a forced "mystery" image.
Other information:
AI assistance
Testing instructions:
Setup: "Show Avatars" on in Settings > Discussion, one event with RSVPs and "Enable Anonymous RSVP" checked, an admin and two subscribers (A and B).
As subscriber A, RSVP "Attending" normally. As subscriber B, RSVP "Attending" with "List me as anonymous" checked.
Log out and view the event. A shows their Gravatar. B shows as "Anonymous" with the default avatar.
Log in as subscriber A. B is still "Anonymous" with the default avatar.
Log in as admin. B shows their real name and Gravatar.
Add this mu-plugin (
wp-content/mu-plugins/test-avatar.php) or use a local avatar plugin:Log out and view the event. A shows the red "OK" avatar (before this fix it was replaced with the Gravatar). B still shows the default avatar.
Log in as admin. Both A and B show the red "OK" avatar.
Open the event's RSVP attendee list in admin. Avatars show for every RSVP.
Leave a normal comment on a post. Its avatar shows as before.
Credit (for release notes)
My WordPress.org username: faisal03
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog entry is committed in
.github/changelog/2575-rsvp-avatar-visibility.