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
Ability to reset some notification settings to all users without resetting "Like" notifications by email #6950
Comments
To sum up: The current situation is that the Notification Settings are considered as a whole set. As soon as a user has changed at least one notification setting, these are used, regardless of whether the default settings are still used for some types. We currently use the "Like" notification as an indicator, but we could use also other standard notifications here as well. If I understand you correctly, you would prefer it to be similar to the permission system, where there is always a default value and then overwritten values for each notification type. |
@luke- yes, exactly. What do you suggest for a start? Maybe we could first implement the alternative I suggested above, with a migration such as: foreach (User::find()->each() as $user) {
$isUntouchedSettings = Yii::$app->getModule('notification')->settings->user($user)->get('notification.like_email') === null;
Yii::$app->getModule('notification')->settings->user($user)->set(self::IS_UNTOUCHED_SETTINGS, $isUntouchedSettings);
} And later refactor the hole notification settings to have the "Default value"? An idea to avoid changing the UI: when the user selects the same value as the default one, instead of saving |
@marc-farre I'm a little unsure whether I like it that much without redesigning the UI. If I understand your suggestion correctly, we only save the user's value that differs from the default. However, this also means that theoretically, users who have already decided against a notification (which was the default before) would still receive it if the admin adjusts the default. It's not a big deal, but we should be aware of it. For me, the current implementation is somehow clearer here. |
@luke- OK. Could we use
|
@marc-farre Yes, the current implementation with |
…ithout resetting "Like" notifications by email
I've created This PR also fixes a bug when the like module is disabled (via config/common.php file or the Reaction module), because when disabled, there are no "Like" notification settings, so the is |
#6964) * Enh #6950: Ability to reset some notification settings to all users without resetting "Like" notifications by email * #6964 (comment) --------- Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
Is your feature request related to a problem? Please describe.
I want to reset Space notifications only.
In a custom module, I do the following:
Problem: for each user, to know if the notification settings have been reset (to use the default settings), we use
NotificationManager::isUntouchedSettings($user)
: https://github.com/humhub/humhub/blob/master/protected/humhub/modules/notification/components/NotificationManager.php#L291C5-L294C6This method looks if
notification.like_email
is null for the user or not.So we also need to reset "Like" notifications by email.
Describe the solution you'd like
I think that for each notification type we should distinguish the
null
from other values (0
,false
or empty string or array).When a notification if null, then we use the default settings.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: