diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 43 |
1 files changed, 32 insertions, 11 deletions
| @@ -362,8 +362,10 @@ d_char *html_user_header(snac *snac, d_char *s, int local) | |||
| 362 | s = xs_str_cat(s, s1); | 362 | s = xs_str_cat(s, s1); |
| 363 | 363 | ||
| 364 | if (local) { | 364 | if (local) { |
| 365 | xs *bio = not_really_markdown(xs_dict_get(snac->config, "bio"), NULL); | 365 | xs *bio1 = not_really_markdown(xs_dict_get(snac->config, "bio"), NULL); |
| 366 | xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio); | 366 | xs *tags = xs_list_new(); |
| 367 | xs *bio2 = process_tags(snac, bio1, &tags); | ||
| 368 | xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio2); | ||
| 367 | 369 | ||
| 368 | s = xs_str_cat(s, s1); | 370 | s = xs_str_cat(s, s1); |
| 369 | } | 371 | } |
| @@ -387,7 +389,8 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 387 | "<textarea class=\"snac-textarea\" name=\"content\" " | 389 | "<textarea class=\"snac-textarea\" name=\"content\" " |
| 388 | "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n" | 390 | "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n" |
| 389 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" | 391 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" |
| 390 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n" | 392 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\"> " |
| 393 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\">\n" | ||
| 391 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" | 394 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" |
| 392 | 395 | ||
| 393 | "<details><summary>%s</summary>\n" /** attach **/ | 396 | "<details><summary>%s</summary>\n" /** attach **/ |
| @@ -512,6 +515,7 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 512 | xs *s1 = xs_fmt(_tmpl, | 515 | xs *s1 = xs_fmt(_tmpl, |
| 513 | snac->actor, | 516 | snac->actor, |
| 514 | L("Sensitive content"), | 517 | L("Sensitive content"), |
| 518 | L("Sensitive content description"), | ||
| 515 | L("Only for mentioned people"), | 519 | L("Only for mentioned people"), |
| 516 | 520 | ||
| 517 | L("Attach..."), | 521 | L("Attach..."), |
| @@ -684,8 +688,10 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 684 | 688 | ||
| 685 | const char *prev_src1 = xs_dict_get(msg, "sourceContent"); | 689 | const char *prev_src1 = xs_dict_get(msg, "sourceContent"); |
| 686 | 690 | ||
| 687 | if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { | 691 | if (!xs_is_null(prev_src1) && strcmp(actor, snac->actor) == 0) { /** edit **/ |
| 688 | xs *prev_src = xs_replace(prev_src1, "<", "<"); | 692 | xs *prev_src = xs_replace(prev_src1, "<", "<"); |
| 693 | const xs_val *sensitive = xs_dict_get(msg, "sensitive"); | ||
| 694 | const char *summary = xs_dict_get(msg, "summary"); | ||
| 689 | 695 | ||
| 690 | /* post can be edited */ | 696 | /* post can be edited */ |
| 691 | xs *s1 = xs_fmt( | 697 | xs *s1 = xs_fmt( |
| @@ -697,7 +703,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 697 | "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n" | 703 | "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n" |
| 698 | "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n" | 704 | "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n" |
| 699 | 705 | ||
| 700 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n" | 706 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> " |
| 707 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n" | ||
| 701 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" | 708 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" |
| 702 | 709 | ||
| 703 | "<details><summary>%s</summary>\n" | 710 | "<details><summary>%s</summary>\n" |
| @@ -717,6 +724,9 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 717 | prev_src, | 724 | prev_src, |
| 718 | id, | 725 | id, |
| 719 | L("Sensitive content"), | 726 | L("Sensitive content"), |
| 727 | xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "", | ||
| 728 | L("Sensitive content description"), | ||
| 729 | xs_is_null(summary) ? "" : summary, | ||
| 720 | L("Only for mentioned people"), | 730 | L("Only for mentioned people"), |
| 721 | L("Attach..."), | 731 | L("Attach..."), |
| 722 | L("File"), | 732 | L("File"), |
| @@ -728,10 +738,13 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 728 | s = xs_str_cat(s, s1); | 738 | s = xs_str_cat(s, s1); |
| 729 | } | 739 | } |
| 730 | 740 | ||
| 731 | { | 741 | { /** reply **/ |
| 732 | /* the post textarea */ | 742 | /* the post textarea */ |
| 733 | xs *ct = build_mentions(snac, msg); | 743 | xs *ct = build_mentions(snac, msg); |
| 734 | 744 | ||
| 745 | const xs_val *sensitive = xs_dict_get(msg, "sensitive"); | ||
| 746 | const char *summary = xs_dict_get(msg, "summary"); | ||
| 747 | |||
| 735 | xs *s1 = xs_fmt( | 748 | xs *s1 = xs_fmt( |
| 736 | "<p><details><summary>%s</summary>\n" | 749 | "<p><details><summary>%s</summary>\n" |
| 737 | "<p><div class=\"snac-note\" id=\"%s_reply\">\n" | 750 | "<p><div class=\"snac-note\" id=\"%s_reply\">\n" |
| @@ -741,7 +754,8 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 741 | "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n" | 754 | "rows=\"4\" wrap=\"virtual\" required=\"required\">%s</textarea>\n" |
| 742 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n" | 755 | "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n" |
| 743 | 756 | ||
| 744 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n" | 757 | "<p>%s: <input type=\"checkbox\" name=\"sensitive\" %s> " |
| 758 | "<input type=\"text\" name=\"summary\" placeholder=\"%s\" value=\"%s\">\n" | ||
| 745 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" | 759 | "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n" |
| 746 | 760 | ||
| 747 | "<details><summary>%s</summary>\n" | 761 | "<details><summary>%s</summary>\n" |
| @@ -761,6 +775,9 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch | |||
| 761 | ct, | 775 | ct, |
| 762 | id, | 776 | id, |
| 763 | L("Sensitive content"), | 777 | L("Sensitive content"), |
| 778 | xs_type(sensitive) == XSTYPE_TRUE ? "checked" : "", | ||
| 779 | L("Sensitive content description"), | ||
| 780 | xs_is_null(summary) ? "" : summary, | ||
| 764 | L("Only for mentioned people"), | 781 | L("Only for mentioned people"), |
| 765 | L("Attach..."), | 782 | L("Attach..."), |
| 766 | L("File"), | 783 | L("File"), |
| @@ -1437,7 +1454,7 @@ xs_str *html_notifications(snac *snac) | |||
| 1437 | "<form autocomplete=\"off\" " | 1454 | "<form autocomplete=\"off\" " |
| 1438 | "method=\"post\" action=\"%s/admin/clear-notifications\" id=\"clear\">\n" | 1455 | "method=\"post\" action=\"%s/admin/clear-notifications\" id=\"clear\">\n" |
| 1439 | "<input type=\"submit\" class=\"snac-btn-like\" value=\"%s\">\n" | 1456 | "<input type=\"submit\" class=\"snac-btn-like\" value=\"%s\">\n" |
| 1440 | "</form><p>", snac->actor, L("Clear all")); | 1457 | "</form><p>\n", snac->actor, L("Clear all")); |
| 1441 | s = xs_str_cat(s, s1); | 1458 | s = xs_str_cat(s, s1); |
| 1442 | 1459 | ||
| 1443 | while (xs_list_iter(&p, &v)) { | 1460 | while (xs_list_iter(&p, &v)) { |
| @@ -1498,16 +1515,19 @@ xs_str *html_notifications(snac *snac) | |||
| 1498 | else | 1515 | else |
| 1499 | if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0) | 1516 | if (strcmp(type, "Update") == 0 && strcmp(utype, "Question") == 0) |
| 1500 | label = L("Finished poll"); | 1517 | label = L("Finished poll"); |
| 1518 | else | ||
| 1519 | if (strcmp(type, "Undo") == 0 && strcmp(utype, "Follow") == 0) | ||
| 1520 | label = L("Unfollow"); | ||
| 1501 | 1521 | ||
| 1502 | xs *s1 = xs_fmt("<div class=\"snac-post-with-desc\">\n" | 1522 | xs *s1 = xs_fmt("<div class=\"snac-post-with-desc\">\n" |
| 1503 | "<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n", | 1523 | "<p><b>%s by <a href=\"%s\">%s</a></b>:</p>\n", |
| 1504 | label, actor_id, a_name); | 1524 | label, actor_id, a_name); |
| 1505 | s = xs_str_cat(s, s1); | 1525 | s = xs_str_cat(s, s1); |
| 1506 | 1526 | ||
| 1507 | if (strcmp(type, "Follow") == 0) { | 1527 | if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) { |
| 1508 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); | 1528 | s = xs_str_cat(s, "<div class=\"snac-post\">\n"); |
| 1509 | 1529 | ||
| 1510 | s = html_msg_icon(snac, s, obj); | 1530 | s = html_actor_icon(s, actor, NULL, NULL, NULL, 0); |
| 1511 | 1531 | ||
| 1512 | s = xs_str_cat(s, "</div>\n"); | 1532 | s = xs_str_cat(s, "</div>\n"); |
| 1513 | } | 1533 | } |
| @@ -1843,6 +1863,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 1843 | xs_list *attach_file = xs_dict_get(p_vars, "attach"); | 1863 | xs_list *attach_file = xs_dict_get(p_vars, "attach"); |
| 1844 | xs_str *to = xs_dict_get(p_vars, "to"); | 1864 | xs_str *to = xs_dict_get(p_vars, "to"); |
| 1845 | xs_str *sensitive = xs_dict_get(p_vars, "sensitive"); | 1865 | xs_str *sensitive = xs_dict_get(p_vars, "sensitive"); |
| 1866 | xs_str *summary = xs_dict_get(p_vars, "summary"); | ||
| 1846 | xs_str *edit_id = xs_dict_get(p_vars, "edit_id"); | 1867 | xs_str *edit_id = xs_dict_get(p_vars, "edit_id"); |
| 1847 | xs_str *alt_text = xs_dict_get(p_vars, "alt_text"); | 1868 | xs_str *alt_text = xs_dict_get(p_vars, "alt_text"); |
| 1848 | int priv = !xs_is_null(xs_dict_get(p_vars, "mentioned_only")); | 1869 | int priv = !xs_is_null(xs_dict_get(p_vars, "mentioned_only")); |
| @@ -1921,7 +1942,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 1921 | 1942 | ||
| 1922 | if (sensitive != NULL) { | 1943 | if (sensitive != NULL) { |
| 1923 | msg = xs_dict_set(msg, "sensitive", xs_stock_true); | 1944 | msg = xs_dict_set(msg, "sensitive", xs_stock_true); |
| 1924 | msg = xs_dict_set(msg, "summary", "..."); | 1945 | msg = xs_dict_set(msg, "summary", xs_is_null(summary) ? "..." : summary); |
| 1925 | } | 1946 | } |
| 1926 | 1947 | ||
| 1927 | if (xs_is_null(edit_id)) { | 1948 | if (xs_is_null(edit_id)) { |