summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2025-01-25 23:06:08 +0100
committerGravatar default2025-01-25 23:06:08 +0100
commitb2f5f95c7b8c8793f82d394009b0908888de5bdc (patch)
tree474e3e058c105167821d40604792b60897b46462 /data.c
parentAnother tweak to fix repeated notifications. (diff)
downloadsnac2-b2f5f95c7b8c8793f82d394009b0908888de5bdc.tar.gz
snac2-b2f5f95c7b8c8793f82d394009b0908888de5bdc.tar.xz
snac2-b2f5f95c7b8c8793f82d394009b0908888de5bdc.zip
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)
1399 if (valid_status(object_get(id, &msg))) { 1399 if (valid_status(object_get(id, &msg))) {
1400 /* if its ours and is public, also store in public */ 1400 /* if its ours and is public, also store in public */
1401 if (is_msg_public(msg)) { 1401 if (is_msg_public(msg)) {
1402 object_user_cache_add(snac, id, "public"); 1402 if (object_user_cache_add(snac, id, "public") >= 0) {
1403 1403 /* also add it to the instance public timeline */
1404 /* also add it to the instance public timeline */ 1404 xs *ipt = xs_fmt("%s/public.idx", srv_basedir);
1405 xs *ipt = xs_fmt("%s/public.idx", srv_basedir); 1405 index_add(ipt, id);
1406 index_add(ipt, id); 1406 }
1407 else
1408 srv_debug(1, xs_fmt("Not added to public instance index %s", id));
1407 } 1409 }
1408 } 1410 }
1409 } 1411 }
@@ -1524,8 +1526,17 @@ xs_list *timeline_instance_list(int skip, int show)
1524/* returns the timeline for the full instance */ 1526/* returns the timeline for the full instance */
1525{ 1527{
1526 xs *idx = instance_index_fn(); 1528 xs *idx = instance_index_fn();
1529 xs *lst = index_list_desc(idx, skip, show);
1527 1530
1528 return index_list_desc(idx, skip, show); 1531 /* make the list unique */
1532 xs_set rep;
1533 xs_set_init(&rep);
1534 const char *md5;
1535
1536 xs_list_foreach(lst, md5)
1537 xs_set_add(&rep, md5);
1538
1539 return xs_set_result(&rep);
1529} 1540}
1530 1541
1531 1542