mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix: User soft deletion membership cache overwrite
This commit is contained in:
parent
38c3ae0903
commit
e7d265433c
@ -11,6 +11,7 @@ HumHub Change Log
|
||||
- Fix: Include user profile posts option in dashboard stream broken
|
||||
- Fix: Check SoftDeleted user state in ControllerAccess
|
||||
- Fix: Removed database charset configuration in dynamic config
|
||||
- Fix: User soft deletion membership cache overwrite
|
||||
|
||||
|
||||
1.3.8 (December 10, 2018)
|
||||
|
@ -102,7 +102,7 @@ class UserDeleteForm extends Model
|
||||
}
|
||||
|
||||
// Handle owned spaces by the deleted user
|
||||
$ownedSpaces = MembershipHelper::getOwnSpaces($this->user);
|
||||
$ownedSpaces = MembershipHelper::getOwnSpaces($this->user, false);
|
||||
if (count($ownedSpaces) !== 0 && empty($this->deleteSpaces)) {
|
||||
foreach ($ownedSpaces as $space) {
|
||||
$space->addMember(Yii::$app->user->id);
|
||||
|
@ -26,16 +26,17 @@ class MembershipHelper
|
||||
* Returns an array of spaces where the given user is owner.
|
||||
*
|
||||
* @param User|null $user the user or null for current user
|
||||
* @param boolean $useCache use cached result if available
|
||||
* @return Space[] the list of spaces
|
||||
*/
|
||||
public static function getOwnSpaces(User $user = null)
|
||||
public static function getOwnSpaces(User $user = null, $useCache = true)
|
||||
{
|
||||
if ($user === null) {
|
||||
$user = Yii::$app->user->getIdentity();
|
||||
}
|
||||
|
||||
$spaces = [];
|
||||
foreach (Membership::GetUserSpaces($user->id) as $space) {
|
||||
foreach (Membership::GetUserSpaces($user->id, $useCache) as $space) {
|
||||
if ($space->isSpaceOwner($user->id)) {
|
||||
$spaces[] = $space;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ class User extends ContentContainerActiveRecord implements IdentityInterface, Se
|
||||
public function softDelete()
|
||||
{
|
||||
// Delete spaces which are owned by this user.
|
||||
foreach (MembershipHelper::getOwnSpaces($this) as $space) {
|
||||
foreach (MembershipHelper::getOwnSpaces($this, false) as $space) {
|
||||
$space->delete();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user