diff options
| author | grunfink <grunfink@comam.es> | 2026-08-30 16:38:58 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2026-08-30 16:38:58 +0200 |
| commit | 61ef7a86183d7d8f5f6a5fcd6d945b91dcb68526 (patch) | |
| tree | ef5986cad240ee4ad2abd648eecb0217bace8a9f | |
| parent | 62166d33affa48b625867b246ae1c282fc97035b (diff) | |
Fixed error in notification filtering.
| -rw-r--r-- | data.c | 14 | ||||
| -rw-r--r-- | html.c | 7 | ||||
| -rw-r--r-- | snac.h | 2 |
3 files changed, 17 insertions, 6 deletions
@@ -3576,7 +3576,7 @@ xs_list *notify_list(snac *snac, int skip, int show) } -xs_list *notify_filter_list(snac *snac, xs_list *notifs) +xs_list *notify_filter_list(snac *snac, xs_list *notifs, int skip, int show) /* apply user-defined notification filter to IDs */ { const xs_dict *n_filter = xs_dict_get(snac->config, "notify_filter"); @@ -3633,7 +3633,17 @@ xs_list *notify_filter_list(snac *snac, xs_list *notifs) continue; if (strcmp(type, "Announce") == 0 && !n_ann_on) continue; + + if (skip) { + skip--; + continue; + } + flt = xs_list_append(flt, v); + show--; + + if (show == 0) + break; } return flt; } @@ -3644,7 +3654,7 @@ int notify_new_num(snac *snac) { xs *t = notify_check_time(snac, 0); xs *lst_unfilt = notify_list(snac, 0, XS_ALL); - xs *lst = notify_filter_list(snac, lst_unfilt); + xs *lst = notify_filter_list(snac, lst_unfilt, 0, XS_ALL); int cnt = 0; xs_list *p = lst; @@ -4267,7 +4267,7 @@ xs_str *html_notifications(snac *user, int skip, int show) if (xs_is_true(xs_dict_get(srv_config, "proxy_media"))) proxy = user->actor; - xs *n_list_unfilt = notify_list(user, skip, show); + xs *n_list_unfilt = notify_list(user, 0, XS_ALL); xs *n_time = notify_check_time(user, 0); xs_html *body = html_user_body(user, 0); @@ -4278,7 +4278,7 @@ xs_str *html_notifications(snac *user, int skip, int show) user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz n_filter = xs_dict_get(user->config, "notify_filter"); } - xs *n_list = notify_filter_list(user, n_list_unfilt); + xs *n_list = notify_filter_list(user, n_list_unfilt, skip, show); /* all filters are true by default */ const xs_val *n_def = xs_stock( XSTYPE_TRUE ); int n_likes_on = xs_is_true(xs_dict_get_def(n_filter, "likes", n_def)); @@ -4607,7 +4607,8 @@ xs_str *html_notifications(snac *user, int skip, int show) xs_html_text(L("None")))); /* add the navigation footer */ - xs *next_p = notify_list(user, skip + show, 1); + xs *next_p = notify_filter_list(user, n_list_unfilt, skip + show, 1); + if (xs_list_len(next_p)) { xs *url = xs_fmt("%s/notifications?skip=%d&show=%d", user->actor, skip + show, show); @@ -291,7 +291,7 @@ void notify_add(snac *snac, const char *type, const char *utype, xs_dict *notify_get(snac *snac, const char *id); int notify_new_num(snac *snac); xs_list *notify_list(snac *snac, int skip, int show); -xs_list *notify_filter_list(snac *snac, xs_list *ids); +xs_list *notify_filter_list(snac *snac, xs_list *ids, int skip, int show); void notify_clear(snac *snac); xs_dict *markers_get(snac *snac, const xs_list *markers); |