commit b54e8a2
grunfink
·
2026-09-05 07:28:53 +0000 UTC
parent 32ce055
In the people page, add an explicit mention. If this is not done, Mastodon doesn't recognize the post as a direct message nor notifies the recipient, even if it's clear that the post is a DM because it has a one element 'to' array with the actor id as only item.
1 files changed,
+18,
-1
M
html.c
M
html.c
+18,
-1
1@@ -4115,11 +4115,28 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c
2 xs *dm_div_id = xs_fmt("%s_%s_dm", md5, t);
3 xs *dm_form_id = xs_fmt("%s_reply_form", md5);
4
5+ /* build a mention for the DM body: it seems that Mastodon,
6+ if a mention is not present, it does not recognize it as a DM,
7+ even if it has a one-item 'to' field with only the user */
8+ xs *dm_body = NULL;
9+
10+ {
11+ const char *webfinger = xs_dict_get(actor, "webfinger");
12+
13+ if (xs_is_string(webfinger))
14+ dm_body = xs_fmt("@%s ", webfinger);
15+ else {
16+ const char *uname = xs_dict_get_def(actor, "preferredUsername", "anonymous");
17+ xs *l = xs_split(actor_id, "/");
18+ dm_body = xs_fmt("@%s@%s ", uname, xs_list_get(l, 2));
19+ }
20+ }
21+
22 xs_html_add(snac_controls,
23 xs_html_tag("p", NULL),
24 html_note(user, L("Direct Message..."),
25 dm_div_id, dm_form_id,
26- "", "",
27+ "", dm_body,
28 NULL, actor_id,
29 xs_stock(XSTYPE_FALSE), "",
30 SCOPE_MENTIONED, NULL,