From eef3c419dd11f324e4817cda0282d727b18d41d3 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 5 Jul 2023 14:06:21 +0200 Subject: Posts can be pinned/unpinned from the web interface. --- html.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'html.c') diff --git a/html.c b/html.c index ff0e6df..5118042 100644 --- a/html.c +++ b/html.c @@ -657,9 +657,17 @@ xs_str *html_entry_controls(snac *snac, xs_str *os, const xs_dict *msg, const ch s = xs_str_cat(s, s1); } - if (xs_list_in(likes, snac->md5) == -1) { - /* not already liked; add button */ - s = html_button(s, "like", L("Like")); + if (!xs_startswith(id, snac->actor)) { + if (xs_list_in(likes, snac->md5) == -1) { + /* not already liked; add button */ + s = html_button(s, "like", L("Like")); + } + } + else { + if (is_pinned(snac, id)) + s = html_button(s, "unpin", L("Unpin")); + else + s = html_button(s, "pin", L("Pin")); } if (is_msg_public(snac, msg)) { @@ -2089,6 +2097,16 @@ int html_post_handler(const xs_dict *req, const char *q_path, snac_log(&snac, xs_fmt("deleted entry %s", id)); } } + else + if (strcmp(action, L("Pin")) == 0) { /** **/ + pin(&snac, id); + timeline_touch(&snac); + } + else + if (strcmp(action, L("Unpin")) == 0) { /** **/ + unpin(&snac, id); + timeline_touch(&snac); + } else status = 404; -- cgit v1.2.3