commit d413752
grunfink
·
2025-11-20 09:22:53 +0000 UTC
parent 30910b1
Added a Follow/Unfollow button next to a new follow notification.
1 files changed,
+27,
-1
M
html.c
M
html.c
+27,
-1
1@@ -3746,7 +3746,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
2 xs_html_attr("class", "snac-post-with-desc"),
3 html_label);
4
5- if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0 || strcmp(type, "Block") == 0) {
6+ if (strcmp(type, "Block") == 0) {
7 if (actor)
8 xs_html_add(entry,
9 xs_html_tag("div",
10@@ -3754,6 +3754,32 @@ xs_str *html_notifications(snac *user, int skip, int show)
11 html_actor_icon(user, actor, NULL, NULL, NULL, -1, 0, proxy, NULL, NULL)));
12 }
13 else
14+ if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) {
15+ if (actor) {
16+ xs *action = xs_fmt("%s/admin/action", user->actor);
17+ xs_html *button = NULL;
18+
19+ if (following_check(user, actor_id))
20+ button = html_button("unfollow", L("Unfollow"), L("Stop following this user's activity"));
21+ else
22+ button = html_button("follow", L("Follow"), L("Start following this user's activity"));
23+
24+ xs_html_add(entry,
25+ xs_html_tag("div",
26+ xs_html_attr("class", "snac-post"),
27+ html_actor_icon(user, actor, NULL, NULL, NULL, -1, 0, proxy, NULL, NULL),
28+ xs_html_tag("form",
29+ xs_html_attr("method", "post"),
30+ xs_html_attr("action", action),
31+ xs_html_sctag("input",
32+ xs_html_attr("type", "hidden"),
33+ xs_html_attr("name", "actor"),
34+ xs_html_attr("value", actor_id)),
35+ button,
36+ xs_html_sctag("br", NULL))));
37+ }
38+ }
39+ else
40 if (strcmp(type, "Move") == 0) {
41 const xs_dict *o_msg = xs_dict_get(noti, "msg");
42 const char *target;