commit 67f0efa

default  ·  2024-08-29 05:57:29 +0000 UTC
parent 72c31c2
Added web UI for [un]bookmarking.
1 files changed,  +17, -0
M html.c
M html.c
+17, -0
 1@@ -1331,6 +1331,13 @@ xs_html *html_entry_controls(snac *snac, const char *actor,
 2         }
 3     }
 4 
 5+    if (is_bookmarked(snac, id))
 6+            xs_html_add(form,
 7+                html_button("unbookmark", L("Unbookmark"), L("Delete this post from your bookmarks")));
 8+        else
 9+            xs_html_add(form,
10+                html_button("bookmark", L("Bookmark"), L("Add this post to your bookmarks")));
11+
12     if (strcmp(actor, snac->actor) != 0) {
13         /* controls for other actors than this one */
14         if (following_check(snac, actor)) {
15@@ -3387,6 +3394,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
16             unpin(&snac, id);
17             timeline_touch(&snac);
18         }
19+        else
20+        if (strcmp(action, L("Bookmark")) == 0) { /** **/
21+            bookmark(&snac, id);
22+            timeline_touch(&snac);
23+        }
24+        else
25+        if (strcmp(action, L("Unbookmark")) == 0) { /** **/
26+            unbookmark(&snac, id);
27+            timeline_touch(&snac);
28+        }
29         else
30             status = HTTP_STATUS_NOT_FOUND;
31