commit d1add05
default
·
2023-06-28 18:36:23 +0000 UTC
parent 3559a0f
In mastoapi, notes can be pinned / unpinned.
1 files changed,
+10,
-3
+10,
-3
1@@ -863,7 +863,8 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
2 st = xs_dict_append(st, "poll", xs_stock_null);
3
4 st = xs_dict_append(st, "bookmarked", xs_stock_false);
5- st = xs_dict_append(st, "pinned", xs_stock_false);
6+
7+ st = xs_dict_append(st, "pinned", is_pinned(snac, id) ? xs_stock_true : xs_stock_false);
8
9 return st;
10 }
11@@ -1932,11 +1933,17 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
12 }
13 else
14 if (strcmp(op, "pin") == 0) { /** **/
15- /* snac does not support pinning */
16+ /* pin this message */
17+ if (pin(&snac, id))
18+ out = mastoapi_status(&snac, msg);
19+ else
20+ status = 422;
21 }
22 else
23 if (strcmp(op, "unpin") == 0) { /** **/
24- /* snac does not support pinning */
25+ /* unpin this message */
26+ unpin(&snac, id);
27+ out = mastoapi_status(&snac, msg);
28 }
29 else
30 if (strcmp(op, "mute") == 0) { /** **/