Verified Commit d4fe6da2 authored by godotislate's avatar godotislate
Browse files

task: #3608738 Avoid adding user:0 cache tag in UserRoles cache context

By: catch
By: kristiaanvandeneynde
(cherry picked from commit b3351dd5)
parent aec68060
Loading
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -38,7 +38,11 @@ public function getContext($role = NULL) {
   * {@inheritdoc}
   */
  public function getCacheableMetadata($role = NULL) {
    // The list of roles for the anonymous user can never change.
    if ($this->user->isAuthenticated()) {
      return (new CacheableMetadata())->setCacheTags(['user:' . $this->user->id()]);
    }
    return new CacheableMetadata();
  }

}