From b11795b1b690c8e2e71a6758ea825cbbaab91a39 Mon Sep 17 00:00:00 2001 From: grunfink Date: Wed, 6 May 2026 20:21:43 +0200 Subject: mastoapi: fix lost hashtags when editing posts. --- mastoapi.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 9f79b97..109142c 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -4205,17 +4205,37 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path, if (valid_status(timeline_get_by_md5(&snac, md5, &msg))) { const char *content = xs_dict_get(args, "status"); xs *atls = xs_list_new(); - xs *f_content = not_really_markdown(content, &atls, NULL); + xs *f_content0 = not_really_markdown(content, &atls, NULL); + xs *tag = xs_list_new(); + xs *f_content = process_tags(&snac, f_content0, &tag); /* replace fields with new content */ msg = xs_dict_set(msg, "sourceContent", content); msg = xs_dict_set(msg, "content", f_content); + xs *content_map = xs_dup(xs_dict_get(msg, "contentMap")); + if (xs_is_dict(content_map)) { + /* get the first pair */ + const char *k, *v; + int c = 0; + + if (xs_dict_next(content_map, &k, &v, &c)) { + content_map = xs_dict_set(content_map, k, f_content); + msg = xs_dict_set(msg, "contentMap", content_map); + } + } + xs *updated = xs_str_utctime(0, ISO_DATE_SPEC); msg = xs_dict_set(msg, "updated", updated); + msg = xs_dict_set(msg, "tag", tag); + /* overwrite object, not updating the indexes */ - object_add_ow(xs_dict_get(msg, "id"), msg); + const char *id = xs_dict_get(msg, "id"); + + object_add_ow(id, msg); + + tag_index(id, msg); /* update message */ xs *c_msg = msg_update(&snac, msg); -- cgit From 871ea6a6cd636235553e53c9c3990bd235df7a11 Mon Sep 17 00:00:00 2001 From: grunfink Date: Fri, 22 May 2026 08:30:06 +0200 Subject: mastoapi: delete from admire/ cache in unfavourite and unreact. --- mastoapi.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 109142c..1ddcdc4 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -3435,6 +3435,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, xs *n_msg = msg_repulsion(&snac, id, "Like"); if (n_msg != NULL) { + object_user_cache_del(&snac, id, "admire"); enqueue_message(&snac, n_msg); out = mastoapi_status(&snac, msg); @@ -3456,6 +3457,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, xs *n_msg = msg_emoji_unreact(&snac, id, content); if (n_msg != NULL) { + object_user_cache_del(&snac, id, "admire"); enqueue_message(&snac, n_msg); out = mastoapi_status(&snac, msg); -- cgit From 6dd81fc9677a521fd7689126c5340ffe366b7a96 Mon Sep 17 00:00:00 2001 From: Santtu Lakkala Date: Fri, 22 May 2026 15:59:27 +0300 Subject: Memory leak fix --- mastoapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 1ddcdc4..1f4928e 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -355,6 +355,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path, else if (strcmp(cmd, "/token") == 0) { /** **/ xs *wrk = NULL; + xs *codewrk = NULL; const char *gtype = xs_dict_get(args, "grant_type"); const char *code = xs_dict_get(args, "code"); const char *cid = xs_dict_get(args, "client_id"); @@ -387,7 +388,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path, I'm not sure of the impacts of this right now, but Subway Tooter does not provide a code so one must be generated */ if (xs_is_null(code)){ - code = random_str(); + code = codewrk = random_str(); } if (gtype && code && cid && csec && ruri) { xs *app = app_get(cid); -- cgit From b2f091cb5ad0544fffab699f244690671684fa87 Mon Sep 17 00:00:00 2001 From: e0w0e Date: Mon, 22 Jun 2026 21:00:55 +0200 Subject: Fixed custom emojis would turn into plain text with the :shortcode: format after edit status. I've noticed that when I post a status, custom emojis display correctly, but when I edit this status using clients(e.g.Trunks, Moshidon, Phanpy.social...), the custom emojis no longer display correctly. This change might resolve the issue. --- mastoapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mastoapi.c') diff --git a/mastoapi.c b/mastoapi.c index 1f4928e..cf2f53e 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -4208,8 +4208,8 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path, if (valid_status(timeline_get_by_md5(&snac, md5, &msg))) { const char *content = xs_dict_get(args, "status"); xs *atls = xs_list_new(); - xs *f_content0 = not_really_markdown(content, &atls, NULL); xs *tag = xs_list_new(); + xs *f_content0 = not_really_markdown(content, &atls, &tag); xs *f_content = process_tags(&snac, f_content0, &tag); /* replace fields with new content */ -- cgit