Problem/Motivation

GroupHeroBlock doesn't have cache context by the user group permissons, and when the group admin adds any member to the group with "Group members only (secret)" visibility this block doesn't appear for this member.

Steps to reproduce

  1. Create a group with "Group members only (secret)" visibility
  2. Create a user "Verified" with verified role
  3. Go to the "About" page of the created group as a "Verified" user, and you should see "Access denied"
  4. As a Site manager or Group Admin add a member - "Verified" user
  5. Go to the "About" page of the created group as a "Verified" user, you will see group page but without GroupHeroBlock block
  6. Flash cache - the GroupHeroBlock block will appear

Proposed resolution

Add cache context by user for GroupHeroBlock block:

/**
   * {@inheritDoc}
   */
  public function getCacheContexts(): array {
    return Cache::mergeContexts(parent::getCacheContexts(), [
      'user.group_permissions'
    ]);
  }

Comments

r_cheh created an issue. See original summary.

r_cheh’s picture

Issue summary: View changes
socialnicheguru’s picture

StatusFileSize
new1.36 KB
socialnicheguru’s picture

Status: Active » Needs review
r_cheh’s picture

ribel’s picture

Version: 13.0.0-alpha10 » 13.0.0-alpha11
Status: Needs review » Reviewed & tested by the community

Changes were tested and worked as expected.
PR was merged and will be in the next release.

r_cheh’s picture

Issue summary: View changes

  • 9c1619ae committed on main
    Issue #3472091: Change cache context of "GroupHeroBlock" block from user...

  • 7a2a1437 committed on main
    Issue #3472091: Add cache context by user for "GroupHeroBlock" block.
    
robertragas’s picture

Status: Reviewed & tested by the community » Fixed

Landing in 13.0.0-alpha12

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.