commit 8ea199a
default
·
2024-08-29 05:45:22 +0000 UTC
parent 0c3c79f
The list of bookmarked posts also work.
M
data.c
+7,
-0
1@@ -1583,6 +1583,13 @@ int unbookmark(snac *user, const char *id)
2 }
3
4
5+xs_list *bookmark_list(snac *user)
6+/* return the lists of bookmarked posts */
7+{
8+ return object_user_cache_list(user, "bookmark", XS_ALL, 1);
9+}
10+
11+
12 /** pinning **/
13
14 int is_pinned(snac *user, const char *id)
M
html.c
+15,
-0
1@@ -2925,6 +2925,21 @@ int html_get_handler(const xs_dict *req, const char *q_path,
2 }
3 }
4 else
5+ if (strcmp(p_path, "list/bookmarks") == 0) { /** list of bookmarked posts **/
6+ if (!login(&snac, req)) {
7+ *body = xs_dup(uid);
8+ status = HTTP_STATUS_UNAUTHORIZED;
9+ }
10+ else {
11+ xs *list = bookmark_list(&snac);
12+
13+ *body = html_timeline(&snac, list, 0, skip, show,
14+ 0, L("Bookmarked posts"), "", 0);
15+ *b_size = strlen(*body);
16+ status = HTTP_STATUS_OK;
17+ }
18+ }
19+ else
20 if (xs_startswith(p_path, "list/")) { /** list timelines **/
21 if (!login(&snac, req)) {
22 *body = xs_dup(uid);
M
snac.h
+1,
-0
1@@ -169,6 +169,7 @@ int is_muted(snac *snac, const char *actor);
2 int is_bookmarked(snac *user, const char *id);
3 int bookmark(snac *user, const char *id);
4 int unbookmark(snac *user, const char *id);
5+xs_list *bookmark_list(snac *user);
6
7 int pin(snac *user, const char *id);
8 int unpin(snac *user, const char *id);