aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-07 13:24:26 +0000
committerMario <mario@mariovavti.com>2024-07-07 13:24:26 +0000
commit2ddc0875128e17a9e36393974d721f19ccbe64e3 (patch)
treefa799b1fdf8bdd4083dd190516a56d7151efba19
parentb0fe94b4b33126d0bfb1c10869262d47e31a337d (diff)
downloadvolse-hubzilla-2ddc0875128e17a9e36393974d721f19ccbe64e3.tar.gz
volse-hubzilla-2ddc0875128e17a9e36393974d721f19ccbe64e3.tar.bz2
volse-hubzilla-2ddc0875128e17a9e36393974d721f19ccbe64e3.zip
notifications: provide possibility to only display system notofications
-rw-r--r--Zotlabs/Widget/Notifications.php2
-rw-r--r--view/pdl/mod_admin.pdl1
-rw-r--r--view/tpl/notifications_widget.tpl45
3 files changed, 28 insertions, 20 deletions
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index b16303be6..eeef1d7d4 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -173,6 +173,8 @@ class Notifications {
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
'$loading' => t('Loading'),
+ '$sys_only' => empty($arr['sys_only']) ? 0 : 1
+
]);
return $o;
diff --git a/view/pdl/mod_admin.pdl b/view/pdl/mod_admin.pdl
index f5e46baed..39bccd466 100644
--- a/view/pdl/mod_admin.pdl
+++ b/view/pdl/mod_admin.pdl
@@ -1,5 +1,6 @@
[template]doubleleft[/template]
[region=aside]
+[widget=notifications][var=sys_only]1[/var][/widget]
[widget=admin][/widget]
[/region]
[region=content]
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index a9d98dae9..30547da97 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -5,6 +5,7 @@
var sse_partial_result = false;
var sse_rmids = [];
var sse_fallback_interval;
+ var sse_sys_only = {{$sys_only}};
$(document).ready(function() {
let notifications_parent;
@@ -219,8 +220,9 @@
}
function sse_bs_counts() {
- if(sse_bs_active)
+ if(sse_bs_active || sse_sys_only) {
return;
+ }
sse_bs_active = true;
@@ -238,10 +240,11 @@
function sse_bs_notifications(e, replace, followup) {
- if(sse_bs_active)
+ if(sse_bs_active || sse_sys_only) {
return;
+ }
- var manual = false;
+ let manual = false;
if(typeof replace === 'undefined')
replace = e.data.replace;
@@ -302,9 +305,23 @@
function sse_handleNotifications(obj, replace, followup) {
- var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
- var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
- var all_notifications = primary_notifications.concat(secondary_notifications);
+ // notice and info
+
+ if(obj.notice) {
+ $(obj.notice.notifications).each(function() {
+ toast(this, 'danger');
+ });
+ }
+
+ if(obj.info) {
+ $(obj.info.notifications).each(function(){
+ toast(this, 'info');
+ });
+ }
+
+ let primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
+ let secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
+ let all_notifications = primary_notifications.concat(secondary_notifications);
all_notifications.forEach(function(type, index) {
if(typeof obj[type] === typeof undefined)
@@ -336,20 +353,6 @@
sse_setNotificationsStatus();
- // notice and info
-
- if(obj.notice) {
- $(obj.notice.notifications).each(function() {
- toast(this, 'danger');
- });
- }
-
- if(obj.info) {
- $(obj.info.notifications).each(function(){
- toast(this, 'info');
- });
- }
-
// load more notifications if visible notifications count becomes low
if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children(':not(.tt-filter-active)').length < 15) {
sse_bs_notifications(sse_type, false, true);
@@ -533,6 +536,7 @@
}
</script>
+{{if !$sys_only}}
<div id="notifications_wrapper" class="mb-4">
<div id="no_notifications" class="d-xl-none">
{{$no_notifications}}<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span>
@@ -604,3 +608,4 @@
{{/foreach}}
</div>
</div>
+{{/if}}