summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar byte2025-09-14 00:30:00 +0200
committerGravatar byte2025-09-20 17:16:54 +0200
commitdcf5acaf538924aab532ea95bb311e4b80538856 (patch)
tree47ae5f679eab641c1a0fe28edbe834fce242c68e /data.c
parentDon't use # anchors in the reply paging, as Misskey seems to dislike them. (diff)
downloadsnac2-dcf5acaf538924aab532ea95bb311e4b80538856.tar.gz
snac2-dcf5acaf538924aab532ea95bb311e4b80538856.tar.xz
snac2-dcf5acaf538924aab532ea95bb311e4b80538856.zip
implementing visibility scopes
Diffstat (limited to 'data.c')
-rw-r--r--data.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/data.c b/data.c
index 4a16a82..9ef0d42 100644
--- a/data.c
+++ b/data.c
@@ -1456,15 +1456,16 @@ void timeline_update_indexes(snac *snac, const char *id)
1456 xs *msg = NULL; 1456 xs *msg = NULL;
1457 1457
1458 if (valid_status(object_get(id, &msg))) { 1458 if (valid_status(object_get(id, &msg))) {
1459 const int scope = get_msg_visibility(msg);
1459 /* if its ours and is public, also store in public */ 1460 /* if its ours and is public, also store in public */
1460 if (is_msg_public(msg)) { 1461 if (scope == SCOPE_PUBLIC) {
1461 if (object_user_cache_add(snac, id, "public") >= 0) { 1462 if (object_user_cache_add(snac, id, "public") >= 0) {
1462 /* also add it to the instance public timeline */ 1463 /* also add it to the instance public timeline */
1463 xs *ipt = xs_fmt("%s/public.idx", srv_basedir); 1464 xs *ipt = xs_fmt("%s/public.idx", srv_basedir);
1464 index_add(ipt, id); 1465 index_add(ipt, id);
1465 } 1466 }
1466 else 1467 else
1467 srv_debug(1, xs_fmt("Not added to public instance index %s", id)); 1468 srv_debug(1, xs_fmt("Not added to public instance index %s, visibility %d", id, scope));
1468 } 1469 }
1469 else 1470 else
1470 /* also add it to public, it will be discarded later */ 1471 /* also add it to public, it will be discarded later */
@@ -2222,7 +2223,10 @@ void tag_index(const char *id, const xs_dict *obj)
2222 const xs_list *tags = xs_dict_get(obj, "tag"); 2223 const xs_list *tags = xs_dict_get(obj, "tag");
2223 xs *md5_id = xs_md5_hex(id, strlen(id)); 2224 xs *md5_id = xs_md5_hex(id, strlen(id));
2224 2225
2225 if (is_msg_public(obj) && xs_type(tags) == XSTYPE_LIST && xs_list_len(tags) > 0) { 2226 if (get_msg_visibility(obj) != SCOPE_PUBLIC)
2227 return;
2228
2229 if (xs_type(tags) == XSTYPE_LIST && xs_list_len(tags) > 0) {
2226 xs *g_tag_dir = xs_fmt("%s/tag", srv_basedir); 2230 xs *g_tag_dir = xs_fmt("%s/tag", srv_basedir);
2227 2231
2228 mkdirx(g_tag_dir); 2232 mkdirx(g_tag_dir);