Fixed outbox to be an OrderedCollection of Create+Note, not Note.

This commit is contained in:
default 2023-07-29 15:29:11 +02:00
parent 7c393ef436
commit 368b1eb452

View file

@ -768,6 +768,7 @@ xs_dict *msg_base(snac *snac, const char *type, const char *id,
if (strcmp(id, "@wrapper") == 0) { if (strcmp(id, "@wrapper") == 0) {
/* like @object, but always generate the same id */ /* like @object, but always generate the same id */
if (object != NULL) { if (object != NULL) {
date = xs_dict_get(object, "published");
did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type); did = xs_fmt("%s/%s", xs_dict_get(object, "id"), type);
id = did; id = did;
} }
@ -945,7 +946,7 @@ xs_dict *msg_actor(snac *snac)
xs_dict *msg_create(snac *snac, const xs_dict *object) xs_dict *msg_create(snac *snac, const xs_dict *object)
/* creates a 'Create' message */ /* creates a 'Create' message */
{ {
xs_dict *msg = msg_base(snac, "Create", "@wrapper", snac->actor, "@now", object); xs_dict *msg = msg_base(snac, "Create", "@wrapper", snac->actor, NULL, object);
xs_val *v; xs_val *v;
if ((v = xs_dict_get(object, "attributedTo"))) if ((v = xs_dict_get(object, "attributedTo")))
@ -1992,8 +1993,8 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path,
char *id = xs_dict_get(i, "id"); char *id = xs_dict_get(i, "id");
if (type && id && strcmp(type, "Note") == 0 && xs_startswith(id, snac.actor)) { if (type && id && strcmp(type, "Note") == 0 && xs_startswith(id, snac.actor)) {
i = xs_dict_del(i, "_snac"); xs *c_msg = msg_create(&snac, i);
list = xs_list_append(list, i); list = xs_list_append(list, c_msg);
} }
} }
} }