summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c50
1 files changed, 36 insertions, 14 deletions
diff --git a/html.c b/html.c
index 6c42842..54920fb 100644
--- a/html.c
+++ b/html.c
@@ -2658,10 +2658,32 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2658 xs_html_add(body, 2658 xs_html_add(body,
2659 posts); 2659 posts);
2660 2660
2661 int mark_shown = 0;
2662
2661 while (xs_list_iter(&p, &v)) { 2663 while (xs_list_iter(&p, &v)) {
2662 xs *msg = NULL; 2664 xs *msg = NULL;
2663 int status; 2665 int status;
2664 2666
2667 /* "already seen" mark? */
2668 if (strcmp(v, MD5_ALREADY_SEEN_MARK) == 0) {
2669 if (skip == 0 && !mark_shown) {
2670 xs *s = xs_fmt("%s/admin", user->actor);
2671
2672 xs_html_add(posts,
2673 xs_html_tag("div",
2674 xs_html_attr("class", "snac-no-more-unseen-posts"),
2675 xs_html_text(L("No more unseen posts")),
2676 xs_html_text(" - "),
2677 xs_html_tag("a",
2678 xs_html_attr("href", s),
2679 xs_html_text(L("Back to top")))));
2680 }
2681
2682 mark_shown = 1;
2683
2684 continue;
2685 }
2686
2665 if (utl && user && !is_pinned_by_md5(user, v)) 2687 if (utl && user && !is_pinned_by_md5(user, v))
2666 status = timeline_get_by_md5(user, v, &msg); 2688 status = timeline_get_by_md5(user, v, &msg);
2667 else 2689 else
@@ -3324,21 +3346,17 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3324 } 3346 }
3325 else { 3347 else {
3326 xs *list = NULL; 3348 xs *list = NULL;
3327 xs *next = NULL; 3349 int more = 0;
3328 3350
3329 if (xs_is_true(xs_dict_get(srv_config, "strict_public_timelines"))) { 3351 if (xs_is_true(xs_dict_get(srv_config, "strict_public_timelines")))
3330 list = timeline_simple_list(&snac, "public", skip, show); 3352 list = timeline_simple_list(&snac, "public", skip, show, &more);
3331 next = timeline_simple_list(&snac, "public", skip + show, 1); 3353 else
3332 } 3354 list = timeline_list(&snac, "public", skip, show, &more);
3333 else {
3334 list = timeline_list(&snac, "public", skip, show);
3335 next = timeline_list(&snac, "public", skip + show, 1);
3336 }
3337 3355
3338 xs *pins = pinned_list(&snac); 3356 xs *pins = pinned_list(&snac);
3339 pins = xs_list_cat(pins, list); 3357 pins = xs_list_cat(pins, list);
3340 3358
3341 *body = html_timeline(&snac, pins, 1, skip, show, xs_list_len(next), NULL, "", 1, error); 3359 *body = html_timeline(&snac, pins, 1, skip, show, more, NULL, "", 1, error);
3342 3360
3343 *b_size = strlen(*body); 3361 *b_size = strlen(*body);
3344 status = HTTP_STATUS_OK; 3362 status = HTTP_STATUS_OK;
@@ -3487,6 +3505,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3487 } 3505 }
3488 } 3506 }
3489 else { 3507 else {
3508 /** the private timeline **/
3490 double t = history_mtime(&snac, "timeline.html_"); 3509 double t = history_mtime(&snac, "timeline.html_");
3491 3510
3492 /* if enabled by admin, return a cached page if its timestamp is: 3511 /* if enabled by admin, return a cached page if its timestamp is:
@@ -3500,19 +3519,22 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3500 xs_dict_get(req, "if-none-match"), etag); 3519 xs_dict_get(req, "if-none-match"), etag);
3501 } 3520 }
3502 else { 3521 else {
3522 int more = 0;
3523
3503 snac_debug(&snac, 1, xs_fmt("building timeline")); 3524 snac_debug(&snac, 1, xs_fmt("building timeline"));
3504 3525
3505 xs *list = timeline_list(&snac, "private", skip, show); 3526 xs *list = timeline_list(&snac, "private", skip, show, &more);
3506 xs *next = timeline_list(&snac, "private", skip + show, 1);
3507 3527
3508 *body = html_timeline(&snac, list, 0, skip, show, 3528 *body = html_timeline(&snac, list, 0, skip, show,
3509 xs_list_len(next), NULL, "/admin", 1, error); 3529 more, NULL, "/admin", 1, error);
3510 3530
3511 *b_size = strlen(*body); 3531 *b_size = strlen(*body);
3512 status = HTTP_STATUS_OK; 3532 status = HTTP_STATUS_OK;
3513 3533
3514 if (save) 3534 if (save)
3515 history_add(&snac, "timeline.html_", *body, *b_size, etag); 3535 history_add(&snac, "timeline.html_", *body, *b_size, etag);
3536
3537 timeline_add_mark(&snac);
3516 } 3538 }
3517 } 3539 }
3518 } 3540 }
@@ -3712,7 +3734,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
3712 3734
3713 int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20")); 3735 int cnt = xs_number_get(xs_dict_get_def(srv_config, "max_public_entries", "20"));
3714 3736
3715 xs *elems = timeline_simple_list(&snac, "public", 0, cnt); 3737 xs *elems = timeline_simple_list(&snac, "public", 0, cnt, NULL);
3716 xs *bio = xs_dup(xs_dict_get(snac.config, "bio")); 3738 xs *bio = xs_dup(xs_dict_get(snac.config, "bio"));
3717 3739
3718 xs *rss_title = xs_fmt("%s (@%s@%s)", 3740 xs *rss_title = xs_fmt("%s (@%s@%s)",