diff options
| author | grunfink <grunfink@noreply.codeberg.org> | 2026-05-28 08:52:44 +0200 |
|---|---|---|
| committer | grunfink <grunfink@noreply.codeberg.org> | 2026-05-28 08:52:44 +0200 |
| commit | 14d4e9afcd6ff2508795852eaec67e672366d138 (patch) | |
| tree | 7e1eba6b67fc3fcc71e6b91835cec247be8b2499 /html.c | |
| parent | 0bde1abe67aee7e7840338afef1022bcec3a1bd8 (diff) | |
| parent | 5182a3384e80462e08713903c14b9cdecf56cdfb (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 'html.c')
| -rw-r--r-- | html.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -2035,6 +2035,27 @@ xs_str *build_mentions(snac *user, const xs_dict *msg) } } + /* also add the author of this post as a mention */ + const char *atto = get_atto(msg); + + if (xs_is_string(atto) && *atto && strcmp(atto, user->actor) != 0) { + /* check if this author is already in the mentions string */ + xs *l = xs_split(atto, "/"); + + if (xs_list_len(l) > 3) { + xs *actor_o = NULL; + if (valid_status(object_get(atto, &actor_o))) { + const char *uname = xs_dict_get(actor_o, "preferredUsername"); + if (!xs_is_null(uname) && *uname) { + xs *handle = xs_fmt("@%s@%s ", uname, xs_list_get(l, 2)); + if (xs_str_in(s, handle) == -1) { + s = xs_str_cat(s, handle); + } + } + } + } + } + if (*s) { xs *s1 = s; s = xs_fmt("\n\n\nCC: %s", s1); |