summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Oliva2026-01-01 16:25:00 +0100
committerGravatar grunfink2026-01-01 16:25:00 +0100
commit20eba6f5192176ad0fc3c468cd4bd8dda62f15e6 (patch)
tree05f33a8b180ff042934058e5f36123a76e2a59a1
parentUpdated RELEASE_NOTES. (diff)
downloadsnac2-20eba6f5192176ad0fc3c468cd4bd8dda62f15e6.tar.gz
snac2-20eba6f5192176ad0fc3c468cd4bd8dda62f15e6.tar.xz
snac2-20eba6f5192176ad0fc3c468cd4bd8dda62f15e6.zip
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.
-rw-r--r--html.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/html.c b/html.c
index 223cf4c..3e1d7ba 100644
--- a/html.c
+++ b/html.c
@@ -3889,8 +3889,22 @@ xs_str *html_people_one(snac *user, const char *actor, const xs_list *list,
3889 if (!valid_status(status)) 3889 if (!valid_status(status))
3890 continue; 3890 continue;
3891 3891
3892 const char *by = xs_dict_get(msg, "attributedTo"); 3892 const char *id = xs_dict_get(msg, "id");
3893 if (!by || strcmp(actor, by) != 0) 3893 const char *by = get_atto(msg);
3894 xs *actor_md5 = NULL;
3895 xs_list *boosts = NULL;
3896 xs_list *likes = NULL;
3897 xs_list *reacts = NULL;
3898 /* Besides actor's posts, also show actor's boosts, and also
3899 posts by user with likes or reacts by actor. I.e., any
3900 actor's actions that user could have seen in the timeline
3901 or in notifications. */
3902 if (!(by && strcmp(actor, by) == 0) &&
3903 xs_list_in((boosts = object_announces(id)),
3904 (actor_md5 = xs_md5_hex(actor, strlen(actor)))) == -1 &&
3905 (!(by && strcmp(user->actor, by) == 0) ||
3906 (xs_list_in((likes = object_likes(id)), actor_md5) == -1 &&
3907 xs_list_in((reacts = object_get_emoji_reacts(id)), actor_md5) == -1)))
3894 continue; 3908 continue;
3895 3909
3896 xs_html *entry = html_entry(user, msg, 0, 0, v, 1); 3910 xs_html *entry = html_entry(user, msg, 0, 0, v, 1);
@@ -4359,8 +4373,12 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4359 cache = 0; 4373 cache = 0;
4360 4374
4361 int skip = 0; 4375 int skip = 0;
4376 const char *max_show_default = "50";
4377 int max_show = xs_number_get(xs_dict_get_def(srv_config, "max_timeline_entries",
4378 max_show_default));
4362 int def_show = xs_number_get(xs_dict_get_def(srv_config, "def_timeline_entries", 4379 int def_show = xs_number_get(xs_dict_get_def(srv_config, "def_timeline_entries",
4363 xs_dict_get_def(srv_config, "max_timeline_entries", "50"))); 4380 xs_dict_get_def(srv_config, "max_timeline_entries",
4381 max_show_default)));
4364 int show = def_show; 4382 int show = def_show;
4365 4383
4366 if ((v = xs_dict_get(q_vars, "skip")) != NULL) 4384 if ((v = xs_dict_get(q_vars, "skip")) != NULL)
@@ -4386,6 +4404,8 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4386 /* a show of 0 has no sense */ 4404 /* a show of 0 has no sense */
4387 if (show == 0) 4405 if (show == 0)
4388 show = def_show; 4406 show = def_show;
4407 if (show > max_show)
4408 show = max_show;
4389 4409
4390 if (p_path == NULL) { /** public timeline **/ 4410 if (p_path == NULL) { /** public timeline **/
4391 xs *h = xs_str_localtime(0, "%Y-%m.html"); 4411 xs *h = xs_str_localtime(0, "%Y-%m.html");
@@ -4661,7 +4681,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4661 (actor_id = xs_dict_get(actor_dict, "id")) != NULL && 4681 (actor_id = xs_dict_get(actor_dict, "id")) != NULL &&
4662 valid_status(actor_get(actor_id, &actor))) { 4682 valid_status(actor_get(actor_id, &actor))) {
4663 int more = 0; 4683 int more = 0;
4664 xs *list = timeline_list(&snac, "private", skip, show, &more); 4684 xs *list = timeline_simple_list(&snac, "private", skip, show, &more);
4665 4685
4666 *body = html_people_one(&snac, actor_id, list, skip, show, more, page); 4686 *body = html_people_one(&snac, actor_id, list, skip, show, more, page);
4667 *b_size = strlen(*body); 4687 *b_size = strlen(*body);