Show stray parents in the origin.

This commit is contained in:
default 2022-12-02 21:36:12 +01:00
parent adfc9217d7
commit 2614a8b3cb
2 changed files with 14 additions and 22 deletions

22
html.c
View File

@ -591,31 +591,21 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
}
}
}
else
if (strcmp(type, "Note") == 0) {
/* is the parent not here? */
char *parent = xs_dict_get(msg, "inReplyTo");
#if 0
if (!xs_is_null((p = xs_dict_get(meta, "parent"))) && *p) {
/* this may happen if any of the autor or the parent aren't here */
if (!xs_is_null(parent) && !object_here(parent)) {
xs *s1 = xs_fmt(
"<div class=\"snac-origin\">%s "
"<a href=\"%s\">»</a></div>\n",
L("in reply to"), p
L("in reply to"), parent
);
s = xs_str_cat(s, s1);
}
else
if (!xs_is_null((p = xs_dict_get(meta, "liked_by"))) &&
xs_list_in(p, snac->actor) != -1) {
/* we liked this */
xs *s1 = xs_fmt(
"<div class=\"snac-origin\">"
"<a href=\"%s\">%s</a> %s</a></div>",
snac->actor, xs_dict_get(snac->config, "name"), L("liked")
);
s = xs_str_cat(s, s1);
}
#endif
}
else
s = xs_str_cat(s, "<div class=\"snac-child\">\n");

2
snac.h
View File

@ -60,6 +60,7 @@ int index_first(const char *fn, char *buf, int size);
d_char *index_list(const char *fn, int max);
d_char *index_list_desc(const char *fn, int max);
int object_here_by_md5(char *id);
int object_here(char *id);
int object_get_by_md5(const char *md5, d_char **obj, const char *type);
int object_get(const char *id, d_char **obj, const char *type);
@ -69,6 +70,7 @@ int object_del_if_unref(const char *id);
d_char *object_children(const char *id);
d_char *object_likes(const char *id);
d_char *object_announces(const char *id);
int object_parent(const char *id, char *buf, int size);
int follower_add(snac *snac, const char *actor);
int follower_del(snac *snac, const char *actor);