]> git.mxchange.org Git - friendica.git/commitdiff
New setting that controls notifications for ignored contacts
authorMichael <heluecht@pirati.ca>
Sun, 24 Jan 2021 11:40:09 +0000 (11:40 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 24 Jan 2021 11:40:09 +0000 (11:40 +0000)
include/enotify.php
mod/settings.php
view/templates/settings/settings.tpl
view/theme/frio/templates/settings/settings.tpl

index 9e59f63259b5ebaaab58e20a56f55247b526556c..270b41e24b324734a66e6151d9d809ef54e9ae65 100644 (file)
@@ -624,6 +624,11 @@ function check_item_notification($itemid, $uid, $notification_type) {
                return false;
        }
 
+       if (DI::pConfig()->get(local_user(), 'system', 'notify_ignored', true) && Contact\User::isIgnored($item['author-id'], $uid)) {
+               Logger::info('Author is ignored, dropping notification', ['cid' => $item['author-id'], 'uid' =>  $uid]);
+               return false;
+       }
+
        // Generate the notification array
        $params = [];
        $params['otype'] = Notify\ObjectType::ITEM;
index 6c41856a4f808f9cc58872c41f2a284352127ef7..c84be2a5ac08f78a5f92a42172c65cf6e34188f9 100644 (file)
@@ -323,6 +323,8 @@ function settings_post(App $a)
        $email_textonly   = (($_POST['email_textonly'] == 1) ? 1 : 0);
        $detailed_notif   = (($_POST['detailed_notif'] == 1) ? 1 : 0);
 
+       $notify_ignored   = (($_POST['notify_ignored'] == 1) ? 1 : 0);
+       
        $notify = 0;
 
        if (!empty($_POST['notify1'])) {
@@ -416,6 +418,7 @@ function settings_post(App $a)
 
        DI::pConfig()->set(local_user(), 'system', 'email_textonly', $email_textonly);
        DI::pConfig()->set(local_user(), 'system', 'detailed_notif', $detailed_notif);
+       DI::pConfig()->set(local_user(), 'system', 'notify_ignored', $notify_ignored);
        DI::pConfig()->set(local_user(), 'system', 'unlisted', $unlisted);
        DI::pConfig()->set(local_user(), 'system', 'accessible-photos', $accessiblephotos);
 
@@ -911,7 +914,11 @@ function settings_content(App $a)
                                                                        DI::pConfig()->get(local_user(), 'system', 'detailed_notif'),
                                                                        DI::l10n()->t('Per default, notifications are condensed to a single notification per item. When enabled every notification is displayed.')],
 
-               '$h_advn' => DI::l10n()->t('Advanced Account/Page Type Settings'),
+               '$notify_ignored' => ['notify_ignored', DI::l10n()->t('Show notifications of ignored contacts') ,
+                                                                       DI::pConfig()->get(local_user(), 'system', 'notify_ignored', true),
+                                                                       DI::l10n()->t("You don't see posts from ignored contacts. But you still see their comments. This setting controls if you want to still receive regular notifications that are caused by ignored contacts or not.")],
+
+                                                                       '$h_advn' => DI::l10n()->t('Advanced Account/Page Type Settings'),
                '$h_descadvn' => DI::l10n()->t('Change the behaviour of this account for special situations'),
                '$pagetype' => $pagetype,
 
index bd0fa5f2023680ddec5a18839932b084d1b4bacf..772acd12ef8012ffeeaabf42cb9814f740a4772d 100644 (file)
                        {{include file="field_checkbox.tpl" field=$email_textonly}}
                        {{include file="field_checkbox.tpl" field=$detailed_notif}}
 
+                       {{include file="field_checkbox.tpl" field=$notify_ignored}}
+
                        {{include file="field_checkbox.tpl" field=$desktop_notifications}}
                        <script>
                                (function () {
index 91c89643e1df39a3b41998d8402668bd2048d4c3..0e5ee7a0805120b81494abf5f54f7b2dd44333c3 100644 (file)
                                                {{include file="field_checkbox.tpl" field=$email_textonly}}
                                                {{include file="field_checkbox.tpl" field=$detailed_notif}}
 
+                                               {{include file="field_checkbox.tpl" field=$notify_ignored}}
+
                                                {{* commented out because it was commented out in the original template
                                                <div class="field">
                                                 <button type="button" onclick="javascript:Notification.requestPermission(function(perm){if(perm === 'granted')alert('{{$desktop_notifications_success_message}}');});">{{$desktop_notifications}}</button>