aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-25 23:06:08 +0100
committerdefault <nobody@localhost>2025-01-25 23:06:08 +0100
commitb2f5f95c7b8c8793f82d394009b0908888de5bdc (patch)
tree474e3e058c105167821d40604792b60897b46462 /data.c
parent896a36837c8da070d85abe92d62d12c4009fca1c (diff)
Fixed repeated entries in the instance public timeline.
Diffstat (limited to 'data.c')
-rw-r--r--data.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/data.c b/data.c
index 33947ff..40382d2 100644
--- 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);
}