summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorGravatar default2024-04-11 05:22:40 +0200
committerGravatar default2024-04-11 05:22:40 +0200
commit21c0bdb6f2eccdc1d26b660e3a759ae7b23966de (patch)
tree97abd72cf182c8c8d97e947178233751807a8725 /html.c
parentmastoapi: 'unfavourite' and 'unreblog' actions now fully work. (diff)
downloadsnac2-21c0bdb6f2eccdc1d26b660e3a759ae7b23966de.tar.gz
snac2-21c0bdb6f2eccdc1d26b660e3a759ae7b23966de.tar.xz
snac2-21c0bdb6f2eccdc1d26b660e3a759ae7b23966de.zip
Added Unlike and Unboost buttons to web interface.
Diffstat (limited to 'html.c')
-rw-r--r--html.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/html.c b/html.c
index 8813994..00c5113 100644
--- a/html.c
+++ b/html.c
@@ -1249,6 +1249,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const
1249 xs_html_add(form, 1249 xs_html_add(form,
1250 html_button("like", L("Like"), L("Say you like this post"))); 1250 html_button("like", L("Like"), L("Say you like this post")));
1251 } 1251 }
1252 else {
1253 /* not like it anymore */
1254 xs_html_add(form,
1255 html_button("unlike", L("Unlike"), L("Nah don't like it that much")));
1256 }
1252 } 1257 }
1253 else { 1258 else {
1254 if (is_pinned(snac, id)) 1259 if (is_pinned(snac, id))
@@ -1265,6 +1270,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const
1265 xs_html_add(form, 1270 xs_html_add(form,
1266 html_button("boost", L("Boost"), L("Announce this post to your followers"))); 1271 html_button("boost", L("Boost"), L("Announce this post to your followers")));
1267 } 1272 }
1273 else {
1274 /* already boosted; add button to regret */
1275 xs_html_add(form,
1276 html_button("unboost", L("Unboost"), L("I regret I boosted this")));
1277 }
1268 } 1278 }
1269 1279
1270 if (strcmp(actor, snac->actor) != 0) { 1280 if (strcmp(actor, snac->actor) != 0) {
@@ -2947,6 +2957,21 @@ int html_post_handler(const xs_dict *req, const char *q_path,
2947 timeline_admire(&snac, xs_dict_get(msg, "object"), snac.actor, 0); 2957 timeline_admire(&snac, xs_dict_get(msg, "object"), snac.actor, 0);
2948 } 2958 }
2949 } 2959 }
2960 if (strcmp(action, L("Unlike")) == 0) { /** **/
2961 xs *msg = msg_repulsion(&snac, id, "Like");
2962
2963 if (msg != NULL) {
2964 enqueue_message(&snac, msg);
2965 }
2966 }
2967 else
2968 if (strcmp(action, L("Unboost")) == 0) { /** **/
2969 xs *msg = msg_repulsion(&snac, id, "Announce");
2970
2971 if (msg != NULL) {
2972 enqueue_message(&snac, msg);
2973 }
2974 }
2950 else 2975 else
2951 if (strcmp(action, L("MUTE")) == 0) { /** **/ 2976 if (strcmp(action, L("MUTE")) == 0) { /** **/
2952 mute(&snac, actor); 2977 mute(&snac, actor);