commit 20eba6f
Alexandre Oliva
·
2026-01-01 15:25:00 +0000 UTC
parent 4b22bb8
Add boosts, likes and reacts to actor's people page Show in an actor's page anything that the user could have seen from actor in timeline or notifications, namely: - posts by actor (use get_atto to identify the actor) - boosts by actor - user's posts with likes or emojireacts by actor That said, in this view, only the latest boost is shown for a post, so it might not seem like the boost is by actor. Likes and emojireacts aren't even shown, so the reason why a post appears might be puzzling. Use timeline_simple_list, since we don't show entire conversations, and we want to identify all posts with actor's interactions. Saturate show at max_timeline_entries, so that we don't silently skip entries.
1 files changed,
+24,
-4
M
html.c
M
html.c
+24,
-4
1@@ -3889,8 +3889,22 @@ xs_str *html_people_one(snac *user, const char *actor, const xs_list *list,
2 if (!valid_status(status))
3 continue;
4
5- const char *by = xs_dict_get(msg, "attributedTo");
6- if (!by || strcmp(actor, by) != 0)
7+ const char *id = xs_dict_get(msg, "id");
8+ const char *by = get_atto(msg);
9+ xs *actor_md5 = NULL;
10+ xs_list *boosts = NULL;
11+ xs_list *likes = NULL;
12+ xs_list *reacts = NULL;
13+ /* Besides actor's posts, also show actor's boosts, and also
14+ posts by user with likes or reacts by actor. I.e., any
15+ actor's actions that user could have seen in the timeline
16+ or in notifications. */
17+ if (!(by && strcmp(actor, by) == 0) &&
18+ xs_list_in((boosts = object_announces(id)),
19+ (actor_md5 = xs_md5_hex(actor, strlen(actor)))) == -1 &&
20+ (!(by && strcmp(user->actor, by) == 0) ||
21+ (xs_list_in((likes = object_likes(id)), actor_md5) == -1 &&
22+ xs_list_in((reacts = object_get_emoji_reacts(id)), actor_md5) == -1)))
23 continue;
24
25 xs_html *entry = html_entry(user, msg, 0, 0, v, 1);
26@@ -4359,8 +4373,12 @@ int html_get_handler(const xs_dict *req, const char *q_path,
27 cache = 0;
28
29 int skip = 0;
30+ const char *max_show_default = "50";
31+ int max_show = xs_number_get(xs_dict_get_def(srv_config, "max_timeline_entries",
32+ max_show_default));
33 int def_show = xs_number_get(xs_dict_get_def(srv_config, "def_timeline_entries",
34- xs_dict_get_def(srv_config, "max_timeline_entries", "50")));
35+ xs_dict_get_def(srv_config, "max_timeline_entries",
36+ max_show_default)));
37 int show = def_show;
38
39 if ((v = xs_dict_get(q_vars, "skip")) != NULL)
40@@ -4386,6 +4404,8 @@ int html_get_handler(const xs_dict *req, const char *q_path,
41 /* a show of 0 has no sense */
42 if (show == 0)
43 show = def_show;
44+ if (show > max_show)
45+ show = max_show;
46
47 if (p_path == NULL) { /** public timeline **/
48 xs *h = xs_str_localtime(0, "%Y-%m.html");
49@@ -4661,7 +4681,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
50 (actor_id = xs_dict_get(actor_dict, "id")) != NULL &&
51 valid_status(actor_get(actor_id, &actor))) {
52 int more = 0;
53- xs *list = timeline_list(&snac, "private", skip, show, &more);
54+ xs *list = timeline_simple_list(&snac, "private", skip, show, &more);
55
56 *body = html_people_one(&snac, actor_id, list, skip, show, more, page);
57 *b_size = strlen(*body);