diff --git a/protected/humhub/docs/CHANGELOG_DEV.md b/protected/humhub/docs/CHANGELOG_DEV.md index f69fa8400f..92c521ad69 100644 --- a/protected/humhub/docs/CHANGELOG_DEV.md +++ b/protected/humhub/docs/CHANGELOG_DEV.md @@ -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 ------------ diff --git a/protected/humhub/modules/notification/components/NotificationManager.php b/protected/humhub/modules/notification/components/NotificationManager.php index 632caf1da1..70f2c6b4d1 100644 --- a/protected/humhub/modules/notification/components/NotificationManager.php +++ b/protected/humhub/modules/notification/components/NotificationManager.php @@ -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; } /**