Also check for a non-empty in_reply_to in object_add().

This commit is contained in:
default 2022-11-24 08:18:51 +01:00
parent ecea10e11c
commit 42449d9cad

8
data.c
View file

@ -399,7 +399,7 @@ int object_add(const char *id, d_char *obj)
/* does this object has a parent? */ /* does this object has a parent? */
char *in_reply_to = xs_dict_get(obj, "inReplyTo"); char *in_reply_to = xs_dict_get(obj, "inReplyTo");
if (!xs_is_null(in_reply_to)) { if (!xs_is_null(in_reply_to) && *in_reply_to) {
/* update the children index of the parent */ /* update the children index of the parent */
xs *pfn = _object_fn(in_reply_to); xs *pfn = _object_fn(in_reply_to);
@ -412,7 +412,7 @@ int object_add(const char *id, d_char *obj)
else else
status = 500; status = 500;
srv_debug(2, xs_fmt("object_add %s %s %d", id, fn, status)); srv_debug(0, xs_fmt("object_add %s %s %d", id, fn, status));
return status; return status;
} }
@ -844,8 +844,10 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
msg = xs_dict_set(msg, "_snac", md); msg = xs_dict_set(msg, "_snac", md);
if ((ret = _timeline_write(snac, id, msg, parent, referrer))) if ((ret = _timeline_write(snac, id, msg, parent, referrer))) {
snac_debug(snac, 1, xs_fmt("timeline_add %s", id)); snac_debug(snac, 1, xs_fmt("timeline_add %s", id));
object_add(id, o_msg);
}
return ret; return ret;
} }