aboutsummaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorgrunfink <grunfink@noreply.codeberg.org>2026-05-28 08:52:44 +0200
committergrunfink <grunfink@noreply.codeberg.org>2026-05-28 08:52:44 +0200
commit14d4e9afcd6ff2508795852eaec67e672366d138 (patch)
tree7e1eba6b67fc3fcc71e6b91835cec247be8b2499 /data.c
parent0bde1abe67aee7e7840338afef1022bcec3a1bd8 (diff)
parent5182a3384e80462e08713903c14b9cdecf56cdfb (diff)
Merge pull request 'Add keep_replied_posts and keep_replied_me feathers, and auto-mention post author when reply to a post' (#617) from hanchan/snac2-dev:master into master
Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/617
Diffstat (limited to 'data.c')
-rw-r--r--data.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/data.c b/data.c
index 37c9325..3f7ba29 100644
--- a/data.c
+++ b/data.c
@@ -1562,6 +1562,37 @@ void timeline_update_indexes(snac *snac, const char *id)
else
/* also add it to public, it will be discarded later */
object_user_cache_add(snac, id, "public");
+
+ /* if `keep_replied_posts` is `true` and a local post is a reply to a remote post, add the parent remote post to the public */
+ if (xs_is_true(xs_dict_get(srv_config, "keep_replied_posts"))) {
+ const char *in_reply_to = get_in_reply_to(msg);
+
+ if (xs_is_string(in_reply_to) && *in_reply_to &&
+ !is_msg_mine(snac, in_reply_to)) {
+ if (object_user_cache_add(snac, in_reply_to, "public") >= 0) {
+ snac_debug(snac, 1,
+ xs_fmt("keep_replied_posts: added parent %s to public", in_reply_to));
+ }
+ }
+ }
+ }
+ }
+ else {
+ /* if `keep_replied_me` is `true` and a remote post is a reply to one of local posts, add it to public */
+ if (xs_is_true(xs_dict_get(srv_config, "keep_replied_me"))) {
+ xs *msg = NULL;
+
+ if (valid_status(object_get(id, &msg))) {
+ const char *in_reply_to = get_in_reply_to(msg);
+
+ if (xs_is_string(in_reply_to) && *in_reply_to &&
+ is_msg_mine(snac, in_reply_to)) {
+ if (object_user_cache_add(snac, id, "public") >= 0) {
+ snac_debug(snac, 1,
+ xs_fmt("keep_replied_me: added reply %s to public", id));
+ }
+ }
+ }
}
}
}