commit 22cc5f4

default  ·  2023-10-16 17:14:44 +0000 UTC
parent b95d4d7
Drop replies to hidden posts.
1 files changed,  +14, -9
+14, -9
 1@@ -1577,18 +1577,23 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
 2             char *in_reply_to = xs_dict_get(object, "inReplyTo");
 3             xs *wrk           = NULL;
 4 
 5-            timeline_request(snac, &in_reply_to, &wrk, 0);
 6-
 7-            if (timeline_add(snac, id, object)) {
 8-                snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
 9-                do_notify = 1;
10+            if (!xs_is_null(in_reply_to) && is_hidden(snac, in_reply_to)) {
11+                snac_debug(snac, 0, xs_fmt("dropped reply %s to hidden post %s", id, in_reply_to));
12             }
13+            else {
14+                timeline_request(snac, &in_reply_to, &wrk, 0);
15 
16-            /* if it has a "name" field, it may be a vote for a question */
17-            const char *name = xs_dict_get(object, "name");
18+                if (timeline_add(snac, id, object)) {
19+                    snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
20+                    do_notify = 1;
21+                }
22+
23+                /* if it has a "name" field, it may be a vote for a question */
24+                const char *name = xs_dict_get(object, "name");
25 
26-            if (!xs_is_null(name) && *name && !xs_is_null(in_reply_to) && *in_reply_to)
27-                update_question(snac, in_reply_to);
28+                if (!xs_is_null(name) && *name && !xs_is_null(in_reply_to) && *in_reply_to)
29+                    update_question(snac, in_reply_to);
30+            }
31         }
32         else
33         if (strcmp(utype, "Question") == 0) { /**  **/