diff options
author | default <nobody@localhost> | 2024-04-11 05:22:40 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-04-11 05:22:40 +0200 |
commit | 21c0bdb6f2eccdc1d26b660e3a759ae7b23966de (patch) | |
tree | 97abd72cf182c8c8d97e947178233751807a8725 | |
parent | 877fb079f34f10c857c42cd04ffd0b5e0cd4ca69 (diff) |
Added Unlike and Unboost buttons to web interface.
-rw-r--r-- | html.c | 25 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 26 insertions, 0 deletions
@@ -1249,6 +1249,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const xs_html_add(form, html_button("like", L("Like"), L("Say you like this post"))); } + else { + /* not like it anymore */ + xs_html_add(form, + html_button("unlike", L("Unlike"), L("Nah don't like it that much"))); + } } else { if (is_pinned(snac, id)) @@ -1265,6 +1270,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const xs_html_add(form, html_button("boost", L("Boost"), L("Announce this post to your followers"))); } + else { + /* already boosted; add button to regret */ + xs_html_add(form, + html_button("unboost", L("Unboost"), L("I regret I boosted this"))); + } } if (strcmp(actor, snac->actor) != 0) { @@ -2947,6 +2957,21 @@ int html_post_handler(const xs_dict *req, const char *q_path, timeline_admire(&snac, xs_dict_get(msg, "object"), snac.actor, 0); } } + if (strcmp(action, L("Unlike")) == 0) { /** **/ + xs *msg = msg_repulsion(&snac, id, "Like"); + + if (msg != NULL) { + enqueue_message(&snac, msg); + } + } + else + if (strcmp(action, L("Unboost")) == 0) { /** **/ + xs *msg = msg_repulsion(&snac, id, "Announce"); + + if (msg != NULL) { + enqueue_message(&snac, msg); + } + } else if (strcmp(action, L("MUTE")) == 0) { /** **/ mute(&snac, actor); @@ -33,6 +33,7 @@ int usage(void) printf("actor {basedir} [{uid}] {url} Requests an actor\n"); printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n"); printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n"); + printf("unboost {basedir} {uid} {url} Unboosts a post\n"); printf("resetpwd {basedir} {uid} Resets the password of a user\n"); printf("ping {basedir} {uid} {actor} Pings an actor\n"); printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n"); |