Link to local if the child id is from this actor.

This commit is contained in:
default 2022-09-26 09:08:03 +02:00
parent 1c8878c3da
commit 74aef6994a
2 changed files with 6 additions and 6 deletions

View file

@ -71,7 +71,7 @@ int actor_request(snac *snac, char *actor, d_char **data)
}
void timeline_request(snac *snac, char *id)
void timeline_request(snac *snac, char *id, char *referrer)
/* ensures that an entry and its ancestors are in the timeline */
{
if (!xs_is_null(id)) {
@ -88,10 +88,10 @@ void timeline_request(snac *snac, char *id)
char *in_reply_to = xs_dict_get(object, "inReplyTo");
/* recurse! */
timeline_request(snac, in_reply_to);
timeline_request(snac, in_reply_to, referrer);
/* finally store */
timeline_add(snac, id, object, in_reply_to, NULL);
timeline_add(snac, id, object, in_reply_to, referrer);
}
}
}
@ -280,7 +280,7 @@ void process_message(snac *snac, char *msg, char *req)
char *id = xs_dict_get(object, "id");
char *in_reply_to = xs_dict_get(object, "inReplyTo");
timeline_request(snac, in_reply_to);
timeline_request(snac, in_reply_to, NULL);
if (timeline_add(snac, id, msg, in_reply_to, NULL))
snac_log(snac, xs_fmt("new 'Note' %s %s", actor, id));
@ -307,7 +307,7 @@ void process_message(snac *snac, char *msg, char *req)
if (xs_type(object) == XSTYPE_DICT)
object = xs_dict_get(object, "id");
timeline_request(snac, object);
timeline_request(snac, object, actor);
timeline_admire(snac, object, actor, 0);
snac_log(snac, xs_fmt("new 'Announce' %s %s", actor, object));

2
data.c
View file

@ -469,7 +469,7 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referr
/* try to do the same with the local */
xs *olfn = xs_replace(pfn, "/timeline/", "/local/");
if (unlink(olfn) != -1) {
if (unlink(olfn) != -1 || xs_startswith(id, snac->actor)) {
xs *nlfn = xs_replace(nfn, "/timeline/", "/local/");
link(nfn, nlfn);