aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data.c14
-rw-r--r--html.c7
-rw-r--r--snac.h2
3 files changed, 17 insertions, 6 deletions
diff --git a/data.c b/data.c
index 04b9e6e..fd6c91f 100644
--- a/data.c
+++ b/data.c
@@ -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;
diff --git a/html.c b/html.c
index 134cc87..b26c252 100644
--- a/html.c
+++ b/html.c
@@ -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);
diff --git a/snac.h b/snac.h
index 2acb1ec..80d2429 100644
--- a/snac.h
+++ b/snac.h
@@ -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);