diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 19 |
1 files changed, 13 insertions, 6 deletions
| @@ -1451,6 +1451,7 @@ xs_html *html_checkbox(const char *form_name, const char *label, int flag) | |||
| 1451 | xs_html_sctag("input", | 1451 | xs_html_sctag("input", |
| 1452 | xs_html_attr("type", "checkbox"), | 1452 | xs_html_attr("type", "checkbox"), |
| 1453 | xs_html_attr("name", form_name), | 1453 | xs_html_attr("name", form_name), |
| 1454 | xs_html_attr("id", form_name), | ||
| 1454 | xs_html_attr(flag ? "checked" : "", NULL)), | 1455 | xs_html_attr(flag ? "checked" : "", NULL)), |
| 1455 | xs_html_tag("label", | 1456 | xs_html_tag("label", |
| 1456 | xs_html_attr("for", form_name), | 1457 | xs_html_attr("for", form_name), |
| @@ -2801,10 +2802,12 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 2801 | xs *quoted_post = NULL; | 2802 | xs *quoted_post = NULL; |
| 2802 | 2803 | ||
| 2803 | if (valid_status(object_get(quoted_id, "ed_post))) { | 2804 | if (valid_status(object_get(quoted_id, "ed_post))) { |
| 2805 | xs *md5 = xs_md5_hex(quoted_id, strlen(quoted_id)); | ||
| 2806 | |||
| 2804 | xs_html_add(snac_content, | 2807 | xs_html_add(snac_content, |
| 2805 | xs_html_tag("blockquote", | 2808 | xs_html_tag("blockquote", |
| 2806 | xs_html_attr("class", "snac-quoted-post"), | 2809 | xs_html_attr("class", "snac-quoted-post"), |
| 2807 | html_entry(user, quoted_post, 1, level + 1, NULL, 1))); | 2810 | html_entry(user, quoted_post, 1, level + 1, md5, 1))); |
| 2808 | } | 2811 | } |
| 2809 | else | 2812 | else |
| 2810 | if (user) | 2813 | if (user) |
| @@ -3149,7 +3152,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, | |||
| 3149 | else | 3152 | else |
| 3150 | if (!xs_is_null(latitude) && !xs_is_null(longitude)) { | 3153 | if (!xs_is_null(latitude) && !xs_is_null(longitude)) { |
| 3151 | xs *url = xs_fmt("https://openstreetmap.org/search/?query=%s,%s", | 3154 | xs *url = xs_fmt("https://openstreetmap.org/search/?query=%s,%s", |
| 3152 | xs_number_str(latitude), xs_number_str(longitude)); | 3155 | xs_or(xs_number_str(latitude), latitude), xs_or(xs_number_str(longitude), longitude)); |
| 3153 | 3156 | ||
| 3154 | xs_html_add(snac_content_wrap, | 3157 | xs_html_add(snac_content_wrap, |
| 3155 | xs_html_tag("p", | 3158 | xs_html_tag("p", |
| @@ -4111,7 +4114,7 @@ void notify_filter(snac *user, const xs_dict *p_vars) | |||
| 4111 | int folreq_on = (v = xs_dict_get(p_vars, "folreqs_on")) ? strcmp(v, "on") == 0 : 0; | 4114 | int folreq_on = (v = xs_dict_get(p_vars, "folreqs_on")) ? strcmp(v, "on") == 0 : 0; |
| 4112 | int blocks_on = (v = xs_dict_get(p_vars, "blocks_on")) ? strcmp(v, "on") == 0 : 0; | 4115 | int blocks_on = (v = xs_dict_get(p_vars, "blocks_on")) ? strcmp(v, "on") == 0 : 0; |
| 4113 | int polls_on = (v = xs_dict_get(p_vars, "polls_on")) ? strcmp(v, "on") == 0 : 0; | 4116 | int polls_on = (v = xs_dict_get(p_vars, "polls_on")) ? strcmp(v, "on") == 0 : 0; |
| 4114 | xs_dict *filter = xs_dict_new(); | 4117 | xs *filter = xs_dict_new(); |
| 4115 | filter = xs_dict_set(filter, "likes", xs_stock(likes_on ? XSTYPE_TRUE : XSTYPE_FALSE)); | 4118 | filter = xs_dict_set(filter, "likes", xs_stock(likes_on ? XSTYPE_TRUE : XSTYPE_FALSE)); |
| 4116 | filter = xs_dict_set(filter, "reacts", xs_stock(reacts_on ? XSTYPE_TRUE : XSTYPE_FALSE)); | 4119 | filter = xs_dict_set(filter, "reacts", xs_stock(reacts_on ? XSTYPE_TRUE : XSTYPE_FALSE)); |
| 4117 | filter = xs_dict_set(filter, "mentions", xs_stock(ments_on ? XSTYPE_TRUE : XSTYPE_FALSE)); | 4120 | filter = xs_dict_set(filter, "mentions", xs_stock(ments_on ? XSTYPE_TRUE : XSTYPE_FALSE)); |
| @@ -4122,6 +4125,7 @@ void notify_filter(snac *user, const xs_dict *p_vars) | |||
| 4122 | filter = xs_dict_set(filter, "blocks", xs_stock(blocks_on ? XSTYPE_TRUE : XSTYPE_FALSE)); | 4125 | filter = xs_dict_set(filter, "blocks", xs_stock(blocks_on ? XSTYPE_TRUE : XSTYPE_FALSE)); |
| 4123 | filter = xs_dict_set(filter, "polls", xs_stock(polls_on ? XSTYPE_TRUE : XSTYPE_FALSE)); | 4126 | filter = xs_dict_set(filter, "polls", xs_stock(polls_on ? XSTYPE_TRUE : XSTYPE_FALSE)); |
| 4124 | user->config = xs_dict_set(user->config, "notify_filter", filter); | 4127 | user->config = xs_dict_set(user->config, "notify_filter", filter); |
| 4128 | user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz | ||
| 4125 | } | 4129 | } |
| 4126 | 4130 | ||
| 4127 | xs_str *html_notifications(snac *user, int skip, int show) | 4131 | xs_str *html_notifications(snac *user, int skip, int show) |
| @@ -4137,7 +4141,9 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 4137 | xs_html *body = html_user_body(user, 0); | 4141 | xs_html *body = html_user_body(user, 0); |
| 4138 | const xs_dict *n_filter = xs_dict_get(user->config, "notify_filter"); | 4142 | const xs_dict *n_filter = xs_dict_get(user->config, "notify_filter"); |
| 4139 | if (!n_filter) { | 4143 | if (!n_filter) { |
| 4140 | user->config = xs_dict_set(user->config, "notify_filter", xs_dict_new()); | 4144 | xs *filter = xs_dict_new(); |
| 4145 | user->config = xs_dict_set(user->config, "notify_filter", filter); | ||
| 4146 | user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz | ||
| 4141 | n_filter = xs_dict_get(user->config, "notify_filter"); | 4147 | n_filter = xs_dict_get(user->config, "notify_filter"); |
| 4142 | } | 4148 | } |
| 4143 | xs *n_list = notify_filter_list(user, n_list_unfilt); | 4149 | xs *n_list = notify_filter_list(user, n_list_unfilt); |
| @@ -4158,6 +4164,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 4158 | body); | 4164 | body); |
| 4159 | 4165 | ||
| 4160 | xs *filter_notifs_action = xs_fmt("%s/admin/filter-notifications", user->actor); | 4166 | xs *filter_notifs_action = xs_fmt("%s/admin/filter-notifications", user->actor); |
| 4167 | xs *notifs_action = xs_fmt("%s/notifications", user->actor); | ||
| 4161 | xs_html *notifs_form = xs_html_tag("form", | 4168 | xs_html *notifs_form = xs_html_tag("form", |
| 4162 | xs_html_attr("autocomplete", "off"), | 4169 | xs_html_attr("autocomplete", "off"), |
| 4163 | xs_html_attr("method", "post"), | 4170 | xs_html_attr("method", "post"), |
| @@ -4167,7 +4174,7 @@ xs_str *html_notifications(snac *user, int skip, int show) | |||
| 4167 | xs_html_sctag("input", | 4174 | xs_html_sctag("input", |
| 4168 | xs_html_attr("type", "hidden"), | 4175 | xs_html_attr("type", "hidden"), |
| 4169 | xs_html_attr("name", "hard-redir"), | 4176 | xs_html_attr("name", "hard-redir"), |
| 4170 | xs_html_attr("value", xs_fmt("%s/notifications", user->actor))), | 4177 | xs_html_attr("value", notifs_action)), |
| 4171 | html_checkbox("likes_on", L("Likes"), n_likes_on), | 4178 | html_checkbox("likes_on", L("Likes"), n_likes_on), |
| 4172 | html_checkbox("reacts_on", L("Emoji reacts"), n_reacts_on), | 4179 | html_checkbox("reacts_on", L("Emoji reacts"), n_reacts_on), |
| 4173 | html_checkbox("mentions_on", L("Mentions"), n_ments_on), | 4180 | html_checkbox("mentions_on", L("Mentions"), n_ments_on), |
| @@ -5568,7 +5575,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 5568 | 5575 | ||
| 5569 | eid = xs_strip_chars_i(eid, ":"); | 5576 | eid = xs_strip_chars_i(eid, ":"); |
| 5570 | 5577 | ||
| 5571 | const xs_dict *ret = msg_emoji_init(&snac, id, eid); | 5578 | xs *ret = msg_emoji_init(&snac, id, eid); |
| 5572 | /* fails if either invalid or already reacted */ | 5579 | /* fails if either invalid or already reacted */ |
| 5573 | if (!ret) | 5580 | if (!ret) |
| 5574 | ret = msg_emoji_unreact(&snac, id, eid); | 5581 | ret = msg_emoji_unreact(&snac, id, eid); |