mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-12 21:10:22 +03:00
Don't show the full tree in notifications.
This commit is contained in:
parent
cb616d6eb5
commit
a050be9107
@ -937,6 +937,9 @@ void notify(snac *snac, xs_str *type, xs_str *utype, xs_str *actor, xs_dict *msg
|
||||
enqueue_telegram(body, bot, chat_id);
|
||||
|
||||
/* finally, store it in the notification folder */
|
||||
if (strcmp(type, "Follow") == 0)
|
||||
objid = xs_dict_get(msg, "id");
|
||||
|
||||
notify_add(snac, type, utype, actor, objid);
|
||||
}
|
||||
|
||||
|
26
html.c
26
html.c
@ -679,7 +679,8 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, const char *md5)
|
||||
}
|
||||
|
||||
|
||||
d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, const char *md5)
|
||||
d_char *html_entry(snac *snac, d_char *os, char *msg, int local,
|
||||
int level, const char *md5, int hide_children)
|
||||
{
|
||||
char *id = xs_dict_get(msg, "id");
|
||||
char *type = xs_dict_get(msg, "type");
|
||||
@ -922,6 +923,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, cons
|
||||
s = html_entry_controls(snac, s, msg, md5);
|
||||
|
||||
/** children **/
|
||||
if (!hide_children) {
|
||||
xs *children = object_children(id);
|
||||
int left = xs_list_len(children);
|
||||
|
||||
@ -955,7 +957,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, cons
|
||||
}
|
||||
|
||||
if (chd != NULL) {
|
||||
ss = html_entry(snac, ss, chd, local, level + 1, cmd5);
|
||||
ss = html_entry(snac, ss, chd, local, level + 1, cmd5, hide_children);
|
||||
n_children++;
|
||||
}
|
||||
else
|
||||
@ -973,6 +975,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, cons
|
||||
if (n_children)
|
||||
s = xs_str_cat(s, ss);
|
||||
}
|
||||
}
|
||||
|
||||
s = xs_str_cat(s, "</div>\n</div>\n");
|
||||
|
||||
@ -1015,7 +1018,7 @@ d_char *html_timeline(snac *snac, char *list, int local, int skip, int show, int
|
||||
if (!valid_status(timeline_get_by_md5(snac, v, &msg)))
|
||||
continue;
|
||||
|
||||
s = html_entry(snac, s, msg, local, 0, v);
|
||||
s = html_entry(snac, s, msg, local, 0, v, 0);
|
||||
}
|
||||
|
||||
s = xs_str_cat(s, "</div>\n");
|
||||
@ -1204,7 +1207,7 @@ xs_str *html_notifications(snac *snac)
|
||||
|
||||
xs *obj = NULL;
|
||||
const char *type = xs_dict_get(noti, "type");
|
||||
const char *id = xs_dict_get(noti, strcmp(type, "Follow") == 0 ? "actor" : "objid");
|
||||
const char *id = xs_dict_get(noti, "objid");
|
||||
|
||||
if (!valid_status(object_get(id, &obj)))
|
||||
continue;
|
||||
@ -1224,7 +1227,7 @@ xs_str *html_notifications(snac *snac)
|
||||
else {
|
||||
/* already seen notification */
|
||||
if (stage != NHDR_OLD) {
|
||||
xs *s1 = xs_fmt("<h2>%s</h2>\n", L("Older"));
|
||||
xs *s1 = xs_fmt("<h2>%s</h2>\n", L("Already seen"));
|
||||
s = xs_str_cat(s, s1);
|
||||
|
||||
stage = NHDR_OLD;
|
||||
@ -1233,11 +1236,20 @@ xs_str *html_notifications(snac *snac)
|
||||
|
||||
s = xs_str_cat(s, "<div>\n");
|
||||
|
||||
xs *s1 = xs_fmt("<p><b>%s</b>:</p>\n", strcmp("Create", type) == 0 ? "Mention" : type);
|
||||
xs *s1 = xs_fmt("<p><b>%s</b>:</p>\n", strcmp(type, "Create") == 0 ? "Mention" : type);
|
||||
s = xs_str_cat(s, s1);
|
||||
|
||||
if (strcmp(type, "Follow") == 0) {
|
||||
s = xs_str_cat(s, "<div class=\"snac-post\">\n");
|
||||
|
||||
s = html_msg_icon(snac, s, obj);
|
||||
|
||||
s = xs_str_cat(s, "</div>\n");
|
||||
}
|
||||
else {
|
||||
xs *md5 = xs_md5_hex(id, strlen(id));
|
||||
s = html_entry(snac, s, obj, 0, 0, md5);
|
||||
s = html_entry(snac, s, obj, 0, 0, md5, 1);
|
||||
}
|
||||
|
||||
s = xs_str_cat(s, "</div>\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user