Skip to content

Commit 460da2c

Browse files
jaapmarcusAlecRust
andauthored
Delete all notifications active notifications (hestiacp#3095)
* Add "mark all notifications" front end - Fix remaining JS errors on "list server" and "web log" pages - Bump postcss-cli version * Add "mark all notifications" front end - Fix remaining JS errors on "list server" and "web log" pages - Bump postcss-cli version * Update v-delete-user-notifications * Update bin/v-delete-user-notification Co-authored-by: Alec Rust <me@alecrust.com> * Add support for acknowlegde all - Fix issue with deleting not working * Add support for deleting notifications * Remove duplicate code * Remove message instead hidding to bring closer to excepted behaviour after reload Co-authored-by: Alec Rust <me@alecrust.com>
1 parent ec067c3 commit 460da2c

File tree

21 files changed

+396
-298
lines changed

21 files changed

+396
-298
lines changed

bin/v-acknowledge-user-notification

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ source_conf "$HESTIA/conf/hestia.conf"
2727
#----------------------------------------------------------#
2828

2929
check_args '2' "$#" 'USER NOTIFICATION'
30-
is_format_valid 'user' 'id'
30+
if [ "$id" = "all" ]; then
31+
is_format_valid 'user'
32+
else
33+
is_format_valid 'user' 'id'
34+
fi
3135
is_object_valid 'user' 'USER' "$user"
3236

3337
# Perform verification if read-only mode is enabled
@@ -38,18 +42,24 @@ check_hestia_demo_mode
3842
#----------------------------------------------------------#
3943

4044
# Updating notification
41-
update_object_value 'notifications' 'NID' "$id" '$ACK' 'yes' 2> /dev/null
45+
if [ "$id" = 'all' ]; then
46+
for id in $(v-list-user-notifications admin plain | cut -f1); do
47+
update_object_value 'notifications' 'NID' "$id" '$ACK' 'yes' 2> /dev/null
48+
done
49+
else
50+
update_object_value 'notifications' 'NID' "$id" '$ACK' 'yes' 2> /dev/null
4251

43-
# Checking last notification
44-
if [ -e "$USER_DATA/notifications.conf" ]; then
45-
if [ -z "$(grep NID= $USER_DATA/notifications.conf)" ]; then
46-
notice='no'
47-
fi
48-
if [ -z "$(grep "ACK='no'" $USER_DATA/notifications.conf)" ]; then
52+
# Checking last notification
53+
if [ -e "$USER_DATA/notifications.conf" ]; then
54+
if [ -z "$(grep NID= $USER_DATA/notifications.conf)" ]; then
55+
notice='no'
56+
fi
57+
if [ -z "$(grep "ACK='no'" $USER_DATA/notifications.conf)" ]; then
58+
notice='no'
59+
fi
60+
else
4961
notice='no'
5062
fi
51-
else
52-
notice='no'
5363
fi
5464

5565
#----------------------------------------------------------#

bin/v-delete-user-notification

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ source_conf "$HESTIA/conf/hestia.conf"
2727
#----------------------------------------------------------#
2828

2929
check_args '2' "$#" 'USER NOTIFICATION'
30-
is_format_valid 'user' 'id'
30+
if [ "$id" = "all" ]; then
31+
is_format_valid 'user'
32+
else
33+
is_format_valid 'user' 'id'
34+
fi
3135
is_object_valid 'user' 'USER' "$user"
3236

3337
# Perform verification if read-only mode is enabled
@@ -37,21 +41,25 @@ check_hestia_demo_mode
3741
# Action #
3842
#----------------------------------------------------------#
3943

40-
# Deleting notification
41-
sed -i "/NID='$id' /d" $USER_DATA/notifications.conf 2> /dev/null
42-
43-
# Checking last notification
44-
if [ -e "$USER_DATA/notifications.conf" ]; then
45-
if [ -z "$(grep NID= $USER_DATA/notifications.conf)" ]; then
46-
notice='no'
47-
fi
48-
if [ -z "$(grep "ACK='no'" $USER_DATA/notifications.conf)" ]; then
44+
if [ "$id" = "all" ]; then
45+
notice='no'
46+
rm $USER_DATA/notifications.conf
47+
touch $USER_DATA/notifications.conf
48+
else
49+
# Deleting notification
50+
sed -i "/NID='$id' /d" $USER_DATA/notifications.conf 2> /dev/null
51+
# Checking last notification
52+
if [ -e "$USER_DATA/notifications.conf" ]; then
53+
if [ -z "$(grep NID= $USER_DATA/notifications.conf)" ]; then
54+
notice='no'
55+
fi
56+
if [ -z "$(grep "ACK='no'" $USER_DATA/notifications.conf)" ]; then
57+
notice='no'
58+
fi
59+
else
4960
notice='no'
5061
fi
51-
else
52-
notice='no'
5362
fi
54-
5563
#----------------------------------------------------------#
5664
# Hestia #
5765
#----------------------------------------------------------#

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"husky": "^8.0.2",
3232
"lint-staged": "^13.0.4",
3333
"postcss": "^8.4.19",
34-
"postcss-cli": "^10.0.0",
34+
"postcss-cli": "^10.1.0",
3535
"postcss-import": "^15.0.0",
3636
"postcss-preset-env": "^7.8.3",
3737
"postcss-size": "^4.0.1",

web/css/src/themes/dark.css

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,48 @@ strong {
3030
color: #909090;
3131
}
3232

33+
.top-bar-notifications-list {
34+
background-color: rgb(50 50 50 / 99%);
35+
border: 1px solid #404040;
36+
}
37+
38+
.top-bar-notification-item {
39+
text-shadow: 0 1px rgb(0 0 0 / 50%);
40+
color: #dadada;
41+
border-bottom: 1px solid #282828;
42+
43+
&.empty {
44+
& .fas {
45+
color: #dadada;
46+
}
47+
}
48+
49+
&.unseen {
50+
& .top-bar-notification-title,
51+
& .top-bar-notification-title a {
52+
color: #fff;
53+
}
54+
}
55+
56+
& a {
57+
color: #4fabe9;
58+
59+
&:hover {
60+
color: #09f;
61+
}
62+
63+
&:active {
64+
color: #0079cb;
65+
}
66+
}
67+
}
68+
69+
.top-bar-notification-delete {
70+
& .fas {
71+
color: #ff3478;
72+
}
73+
}
74+
3375
.top-bar-nav-list {
3476
background-color: #454545;
3577
}
@@ -76,50 +118,6 @@ strong {
76118
color: #e7e7e7;
77119
}
78120

79-
.notification-container {
80-
background-color: rgb(50 50 50 / 99%);
81-
text-shadow: 0 1px rgb(0 0 0 / 50%);
82-
color: #dadada;
83-
border: 1px solid #404040;
84-
}
85-
86-
.notification-container .empty {
87-
color: #dadada;
88-
}
89-
90-
.notification-container .empty .status-icon {
91-
color: #dadada;
92-
}
93-
94-
.notification-container .unseen {
95-
color: #dadada;
96-
}
97-
98-
.notification-container li {
99-
border-bottom: 1px solid #282828;
100-
}
101-
102-
.notification-container .mark-seen {
103-
background-color: #ff3478;
104-
}
105-
106-
.notification-container .unseen .notification-title,
107-
.notification-container .unseen .notification-title a {
108-
color: #fff !important;
109-
}
110-
111-
.notification-container a {
112-
color: #4fabe9;
113-
}
114-
115-
.notification-container a:hover {
116-
color: #09f;
117-
}
118-
119-
.notification-container a:active {
120-
color: #0079cb;
121-
}
122-
123121
/* Alerts
124122
========================================================================== */
125123

0 commit comments

Comments
 (0)