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

34
html.c
View file

@ -591,31 +591,21 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
} }
} }
} }
#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 */
xs *s1 = xs_fmt(
"<div class=\"snac-origin\">%s "
"<a href=\"%s\">»</a></div>\n",
L("in reply to"), p
);
s = xs_str_cat(s, s1);
}
else else
if (!xs_is_null((p = xs_dict_get(meta, "liked_by"))) && if (strcmp(type, "Note") == 0) {
xs_list_in(p, snac->actor) != -1) { /* is the parent not here? */
/* we liked this */ char *parent = xs_dict_get(msg, "inReplyTo");
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); 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"), parent
);
s = xs_str_cat(s, s1);
}
} }
#endif
} }
else else
s = xs_str_cat(s, "<div class=\"snac-child\">\n"); 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(const char *fn, int max);
d_char *index_list_desc(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_here(char *id);
int object_get_by_md5(const char *md5, d_char **obj, const char *type); 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); 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_children(const char *id);
d_char *object_likes(const char *id); d_char *object_likes(const char *id);
d_char *object_announces(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_add(snac *snac, const char *actor);
int follower_del(snac *snac, const char *actor); int follower_del(snac *snac, const char *actor);