diff options
| author | 2022-11-01 18:16:03 +0100 | |
|---|---|---|
| committer | 2022-11-01 18:16:03 +0100 | |
| commit | ccb82367ad78587f2f9e881e7bb9e38f0f4ecdda (patch) | |
| tree | 115857b83290f4b780022ad8b94d633ca5d469df | |
| parent | After reacting to a post, redirection is done to the next entry instead of top. (diff) | |
| download | penes-snac2-ccb82367ad78587f2f9e881e7bb9e38f0f4ecdda.tar.gz penes-snac2-ccb82367ad78587f2f9e881e7bb9e38f0f4ecdda.tar.xz penes-snac2-ccb82367ad78587f2f9e881e7bb9e38f0f4ecdda.zip | |
Another tweak to the #redir after like or boost.
| -rw-r--r-- | html.c | 16 |
1 files changed, 9 insertions, 7 deletions
| @@ -440,7 +440,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, int num) | |||
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | 442 | ||
| 443 | d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, int level) | 443 | d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, int level, int *num) |
| 444 | { | 444 | { |
| 445 | char *id = xs_dict_get(msg, "id"); | 445 | char *id = xs_dict_get(msg, "id"); |
| 446 | char *type = xs_dict_get(msg, "type"); | 446 | char *type = xs_dict_get(msg, "type"); |
| @@ -448,7 +448,6 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 448 | char *actor; | 448 | char *actor; |
| 449 | int sensitive = 0; | 449 | int sensitive = 0; |
| 450 | char *v; | 450 | char *v; |
| 451 | int num = xs_list_len(seen->list); | ||
| 452 | 451 | ||
| 453 | /* do not show non-public messages in the public timeline */ | 452 | /* do not show non-public messages in the public timeline */ |
| 454 | if (local && !is_msg_public(snac, msg)) | 453 | if (local && !is_msg_public(snac, msg)) |
| @@ -460,8 +459,10 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 460 | 459 | ||
| 461 | xs *s = xs_str_new(NULL); | 460 | xs *s = xs_str_new(NULL); |
| 462 | 461 | ||
| 463 | { | 462 | if (level == 0) { |
| 464 | xs *s1 = xs_fmt("<a name=\"%d_entry\"></a>\n", num); | 463 | xs *s1 = xs_fmt("<a name=\"%d_entry\"></a>\n", *num); |
| 464 | |||
| 465 | *num = *num + 1; | ||
| 465 | 466 | ||
| 466 | s = xs_str_cat(s, s1); | 467 | s = xs_str_cat(s, s1); |
| 467 | } | 468 | } |
| @@ -672,7 +673,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 672 | /** controls **/ | 673 | /** controls **/ |
| 673 | 674 | ||
| 674 | if (!local) | 675 | if (!local) |
| 675 | s = html_entry_controls(snac, s, msg, num + 1); | 676 | s = html_entry_controls(snac, s, msg, *num); |
| 676 | 677 | ||
| 677 | /** children **/ | 678 | /** children **/ |
| 678 | 679 | ||
| @@ -697,7 +698,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 697 | s = xs_str_cat(s, "</details>\n"); | 698 | s = xs_str_cat(s, "</details>\n"); |
| 698 | 699 | ||
| 699 | if (chd != NULL) | 700 | if (chd != NULL) |
| 700 | s = html_entry(snac, s, chd, seen, local, level + 1); | 701 | s = html_entry(snac, s, chd, seen, local, level + 1, num); |
| 701 | else | 702 | else |
| 702 | snac_debug(snac, 2, xs_fmt("cannot read from timeline child %s", id)); | 703 | snac_debug(snac, 2, xs_fmt("cannot read from timeline child %s", id)); |
| 703 | 704 | ||
| @@ -734,6 +735,7 @@ d_char *html_timeline(snac *snac, char *list, int local) | |||
| 734 | xs_set *seen = xs_set_new(4096); | 735 | xs_set *seen = xs_set_new(4096); |
| 735 | char *v; | 736 | char *v; |
| 736 | double t = ftime(); | 737 | double t = ftime(); |
| 738 | int num = 0; | ||
| 737 | 739 | ||
| 738 | s = html_user_header(snac, s, local); | 740 | s = html_user_header(snac, s, local); |
| 739 | 741 | ||
| @@ -746,7 +748,7 @@ d_char *html_timeline(snac *snac, char *list, int local) | |||
| 746 | while (xs_list_iter(&list, &v)) { | 748 | while (xs_list_iter(&list, &v)) { |
| 747 | xs *msg = timeline_get(snac, v); | 749 | xs *msg = timeline_get(snac, v); |
| 748 | 750 | ||
| 749 | s = html_entry(snac, s, msg, seen, local, 0); | 751 | s = html_entry(snac, s, msg, seen, local, 0, &num); |
| 750 | } | 752 | } |
| 751 | 753 | ||
| 752 | s = xs_str_cat(s, "</div>\n"); | 754 | s = xs_str_cat(s, "</div>\n"); |