diff options
author | default <nobody@localhost> | 2024-04-11 05:12:13 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-04-11 05:12:13 +0200 |
commit | 877fb079f34f10c857c42cd04ffd0b5e0cd4ca69 (patch) | |
tree | 356ff30c1bacb5850fcdb11b31935258bbcc856b | |
parent | 1a6bb79921b78f89dd975b5f6a7b3ad7d454a7b6 (diff) |
mastoapi: 'unfavourite' and 'unreblog' actions now fully work.
-rw-r--r-- | activitypub.c | 6 | ||||
-rw-r--r-- | mastoapi.c | 21 |
2 files changed, 17 insertions, 10 deletions
diff --git a/activitypub.c b/activitypub.c index afbe7af..9a23e14 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1186,11 +1186,11 @@ xs_dict *msg_repulsion(snac *user, char *id, char *type) /* copy the 'to' field */ msg = xs_dict_set(msg, "to", xs_dict_get(object, "to")); - - /* now we despise this */ - object_unadmire(id, user->actor, *type == 'L' ? 1 : 0); } + /* now we despise this */ + object_unadmire(id, user->actor, *type == 'L' ? 1 : 0); + return msg; } @@ -2314,11 +2314,13 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, } else if (strcmp(op, "unfavourite") == 0) { /** **/ - /* partial support: as the original Like message - is not stored anywhere here, it's not possible - to send an Undo + Like; the only thing done here - is to delete the actor from the list of likes */ - object_unadmire(id, snac.actor, 1); + xs *n_msg = msg_repulsion(&snac, id, "Like"); + + if (n_msg != NULL) { + enqueue_message(&snac, n_msg); + + out = mastoapi_status(&snac, msg); + } } else if (strcmp(op, "reblog") == 0) { /** **/ @@ -2333,8 +2335,13 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, } else if (strcmp(op, "unreblog") == 0) { /** **/ - /* partial support: see comment in 'unfavourite' */ - object_unadmire(id, snac.actor, 0); + xs *n_msg = msg_repulsion(&snac, id, "Announce"); + + if (n_msg != NULL) { + enqueue_message(&snac, n_msg); + + out = mastoapi_status(&snac, msg); + } } else if (strcmp(op, "bookmark") == 0) { /** **/ |