From de8bacd3c21546929e37f0e752b7947352dd8a2e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 22 Jan 2018 10:41:30 +0000 Subject: [PATCH] Remove notifications for blocked users --- src/freedombone-app-pleroma | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/freedombone-app-pleroma b/src/freedombone-app-pleroma index 18a28d03..61a6962c 100755 --- a/src/freedombone-app-pleroma +++ b/src/freedombone-app-pleroma @@ -82,6 +82,7 @@ function create_pleroma_blocklist { echo ' if [[ "$blocked" == *"."* || "$blocked" == *"@"* ]]; then' >> $blocking_script_file echo ' if [ ${#blocked} -gt 4 ]; then' >> $blocking_script_file echo " sudo -u postgres psql -d pleroma -c \"DELETE FROM objects WHERE data->>'content' ilike '%\${blocked}%' or data->>'actor' ilike '%\${blocked}%' or data->>'to' ilike '%\${blocked}%' or data->>'id' ilike '%\${blocked}%' or data->>'external_url' ilike '%\${blocked}%'\"" >> $blocking_script_file + echo " sudo -u postgres psql -d pleroma -c \"DELETE FROM notifications INNER JOIN users ON users.id = notifications.user_id WHERE users.nickname ilike '%${blocked}%';\"" >> $blocking_script_file echo " sudo -u postgres psql -d pleroma -c \"DELETE FROM users WHERE nickname ilike '%\${blocked}%'\"" >> $blocking_script_file echo ' fi' >> $blocking_script_file echo ' fi' >> $blocking_script_file @@ -89,7 +90,7 @@ function create_pleroma_blocklist { chmod +x $blocking_script_file if ! grep -q "$blocking_script_file" /etc/crontab; then - echo "*/1 * * * * root $blocking_script_file > /dev/null" >> /etc/crontab + echo "*/2 * * * * root $blocking_script_file > /dev/null" >> /etc/crontab fi }