commit b2f5f95c7b8c8793f82d394009b0908888de5bdc
parent 896a36837c8da070d85abe92d62d12c4009fca1c
Author: default <nobody@localhost>
Date: Sat, 25 Jan 2025 23:06:08 +0100
Fixed repeated entries in the instance public timeline.
Diffstat:
M | data.c | | | 23 | +++++++++++++++++------ |
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/data.c b/data.c
@@ -1399,11 +1399,13 @@ void timeline_update_indexes(snac *snac, const char *id)
if (valid_status(object_get(id, &msg))) {
/* if its ours and is public, also store in public */
if (is_msg_public(msg)) {
- object_user_cache_add(snac, id, "public");
-
- /* also add it to the instance public timeline */
- xs *ipt = xs_fmt("%s/public.idx", srv_basedir);
- index_add(ipt, id);
+ if (object_user_cache_add(snac, id, "public") >= 0) {
+ /* also add it to the instance public timeline */
+ xs *ipt = xs_fmt("%s/public.idx", srv_basedir);
+ index_add(ipt, id);
+ }
+ else
+ srv_debug(1, xs_fmt("Not added to public instance index %s", id));
}
}
}
@@ -1524,8 +1526,17 @@ xs_list *timeline_instance_list(int skip, int show)
/* returns the timeline for the full instance */
{
xs *idx = instance_index_fn();
+ xs *lst = index_list_desc(idx, skip, show);
- return index_list_desc(idx, skip, show);
+ /* make the list unique */
+ xs_set rep;
+ xs_set_init(&rep);
+ const char *md5;
+
+ xs_list_foreach(lst, md5)
+ xs_set_add(&rep, md5);
+
+ return xs_set_result(&rep);
}