commit af6d31ff83bfe1eb6f4d37c5623e35f149e9aee5
parent 2614a8b3cbf55ab2a38ae2c81fe0081579495190
Author: default <nobody@localhost>
Date: Sat, 3 Dec 2022 07:27:26 +0100
New function timeline_simple_list().
Diffstat:
5 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
@@ -4,7 +4,7 @@
A big disk layout rework, to make it more efficient when timelines get very big. Please take note that you must run `snac upgrade` when you install this version over an already existing one.
-Fixed HTML loose close tag (contributed by kensata).
+Fixed HTML loose close tag (contributed by kensanata).
Fixed bug when closing sendmail pipe (contributed by jpgarcia and themusicgod1).
diff --git a/activitypub.c b/activitypub.c
@@ -1094,7 +1094,7 @@ int activitypub_get_handler(d_char *req, char *q_path,
else
if (strcmp(p_path, "outbox") == 0) {
xs *id = xs_fmt("%s/outbox", snac.actor);
- xs *elems = timeline_list(&snac, "public", 20);
+ xs *elems = timeline_simple_list(&snac, "public", 20);
xs *list = xs_list_new();
msg = msg_collection(&snac, id);
char *p, *v;
diff --git a/data.c b/data.c
@@ -839,8 +839,8 @@ d_char *timeline_top_level(d_char *list)
}
-d_char *timeline_list(snac *snac, const char *idx_name, int max)
-/* returns a timeline */
+d_char *timeline_simple_list(snac *snac, const char *idx_name, int max)
+/* returns a timeline (with all entries) */
{
int c_max;
@@ -851,8 +851,16 @@ d_char *timeline_list(snac *snac, const char *idx_name, int max)
if (max > c_max)
max = c_max;
- xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name);
- xs *list = index_list_desc(idx, max);
+ xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name);
+
+ return index_list_desc(idx, max);
+}
+
+
+d_char *timeline_list(snac *snac, const char *idx_name, int max)
+/* returns a timeline (only top level entries) */
+{
+ xs *list = timeline_simple_list(snac, idx_name, max);
return timeline_top_level(list);
}
diff --git a/html.c b/html.c
@@ -549,8 +549,6 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
}
if (level == 0) {
- char *p;
-
s = xs_str_cat(s, "<div class=\"snac-post\">\n");
if (boosts == NULL)
@@ -558,7 +556,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int
if (xs_list_len(boosts)) {
/* if somebody boosted this, show as origin */
- p = xs_list_get(boosts, 0);
+ char *p = xs_list_get(boosts, -1);
xs *actor_r = NULL;
if (xs_list_in(boosts, snac->md5) != -1) {
@@ -1096,7 +1094,7 @@ int html_get_handler(d_char *req, char *q_path, char **body, int *b_size, char *
if (strcmp(p_path, ".rss") == 0) {
/* public timeline in RSS format */
d_char *rss;
- xs *elems = timeline_list(&snac, "public", 20);
+ xs *elems = timeline_simple_list(&snac, "public", 20);
xs *bio = not_really_markdown(xs_dict_get(snac.config, "bio"));
char *p, *v;
diff --git a/snac.h b/snac.h
@@ -79,6 +79,7 @@ d_char *follower_list(snac *snac);
double timeline_mtime(snac *snac);
int timeline_del(snac *snac, char *id);
+d_char *timeline_simple_list(snac *snac, const char *idx_name, int max);
d_char *timeline_list(snac *snac, const char *idx_name, int max);
int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer);
void timeline_admire(snac *snac, char *o_msg, char *id, char *admirer, int like);