Fix #3806: Using Receive notifications for new content will not include the space to the notification setting view until settings are saved

This commit is contained in:
buddh4 2020-01-24 17:24:03 +01:00
parent 645ee4d894
commit e104334c29
2 changed files with 14 additions and 8 deletions

View File

@ -38,7 +38,7 @@ HumHub Change Log (DEVELOP)
- Enh: Update Yii version to 2.0.32
- Enh #3822 Added content id to notification urls as fallback in case notification was deleted
- Fix: Settings cli rewrite dynamic config when required
- Fix #3806: Using `Receive notifications for new content` will not include the space to the notification setting view until settings are saved
1.4.0-beta.2
------------

View File

@ -260,15 +260,21 @@ class NotificationManager
*/
public function getSpaces(User $user)
{
$isLoaded = (Yii::$app->getModule('notification')->settings->user($user)->get('notification.like_email') !== null);
if ($isLoaded) {
$memberSpaces = Membership::getUserSpaceQuery($user, true, true)->all();
$followSpaces = Follow::getFollowedSpacesQuery($user, true)->all();
$memberSpaces = Membership::getUserSpaceQuery($user, true, true)->all();
$followSpaces = Follow::getFollowedSpacesQuery($user, true)->all();
return array_merge($memberSpaces, $followSpaces);
} else {
return Space::findAll(['guid' => Yii::$app->getModule('notification')->settings->getSerialized('sendNotificationSpaces')]);
$result = array_merge($memberSpaces, $followSpaces);
if($this->isUntouchedSettings($user)) {
$result = array_merge($result, Space::findAll(['guid' => Yii::$app->getModule('notification')->settings->getSerialized('sendNotificationSpaces')]));
}
return $result;
}
private function isUntouchedSettings(User $user)
{
return Yii::$app->getModule('notification')->settings->user($user)->get('notification.like_email') === null;
}
/**