Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Do not attempt to invalidate group content list cache tags if the gro…
Browse files Browse the repository at this point in the history
…up itself changes.

If the group content list includes any data from the group itself then the
list will be tagged with the group cache tags and will be invalidated
automatically if the group is saved.
  • Loading branch information
pfrenssen committed May 14, 2019
1 parent e5eff34 commit 5272058
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions og.module
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,10 @@ function og_theme($existing, $type, $theme, $path) {
function og_invalidate_group_content_cache_tags(EntityInterface $entity) {
// If group content is created or updated, invalidate the group content cache
// tags for each of the groups this group content belongs to. This allows
// group listings to be cached effectively. Also invalidate the tags if the
// group itself changes. The cache tag format is
// group listings to be cached effectively. The cache tag format is
// 'og-group-content:{group entity type}:{group entity id}'.
$is_group_content = Og::isGroupContent($entity->getEntityTypeId(), $entity->bundle());
$group_is_updated = Og::isGroup($entity->getEntityTypeId(), $entity->bundle()) && !empty($entity->original);
if ($group_is_updated || $is_group_content) {
if ($is_group_content) {
/** @var \Drupal\og\MembershipManagerInterface $membership_manager */
$membership_manager = \Drupal::service('og.membership_manager');
$tags = [];
Expand All @@ -345,7 +343,7 @@ function og_invalidate_group_content_cache_tags(EntityInterface $entity) {
// the tags of the old group(s).
/** @var \Drupal\Core\Entity\FieldableEntityInterface $entity */
$original = !empty($entity->original) ? $entity->original : NULL;
if ($is_group_content && $original) {
if ($original) {
/** @var \Drupal\og\OgGroupAudienceHelperInterface $group_audience_helper */
$group_audience_helper = \Drupal::service('og.group_audience_helper');
/** @var \Drupal\Core\Entity\FieldableEntityInterface $original */
Expand Down

0 comments on commit 5272058

Please sign in to comment.