improve the notification function (#1034)

This commit is contained in:
szaimen 2020-01-16 00:24:42 +01:00 коммит произвёл Daniel Hansson
Родитель 4a1f87e921
Коммит faabf4a95b
1 изменённых файлов: 6 добавлений и 13 удалений

19
lib.sh
Просмотреть файл

@ -1087,23 +1087,16 @@ esac
#
# occ_command notification:generate -l "$2" "$admin" "$1"
notify_user_gui() {
USER=$(occ_command user:list | awk '{print $2}' | cut -d ":" -f1;)
print_text_in_color "$ICyan" "Looping through users, this might take a while..."
for user in $USER
CHECK_USERS=$(occ_command user:list | awk '{print $2}' | cut -d ":" -f1;)
print_text_in_color "$ICyan" "Posting notification to users that are admins, this might take a while..."
for admin in $CHECK_USERS
do
if occ_command user:info "$user" | grep -q "\- admin";
if occ_command user:info "$admin" | grep -q "\- admin";
then
print_text_in_color "$ICyan" "Found: $user"
local admin_users+="$user "
print_text_in_color "$IGreen" "Posting '$1' to: $admin"
occ_command notification:generate -l "$2" "$admin" "$1"
fi
done
print_text_in_color "$ICyan" "Posting notification to users that are admins:"
for admin in ${admin_users[*]}
do
occ_command notification:generate -l "$2" "$admin" "$1"
print_text_in_color "$IGreen" "$admin"
done
}
## bash colors