diff options
| author | 2022-10-31 15:54:07 +0100 | |
|---|---|---|
| committer | 2022-10-31 15:54:07 +0100 | |
| commit | 685b25af14b6500634f178af7e8698568ff65cc5 (patch) | |
| tree | e25e91bf320812ef7a98bf3b7c9d1ec0e33370e4 | |
| parent | Updated TODO. (diff) | |
| download | penes-snac2-685b25af14b6500634f178af7e8698568ff65cc5.tar.gz penes-snac2-685b25af14b6500634f178af7e8698568ff65cc5.tar.xz penes-snac2-685b25af14b6500634f178af7e8698568ff65cc5.zip | |
After reacting to a post, redirection is done to the next entry instead of top.
This work more or less ok for level 0 entries, but it's very
confusing for the others.
| -rw-r--r-- | html.c | 21 |
1 files changed, 17 insertions, 4 deletions
| @@ -346,7 +346,7 @@ d_char *build_mentions(snac *snac, char *msg) | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | 348 | ||
| 349 | d_char *html_entry_controls(snac *snac, d_char *os, char *msg) | 349 | d_char *html_entry_controls(snac *snac, d_char *os, char *msg, int num) |
| 350 | { | 350 | { |
| 351 | char *id = xs_dict_get(msg, "id"); | 351 | char *id = xs_dict_get(msg, "id"); |
| 352 | char *actor = xs_dict_get(msg, "attributedTo"); | 352 | char *actor = xs_dict_get(msg, "attributedTo"); |
| @@ -362,6 +362,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg) | |||
| 362 | "<form method=\"post\" action=\"%s/admin/action\">\n" | 362 | "<form method=\"post\" action=\"%s/admin/action\">\n" |
| 363 | "<input type=\"hidden\" name=\"id\" value=\"%s\">\n" | 363 | "<input type=\"hidden\" name=\"id\" value=\"%s\">\n" |
| 364 | "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n" | 364 | "<input type=\"hidden\" name=\"actor\" value=\"%s\">\n" |
| 365 | "<input type=\"hidden\" name=\"redir\" value=\"%d_entry\">\n" | ||
| 365 | "<input type=\"button\" name=\"action\" " | 366 | "<input type=\"button\" name=\"action\" " |
| 366 | "value=\"%s\" onclick=\"" | 367 | "value=\"%s\" onclick=\"" |
| 367 | "x = document.getElementById('%s_reply'); " | 368 | "x = document.getElementById('%s_reply'); " |
| @@ -370,7 +371,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg) | |||
| 370 | " x.style.display = 'block';" | 371 | " x.style.display = 'block';" |
| 371 | "\">\n", | 372 | "\">\n", |
| 372 | 373 | ||
| 373 | snac->actor, id, actor, | 374 | snac->actor, id, actor, num, |
| 374 | L("Reply"), | 375 | L("Reply"), |
| 375 | md5 | 376 | md5 |
| 376 | ); | 377 | ); |
| @@ -447,6 +448,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 447 | char *actor; | 448 | char *actor; |
| 448 | int sensitive = 0; | 449 | int sensitive = 0; |
| 449 | char *v; | 450 | char *v; |
| 451 | int num = xs_list_len(seen->list); | ||
| 450 | 452 | ||
| 451 | /* do not show non-public messages in the public timeline */ | 453 | /* do not show non-public messages in the public timeline */ |
| 452 | if (local && !is_msg_public(snac, msg)) | 454 | if (local && !is_msg_public(snac, msg)) |
| @@ -458,6 +460,12 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 458 | 460 | ||
| 459 | xs *s = xs_str_new(NULL); | 461 | xs *s = xs_str_new(NULL); |
| 460 | 462 | ||
| 463 | { | ||
| 464 | xs *s1 = xs_fmt("<a name=\"%d_entry\"></a>\n", num); | ||
| 465 | |||
| 466 | s = xs_str_cat(s, s1); | ||
| 467 | } | ||
| 468 | |||
| 461 | if (strcmp(type, "Follow") == 0) { | 469 | if (strcmp(type, "Follow") == 0) { |
| 462 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); | 470 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); |
| 463 | 471 | ||
| @@ -664,7 +672,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, xs_set *seen, int local, i | |||
| 664 | /** controls **/ | 672 | /** controls **/ |
| 665 | 673 | ||
| 666 | if (!local) | 674 | if (!local) |
| 667 | s = html_entry_controls(snac, s, msg); | 675 | s = html_entry_controls(snac, s, msg, num + 1); |
| 668 | 676 | ||
| 669 | /** children **/ | 677 | /** children **/ |
| 670 | 678 | ||
| @@ -1112,7 +1120,12 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size, | |||
| 1112 | } | 1120 | } |
| 1113 | 1121 | ||
| 1114 | if (status == 303) { | 1122 | if (status == 303) { |
| 1115 | *body = xs_fmt("%s/admin#snac-posts", snac.actor); | 1123 | char *redir = xs_dict_get(p_vars, "redir"); |
| 1124 | |||
| 1125 | if (xs_is_null(redir)) | ||
| 1126 | redir = "snac-posts"; | ||
| 1127 | |||
| 1128 | *body = xs_fmt("%s/admin#%s", snac.actor, redir); | ||
| 1116 | *b_size = strlen(*body); | 1129 | *b_size = strlen(*body); |
| 1117 | } | 1130 | } |
| 1118 | 1131 | ||