commit 5cb4d24

default  ·  2024-03-01 14:34:50 +0000 UTC
parent 6972422
mastoapi: Correctly show 'Video' objects in /timelines/home.
1 files changed,  +4, -3
+4, -3
 1@@ -1462,7 +1462,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2                 /* discard non-Notes */
 3                 const char *id   = xs_dict_get(msg, "id");
 4                 const char *type = xs_dict_get(msg, "type");
 5-                if (!xs_match(type, "Note|Question|Page|Article"))
 6+                if (!xs_match(type, "Note|Question|Page|Article|Video"))
 7                     continue;
 8 
 9                 const char *from = NULL;
10@@ -1492,8 +1492,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
11                 if (is_hidden(&snac1, id))
12                     continue;
13 
14-                /* discard poll votes (they have a name) */
15-                if (strcmp(type, "Page") != 0 && !xs_is_null(xs_dict_get(msg, "name")))
16+                /* if it has a name and it's not a Page or a Video,
17+                   it's a poll vote, so discard it */
18+                if (!xs_is_null(xs_dict_get(msg, "name")) && !xs_match(type, "Page|Video"))
19                     continue;
20 
21                 /* convert the Note into a Mastodon status */