diff options
| author | grunfink <grunfink@comam.es> | 2025-05-18 08:23:48 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2025-05-18 08:23:48 +0200 |
| commit | ee84140ecceb07dad8ea36cc5aa29b91bbb48a56 (patch) | |
| tree | 077e8defca025ed364741a10b7557c02c554ab0f | |
| parent | 8ae0089bdb3c246810013de5c9541072b2593f00 (diff) | |
Added a pending follow request count next to the "people" link.
| -rw-r--r-- | data.c | 10 | ||||
| -rw-r--r-- | html.c | 12 | ||||
| -rw-r--r-- | snac.h | 1 |
3 files changed, 23 insertions, 0 deletions
@@ -1335,6 +1335,16 @@ xs_list *pending_list(snac *user) } +int pending_count(snac *user) +/* returns the number of pending follow confirmations */ +{ + xs *spec = xs_fmt("%s/pending/""*.json", user->basedir); + xs *l = xs_glob(spec, 0, 0); + + return xs_list_len(l); +} + + /** timeline **/ double timeline_mtime(snac *snac) @@ -923,7 +923,9 @@ static xs_html *html_user_body(snac *user, int read_only) } else { int n_len = notify_new_num(user); + int p_len = pending_count(user); xs_html *notify_count = NULL; + xs_html *pending_follow_count = NULL; /* show the number of new notifications, if there are any */ if (n_len) { @@ -935,6 +937,15 @@ static xs_html *html_user_body(snac *user, int read_only) else notify_count = xs_html_text(""); + if (p_len) { + xs *s = xs_fmt(" %d ", p_len); + pending_follow_count = xs_html_tag("sup", + xs_html_attr("style", "background-color: red; color: white;"), + xs_html_text(s)); + } + else + pending_follow_count = xs_html_text(""); + xs *admin_url = xs_fmt("%s/admin", user->actor); xs *notify_url = xs_fmt("%s/notifications", user->actor); xs *people_url = xs_fmt("%s/people", user->actor); @@ -957,6 +968,7 @@ static xs_html *html_user_body(snac *user, int read_only) xs_html_tag("a", xs_html_attr("href", people_url), xs_html_text(L("people"))), + pending_follow_count, xs_html_text(" - "), xs_html_tag("a", xs_html_attr("href", instance_url), @@ -159,6 +159,7 @@ int pending_check(snac *user, const char *actor); xs_dict *pending_get(snac *user, const char *actor); void pending_del(snac *user, const char *actor); xs_list *pending_list(snac *user); +int pending_count(snac *user); double timeline_mtime(snac *snac); int timeline_touch(snac *snac); |