diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 31 |
1 files changed, 3 insertions, 28 deletions
| @@ -1275,35 +1275,10 @@ xs_html *html_entry(snac *user, xs_dict *msg, int local, | |||
| 1275 | if (strcmp(type, "Note") == 0 && !xs_is_null(xs_dict_get(msg, "name"))) | 1275 | if (strcmp(type, "Note") == 0 && !xs_is_null(xs_dict_get(msg, "name"))) |
| 1276 | return NULL; | 1276 | return NULL; |
| 1277 | 1277 | ||
| 1278 | /* bring the main actor */ | 1278 | /* get the attributedTo */ |
| 1279 | if ((actor = xs_dict_get(msg, "attributedTo")) == NULL) | 1279 | if ((actor = get_atto(msg)) == NULL) |
| 1280 | return NULL; | 1280 | return NULL; |
| 1281 | 1281 | ||
| 1282 | /* if the actor is a list (like on Peertube videos), pick the Person */ | ||
| 1283 | if (xs_type(actor) == XSTYPE_LIST) { | ||
| 1284 | char *e_actor = NULL; | ||
| 1285 | xs_list *p = actor; | ||
| 1286 | |||
| 1287 | while (xs_list_iter(&p, &v)) { | ||
| 1288 | if (xs_type(v) == XSTYPE_DICT) { | ||
| 1289 | char *type = xs_dict_get(v, "type"); | ||
| 1290 | if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Person") == 0) { | ||
| 1291 | e_actor = xs_dict_get(v, "id"); | ||
| 1292 | |||
| 1293 | if (xs_type(e_actor) == XSTYPE_STRING) | ||
| 1294 | break; | ||
| 1295 | else | ||
| 1296 | e_actor = NULL; | ||
| 1297 | } | ||
| 1298 | } | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | if (e_actor != NULL) | ||
| 1302 | actor = e_actor; | ||
| 1303 | else | ||
| 1304 | return NULL; | ||
| 1305 | } | ||
| 1306 | |||
| 1307 | /* ignore muted morons immediately */ | 1282 | /* ignore muted morons immediately */ |
| 1308 | if (user && is_muted(user, actor)) | 1283 | if (user && is_muted(user, actor)) |
| 1309 | return NULL; | 1284 | return NULL; |
| @@ -1979,7 +1954,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, | |||
| 1979 | 1954 | ||
| 1980 | /* if it's an instance page, discard private users */ | 1955 | /* if it's an instance page, discard private users */ |
| 1981 | if (user == NULL && xs_startswith(xs_dict_get(msg, "id"), srv_baseurl)) { | 1956 | if (user == NULL && xs_startswith(xs_dict_get(msg, "id"), srv_baseurl)) { |
| 1982 | const char *atto = xs_dict_get(msg, "attributedTo"); | 1957 | const char *atto = get_atto(msg); |
| 1983 | xs *l = xs_split(atto, "/"); | 1958 | xs *l = xs_split(atto, "/"); |
| 1984 | const char *uid = xs_list_get(l, -1); | 1959 | const char *uid = xs_list_get(l, -1); |
| 1985 | snac user; | 1960 | snac user; |