Fix caching keys on space directory (#6421)

This commit is contained in:
Yuriy Bakhtin 2023-07-10 15:47:45 +04:00 committed by GitHub
parent f29f6a0fc9
commit 245322e5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -73,3 +73,4 @@ HumHub Changelog
- Enh #6386: Fix absolute base URL in console commands
- Fix #79: Fix Headline HelpText Style
- Fix #6418: Fix login from modal window
- Fix #6415: Fix caching keys on space directory

View File

@ -230,7 +230,7 @@ class SpaceModelMembership extends Behavior
}
if (!isset($this->_memberships[$userId])) {
$this->_memberships[$userId] = Yii::$app->runtimeCache->getOrSet(__METHOD__ . $userId, function() use ($userId) {
$this->_memberships[$userId] = Yii::$app->runtimeCache->getOrSet(__METHOD__ . $userId . '-' . $this->owner->id, function() use ($userId) {
return Membership::findOne(['user_id' => $userId, 'space_id' => $this->owner->id]);
});
}

View File

@ -44,7 +44,7 @@ class SpaceDirectoryIcons extends Widget
$membersCountQuery->visible();
}
$count = Yii::$app->runtimeCache->getOrSet(__METHOD__ . Yii::$app->user->id, function() use ($membersCountQuery) {
$count = Yii::$app->runtimeCache->getOrSet(__METHOD__ . Yii::$app->user->id . '-' . $this->space->id, function() use ($membersCountQuery) {
return $membersCountQuery->count();
});