summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/html.c b/html.c
index af054a7..9f5ca1d 100644
--- a/html.c
+++ b/html.c
@@ -4112,7 +4112,7 @@ void notify_filter(snac *user, const xs_dict *p_vars)
4112 int folreq_on = (v = xs_dict_get(p_vars, "folreqs_on")) ? strcmp(v, "on") == 0 : 0; 4112 int folreq_on = (v = xs_dict_get(p_vars, "folreqs_on")) ? strcmp(v, "on") == 0 : 0;
4113 int blocks_on = (v = xs_dict_get(p_vars, "blocks_on")) ? strcmp(v, "on") == 0 : 0; 4113 int blocks_on = (v = xs_dict_get(p_vars, "blocks_on")) ? strcmp(v, "on") == 0 : 0;
4114 int polls_on = (v = xs_dict_get(p_vars, "polls_on")) ? strcmp(v, "on") == 0 : 0; 4114 int polls_on = (v = xs_dict_get(p_vars, "polls_on")) ? strcmp(v, "on") == 0 : 0;
4115 xs_dict *filter = xs_dict_new(); 4115 xs *filter = xs_dict_new();
4116 filter = xs_dict_set(filter, "likes", xs_stock(likes_on ? XSTYPE_TRUE : XSTYPE_FALSE)); 4116 filter = xs_dict_set(filter, "likes", xs_stock(likes_on ? XSTYPE_TRUE : XSTYPE_FALSE));
4117 filter = xs_dict_set(filter, "reacts", xs_stock(reacts_on ? XSTYPE_TRUE : XSTYPE_FALSE)); 4117 filter = xs_dict_set(filter, "reacts", xs_stock(reacts_on ? XSTYPE_TRUE : XSTYPE_FALSE));
4118 filter = xs_dict_set(filter, "mentions", xs_stock(ments_on ? XSTYPE_TRUE : XSTYPE_FALSE)); 4118 filter = xs_dict_set(filter, "mentions", xs_stock(ments_on ? XSTYPE_TRUE : XSTYPE_FALSE));
@@ -4123,6 +4123,7 @@ void notify_filter(snac *user, const xs_dict *p_vars)
4123 filter = xs_dict_set(filter, "blocks", xs_stock(blocks_on ? XSTYPE_TRUE : XSTYPE_FALSE)); 4123 filter = xs_dict_set(filter, "blocks", xs_stock(blocks_on ? XSTYPE_TRUE : XSTYPE_FALSE));
4124 filter = xs_dict_set(filter, "polls", xs_stock(polls_on ? XSTYPE_TRUE : XSTYPE_FALSE)); 4124 filter = xs_dict_set(filter, "polls", xs_stock(polls_on ? XSTYPE_TRUE : XSTYPE_FALSE));
4125 user->config = xs_dict_set(user->config, "notify_filter", filter); 4125 user->config = xs_dict_set(user->config, "notify_filter", filter);
4126 user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz
4126} 4127}
4127 4128
4128xs_str *html_notifications(snac *user, int skip, int show) 4129xs_str *html_notifications(snac *user, int skip, int show)
@@ -4138,7 +4139,9 @@ xs_str *html_notifications(snac *user, int skip, int show)
4138 xs_html *body = html_user_body(user, 0); 4139 xs_html *body = html_user_body(user, 0);
4139 const xs_dict *n_filter = xs_dict_get(user->config, "notify_filter"); 4140 const xs_dict *n_filter = xs_dict_get(user->config, "notify_filter");
4140 if (!n_filter) { 4141 if (!n_filter) {
4141 user->config = xs_dict_set(user->config, "notify_filter", xs_dict_new()); 4142 xs *filter = xs_dict_new();
4143 user->config = xs_dict_set(user->config, "notify_filter", filter);
4144 user->tz = xs_dict_get_def(user->config, "tz", "UTC"); // previous line invalidates user->tz
4142 n_filter = xs_dict_get(user->config, "notify_filter"); 4145 n_filter = xs_dict_get(user->config, "notify_filter");
4143 } 4146 }
4144 xs *n_list = notify_filter_list(user, n_list_unfilt); 4147 xs *n_list = notify_filter_list(user, n_list_unfilt);
@@ -4159,6 +4162,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
4159 body); 4162 body);
4160 4163
4161 xs *filter_notifs_action = xs_fmt("%s/admin/filter-notifications", user->actor); 4164 xs *filter_notifs_action = xs_fmt("%s/admin/filter-notifications", user->actor);
4165 xs *notifs_action = xs_fmt("%s/notifications", user->actor);
4162 xs_html *notifs_form = xs_html_tag("form", 4166 xs_html *notifs_form = xs_html_tag("form",
4163 xs_html_attr("autocomplete", "off"), 4167 xs_html_attr("autocomplete", "off"),
4164 xs_html_attr("method", "post"), 4168 xs_html_attr("method", "post"),
@@ -4168,7 +4172,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
4168 xs_html_sctag("input", 4172 xs_html_sctag("input",
4169 xs_html_attr("type", "hidden"), 4173 xs_html_attr("type", "hidden"),
4170 xs_html_attr("name", "hard-redir"), 4174 xs_html_attr("name", "hard-redir"),
4171 xs_html_attr("value", xs_fmt("%s/notifications", user->actor))), 4175 xs_html_attr("value", notifs_action)),
4172 html_checkbox("likes_on", L("Likes"), n_likes_on), 4176 html_checkbox("likes_on", L("Likes"), n_likes_on),
4173 html_checkbox("reacts_on", L("Emoji reacts"), n_reacts_on), 4177 html_checkbox("reacts_on", L("Emoji reacts"), n_reacts_on),
4174 html_checkbox("mentions_on", L("Mentions"), n_ments_on), 4178 html_checkbox("mentions_on", L("Mentions"), n_ments_on),
@@ -5569,7 +5573,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
5569 5573
5570 eid = xs_strip_chars_i(eid, ":"); 5574 eid = xs_strip_chars_i(eid, ":");
5571 5575
5572 const xs_dict *ret = msg_emoji_init(&snac, id, eid); 5576 xs *ret = msg_emoji_init(&snac, id, eid);
5573 /* fails if either invalid or already reacted */ 5577 /* fails if either invalid or already reacted */
5574 if (!ret) 5578 if (!ret)
5575 ret = msg_emoji_unreact(&snac, id, eid); 5579 ret = msg_emoji_unreact(&snac, id, eid);