The list of bookmarked posts also work.

This commit is contained in:
default 2024-08-29 07:45:22 +02:00
parent 0c3c79f0b9
commit 8ea199a996
3 changed files with 23 additions and 0 deletions

7
data.c
View File

@ -1583,6 +1583,13 @@ int unbookmark(snac *user, const char *id)
} }
xs_list *bookmark_list(snac *user)
/* return the lists of bookmarked posts */
{
return object_user_cache_list(user, "bookmark", XS_ALL, 1);
}
/** pinning **/ /** pinning **/
int is_pinned(snac *user, const char *id) int is_pinned(snac *user, const char *id)

15
html.c
View File

@ -2925,6 +2925,21 @@ int html_get_handler(const xs_dict *req, const char *q_path,
} }
} }
else else
if (strcmp(p_path, "list/bookmarks") == 0) { /** list of bookmarked posts **/
if (!login(&snac, req)) {
*body = xs_dup(uid);
status = HTTP_STATUS_UNAUTHORIZED;
}
else {
xs *list = bookmark_list(&snac);
*body = html_timeline(&snac, list, 0, skip, show,
0, L("Bookmarked posts"), "", 0);
*b_size = strlen(*body);
status = HTTP_STATUS_OK;
}
}
else
if (xs_startswith(p_path, "list/")) { /** list timelines **/ if (xs_startswith(p_path, "list/")) { /** list timelines **/
if (!login(&snac, req)) { if (!login(&snac, req)) {
*body = xs_dup(uid); *body = xs_dup(uid);

1
snac.h
View File

@ -169,6 +169,7 @@ int is_muted(snac *snac, const char *actor);
int is_bookmarked(snac *user, const char *id); int is_bookmarked(snac *user, const char *id);
int bookmark(snac *user, const char *id); int bookmark(snac *user, const char *id);
int unbookmark(snac *user, const char *id); int unbookmark(snac *user, const char *id);
xs_list *bookmark_list(snac *user);
int pin(snac *user, const char *id); int pin(snac *user, const char *id);
int unpin(snac *user, const char *id); int unpin(snac *user, const char *id);