Răsfoiți Sursa

Added a new server knob disable_notify_webhook.

grunfink 1 an în urmă
părinte
comite
f055c8b694
2 a modificat fișierele cu 4 adăugiri și 3 ștergeri
  1. 1 1
      activitypub.c
  2. 3 2
      data.c

+ 1 - 1
activitypub.c

@@ -2769,7 +2769,7 @@ void process_user_queue_item(snac *user, xs_dict *q_item)
     if (strcmp(type, "notify_webhook") == 0) {
         const char *webhook = xs_dict_get(user->config, "notify_webhook");
 
-        if (xs_is_string(webhook)) {
+        if (xs_is_string(webhook) && *webhook) {
             const xs_dict *msg = xs_dict_get(q_item, "message");
             int retries = xs_number_get(xs_dict_get(q_item, "retries"));
 

+ 3 - 2
data.c

@@ -3167,7 +3167,8 @@ void notify_add(snac *snac, const char *type, const char *utype,
         pthread_mutex_unlock(&data_mutex);
     }
 
-    enqueue_notify_webhook(snac, noti, 0);
+    if (!xs_is_true(xs_dict_get(srv_config, "disable_notify_webhook")))
+        enqueue_notify_webhook(snac, noti, 0);
 }
 
 
@@ -3528,7 +3529,7 @@ void enqueue_notify_webhook(snac *user, const xs_dict *noti, int retries)
 {
     const char *webhook = xs_dict_get(user->config, "notify_webhook");
 
-    if (xs_is_string(webhook)) {
+    if (xs_is_string(webhook) && *webhook) {
         xs *msg = xs_dup(noti);
 
         /* add more data */