Browse Source

Added Unlike and Unboost buttons to web interface.

default 1 year ago
parent
commit
21c0bdb6f2
2 changed files with 26 additions and 0 deletions
  1. 25 0
      html.c
  2. 1 0
      main.c

+ 25 - 0
html.c

@@ -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);

+ 1 - 0
main.c

@@ -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");