mirror of
https://codeberg.org/grunfink/snac2.git
synced 2025-02-16 16:05:00 +00:00
Always show who boosted something, not only when it's on level 0.
This commit is contained in:
parent
d00026ac06
commit
f205d20688
1 changed files with 42 additions and 43 deletions
85
html.c
85
html.c
|
@ -548,57 +548,43 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level == 0) {
|
if (level == 0)
|
||||||
s = xs_str_cat(s, "<div class=\"snac-post\">\n");
|
s = xs_str_cat(s, "<div class=\"snac-post\">\n");
|
||||||
|
else
|
||||||
|
s = xs_str_cat(s, "<div class=\"snac-child\">\n");
|
||||||
|
|
||||||
if (boosts == NULL)
|
if (boosts == NULL)
|
||||||
boosts = object_announces(id);
|
boosts = object_announces(id);
|
||||||
|
|
||||||
if (xs_list_len(boosts)) {
|
if (xs_list_len(boosts)) {
|
||||||
/* if somebody boosted this, show as origin */
|
/* if somebody boosted this, show as origin */
|
||||||
char *p = xs_list_get(boosts, -1);
|
char *p = xs_list_get(boosts, -1);
|
||||||
xs *actor_r = NULL;
|
xs *actor_r = NULL;
|
||||||
|
|
||||||
if (xs_list_in(boosts, snac->md5) != -1) {
|
if (xs_list_in(boosts, snac->md5) != -1) {
|
||||||
/* we boosted this */
|
/* we boosted this */
|
||||||
xs *s1 = xs_fmt(
|
xs *s1 = xs_fmt(
|
||||||
"<div class=\"snac-origin\">"
|
"<div class=\"snac-origin\">"
|
||||||
"<a href=\"%s\">%s</a> %s</a></div>",
|
"<a href=\"%s\">%s</a> %s</a></div>",
|
||||||
snac->actor, xs_dict_get(snac->config, "name"), L("boosted")
|
snac->actor, xs_dict_get(snac->config, "name"), L("boosted")
|
||||||
);
|
);
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
}
|
|
||||||
else
|
|
||||||
if (valid_status(object_get_by_md5(p, &actor_r, NULL))) {
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
if ((name = xs_dict_get(actor_r, "name")) == NULL)
|
|
||||||
name = xs_dict_get(actor_r, "preferredUsername");
|
|
||||||
|
|
||||||
if (!xs_is_null(name)) {
|
|
||||||
xs *s1 = xs_fmt(
|
|
||||||
"<div class=\"snac-origin\">"
|
|
||||||
"<a href=\"%s\">%s</a> %s</div>\n",
|
|
||||||
xs_dict_get(actor_r, "id"),
|
|
||||||
name,
|
|
||||||
L("boosted")
|
|
||||||
);
|
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(type, "Note") == 0) {
|
if (valid_status(object_get_by_md5(p, &actor_r, NULL))) {
|
||||||
/* is the parent not here? */
|
char *name;
|
||||||
char *parent = xs_dict_get(msg, "inReplyTo");
|
|
||||||
|
|
||||||
if (!xs_is_null(parent) && *parent && !object_here(parent)) {
|
if ((name = xs_dict_get(actor_r, "name")) == NULL)
|
||||||
|
name = xs_dict_get(actor_r, "preferredUsername");
|
||||||
|
|
||||||
|
if (!xs_is_null(name)) {
|
||||||
xs *s1 = xs_fmt(
|
xs *s1 = xs_fmt(
|
||||||
"<div class=\"snac-origin\">%s "
|
"<div class=\"snac-origin\">"
|
||||||
"<a href=\"%s\">»</a></div>\n",
|
"<a href=\"%s\">%s</a> %s</div>\n",
|
||||||
L("in reply to"), parent
|
xs_dict_get(actor_r, "id"),
|
||||||
|
name,
|
||||||
|
L("boosted")
|
||||||
);
|
);
|
||||||
|
|
||||||
s = xs_str_cat(s, s1);
|
s = xs_str_cat(s, s1);
|
||||||
|
@ -606,7 +592,20 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s = xs_str_cat(s, "<div class=\"snac-child\">\n");
|
if (strcmp(type, "Note") == 0) {
|
||||||
|
/* is the parent not here? */
|
||||||
|
char *parent = xs_dict_get(msg, "inReplyTo");
|
||||||
|
|
||||||
|
if (!xs_is_null(parent) && *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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s = html_msg_icon(snac, s, msg);
|
s = html_msg_icon(snac, s, msg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue