commit 5321295005c898f401bf6485c97954845ad96b4c
parent d1a2a7438dddc898b794a7a9b3b0961afc1a36e4
Author: default <nobody@localhost>
Date: Mon, 26 Sep 2022 07:19:45 +0200
Resolve object id instead of discarding like or boost.
Diffstat:
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/activitypub.c b/activitypub.c
@@ -296,23 +296,21 @@ void process_message(snac *snac, char *msg, char *req)
else
*/
if (strcmp(type, "Like") == 0) {
- if (xs_type(object) == XSTYPE_STRING) {
- timeline_admire(snac, object, actor, 1);
- snac_log(snac, xs_fmt("new 'Like' %s %s", actor, object));
- }
- else
- snac_debug(snac, 2, xs_fmt("xs_type for 'Like' object not string"));
+ if (xs_type(object) == XSTYPE_DICT)
+ object = xs_dict_get(object, "id");
+
+ timeline_admire(snac, object, actor, 1);
+ snac_log(snac, xs_fmt("new 'Like' %s %s", actor, object));
}
else
if (strcmp(type, "Announce") == 0) {
- if (xs_type(object) == XSTYPE_STRING) {
- timeline_request(snac, object);
+ if (xs_type(object) == XSTYPE_DICT)
+ object = xs_dict_get(object, "id");
- timeline_admire(snac, object, actor, 0);
- snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
- }
- else
- snac_debug(snac, 2, xs_fmt("xs_type for 'Announce' object not string"));
+ timeline_request(snac, object);
+
+ timeline_admire(snac, object, actor, 0);
+ snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));
}
/*
else