commit 21c0bdb
default
·
2024-04-11 03:22:40 +0000 UTC
parent 877fb07
Added Unlike and Unboost buttons to web interface.
M
html.c
+25,
-0
1@@ -1249,6 +1249,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const
2 xs_html_add(form,
3 html_button("like", L("Like"), L("Say you like this post")));
4 }
5+ else {
6+ /* not like it anymore */
7+ xs_html_add(form,
8+ html_button("unlike", L("Unlike"), L("Nah don't like it that much")));
9+ }
10 }
11 else {
12 if (is_pinned(snac, id))
13@@ -1265,6 +1270,11 @@ xs_html *html_entry_controls(snac *snac, char *actor, const xs_dict *msg, const
14 xs_html_add(form,
15 html_button("boost", L("Boost"), L("Announce this post to your followers")));
16 }
17+ else {
18+ /* already boosted; add button to regret */
19+ xs_html_add(form,
20+ html_button("unboost", L("Unboost"), L("I regret I boosted this")));
21+ }
22 }
23
24 if (strcmp(actor, snac->actor) != 0) {
25@@ -2947,6 +2957,21 @@ int html_post_handler(const xs_dict *req, const char *q_path,
26 timeline_admire(&snac, xs_dict_get(msg, "object"), snac.actor, 0);
27 }
28 }
29+ if (strcmp(action, L("Unlike")) == 0) { /** **/
30+ xs *msg = msg_repulsion(&snac, id, "Like");
31+
32+ if (msg != NULL) {
33+ enqueue_message(&snac, msg);
34+ }
35+ }
36+ else
37+ if (strcmp(action, L("Unboost")) == 0) { /** **/
38+ xs *msg = msg_repulsion(&snac, id, "Announce");
39+
40+ if (msg != NULL) {
41+ enqueue_message(&snac, msg);
42+ }
43+ }
44 else
45 if (strcmp(action, L("MUTE")) == 0) { /** **/
46 mute(&snac, actor);
M
main.c
+1,
-0
1@@ -33,6 +33,7 @@ int usage(void)
2 printf("actor {basedir} [{uid}] {url} Requests an actor\n");
3 printf("note {basedir} {uid} {text} [files...] Sends a note with optional attachments\n");
4 printf("boost|announce {basedir} {uid} {url} Boosts (announces) a post\n");
5+ printf("unboost {basedir} {uid} {url} Unboosts a post\n");
6 printf("resetpwd {basedir} {uid} Resets the password of a user\n");
7 printf("ping {basedir} {uid} {actor} Pings an actor\n");
8 printf("webfinger_s {basedir} {uid} {actor} Queries about an actor (@user@host or actor url)\n");