Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh #221: By default, enabled Mobile notification types for those ena… #7213

Merged
merged 3 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ HumHub Changelog
- Enh #7167: Disable DEBUG mode automatically after successful humhub installation. Add `.env` support
- Enh #7202: Increased minimum PHP version to 8.1
- Enh #7211: Remove obsolete property `AbstractRichText::$record`
- Enh #7213: By default, enabled "Mobile" notification types for those enabled for "Web"

1.16.2 (September 5, 2024)
--------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@

namespace humhub\modules\friendship\notifications;

use humhub\modules\notification\components\NotificationCategory;
use humhub\modules\user\models\User;
use Yii;
use humhub\modules\notification\components\NotificationCategory;
use humhub\modules\notification\targets\BaseTarget;
use humhub\modules\notification\targets\MailTarget;
use humhub\modules\notification\targets\WebTarget;
use humhub\modules\notification\targets\MobileTarget;

/**
* Description of SpaceJoinNotificationCategory
Expand Down Expand Up @@ -45,22 +41,6 @@ public function getDescription()
return Yii::t('FriendshipModule.notification', 'Receive Notifications for Friendship Request and Approval events.');
}

/**
* @inheritdoc
*/
public function getDefaultSetting(BaseTarget $target)
{
if ($target->id === MailTarget::getId()) {
return true;
} elseif ($target->id === WebTarget::getId()) {
return true;
} elseif ($target->id === MobileTarget::getId()) {
return true;
}

return $target->defaultSetting;
}

/**
* @inheritdoc
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

namespace humhub\modules\notification\components;

use humhub\modules\user\models\User;
use humhub\modules\notification\targets\BaseTarget;
use humhub\modules\notification\targets\MailTarget;
use humhub\modules\notification\targets\WebTarget;
use humhub\modules\notification\targets\MobileTarget;
use humhub\modules\notification\targets\WebTarget;
use humhub\modules\user\models\User;
use yii\base\BaseObject;
use yii\base\InvalidConfigException;

Expand Down Expand Up @@ -65,15 +65,10 @@ abstract public function getDescription();
*/
public function getDefaultSetting(BaseTarget $target)
{
if ($target->id === MailTarget::getId()) {
return true;
} elseif ($target->id === WebTarget::getId()) {
return true;
} elseif ($target->id === MobileTarget::getId()) {
return false;
}

return $target->defaultSetting;
return match ($target->id) {
MailTarget::getId(), WebTarget::getId(), MobileTarget::getId() => true,
default => $target->defaultSetting,
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
namespace humhub\modules\space\notifications;

use humhub\modules\notification\components\NotificationCategory;
use humhub\modules\notification\targets\BaseTarget;
use humhub\modules\notification\targets\MailTarget;
use humhub\modules\notification\targets\MobileTarget;
use humhub\modules\notification\targets\WebTarget;
use Yii;

Expand Down Expand Up @@ -49,21 +46,6 @@ public function getDescription()
);
}

/**
* @inheritdoc
*/
public function getDefaultSetting(BaseTarget $target)
{
switch ($target->id) {
case MailTarget::getId():
case WebTarget::getId():
case MobileTarget::getId():
return true;
default:
return $target->defaultSetting;
}
}

/**
* @inheritdoc
*/
Expand Down
Loading