commit 3fb91ea

default  ·  2023-04-24 15:49:08 +0000 UTC
parent b6da5b7
Skip muted morons from timelines and statuses.
1 files changed,  +9, -3
+9, -3
 1@@ -994,6 +994,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2                 if (strcmp(xs_dict_get(msg, "type"), "Note") != 0)
 3                     continue;
 4 
 5+                /* drop notes from muted morons */
 6+                if (is_muted(&snac1, xs_dict_get(msg, "attributedTo")))
 7+                    continue;
 8+
 9                 /* convert the Note into a Mastodon status */
10                 xs *st = mastoapi_status(&snac1, msg);
11 
12@@ -1293,7 +1297,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
13     }
14     else
15     if (xs_startswith(cmd, "/v1/statuses/")) {
16-        /* operations on a status */
17+        /* information about a status */
18         xs *l = xs_split(cmd, "/");
19         const char *id = xs_list_get(l, 3);
20         const char *op = xs_list_get(l, 4);
21@@ -1307,8 +1311,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
22 
23             if (valid_status(timeline_get_by_md5(&snac1, id, &msg))) {
24                 if (op == NULL) {
25-                    /* return the status itself */
26-                    out = mastoapi_status(&snac1, msg);
27+                    if (!is_muted(&snac1, xs_dict_get(msg, "attributedTo"))) {
28+                        /* return the status itself */
29+                        out = mastoapi_status(&snac1, msg);
30+                    }
31                 }
32                 else
33                 if (strcmp(op, "context") == 0) {