summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-07-05 14:06:21 +0200
committerdefault <nobody@localhost>2023-07-05 14:06:21 +0200
commiteef3c419dd11f324e4817cda0282d727b18d41d3 (patch)
tree38773040304d0469a2d4479e74ac8f7fd578caee /html.c
parent57ba1d575fdd92adc61dc0498ba3bc271cd7aa6e (diff)
Posts can be pinned/unpinned from the web interface.
Diffstat (limited to 'html.c')
-rw-r--r--html.c24
1 files changed, 21 insertions, 3 deletions
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)) {
@@ -2090,6 +2098,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
}
}
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;
/* delete the cached timeline */