mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix duplicated following spaces in the chooser widget (#7156)
* Fix duplicated following spaces in the chooser widget * Integrity check to delete space following if user is a member
This commit is contained in:
parent
f497f14825
commit
de2027b913
@ -14,6 +14,7 @@ HumHub Changelog
|
||||
- Fix #7146: Fix search request by container guid
|
||||
- Fix #7141: Fix meta searching twice for the same keyword
|
||||
- Fix #7150: Remove js statement `with` to avoid error on build assets by grunt uglify
|
||||
- Fix #7156: Fix duplicated following spaces in the chooser widget
|
||||
|
||||
1.16.1 (July 1, 2024)
|
||||
---------------------
|
||||
|
@ -14,6 +14,7 @@ use humhub\modules\user\events\UserEvent;
|
||||
use humhub\modules\space\models\Space;
|
||||
use humhub\modules\space\models\Membership;
|
||||
use humhub\modules\space\helpers\MembershipHelper;
|
||||
use humhub\modules\user\models\Follow;
|
||||
use Yii;
|
||||
use yii\base\BaseObject;
|
||||
use humhub\components\Event;
|
||||
@ -85,6 +86,18 @@ class Events extends BaseObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$integrityController->showTestHeadline('Space Module - Follow (' . Follow::find()->where(['object_model' => Space::class])->count() . ' entries)');
|
||||
$follows = Follow::find()
|
||||
->innerJoin('space_membership', 'space_membership.user_id = user_follow.user_id AND space_membership.space_id = user_follow.object_id')
|
||||
->where(['user_follow.object_model' => Space::class])
|
||||
->andWhere(['space_membership.status' => Membership::STATUS_MEMBER]);
|
||||
foreach ($follows->each() as $follow) {
|
||||
/* @var Follow $follow */
|
||||
if ($integrityController->showFix('Deleting a following of user #' . $follow->user_id . ' to space #' . $follow->object_id . ' because of membership!')) {
|
||||
$follow->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user