commit 06ba117
default
·
2025-01-28 09:04:23 +0000 UTC
parent bf07718
Some tweaks to the already seen mark code.
M
data.c
+17,
-1
1@@ -1532,7 +1532,23 @@ void timeline_add_mark(snac *user)
2 /* adds an "already seen" mark to the private timeline */
3 {
4 xs *fn = xs_fmt("%s/private.idx", user->basedir);
5- index_add_md5(fn, MD5_ALREADY_SEEN_MARK);
6+ char last_entry[MD5_HEX_SIZE] = "";
7+ FILE *f;
8+
9+ /* get the last entry in the index */
10+ if ((f = fopen(fn, "r")) != NULL) {
11+ index_desc_first(f, last_entry, 0);
12+ fclose(f);
13+ }
14+
15+ /* is the last entry *not* a mark? */
16+ if (strcmp(last_entry, MD5_ALREADY_SEEN_MARK) != 0) {
17+ /* add it */
18+ index_add_md5(fn, MD5_ALREADY_SEEN_MARK);
19+
20+ /* mark as new */
21+ timeline_touch(user);
22+ }
23 }
24
25
M
html.c
+2,
-2
1@@ -2657,7 +2657,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
2 /* "already seen" mark? */
3 if (strcmp(v, MD5_ALREADY_SEEN_MARK) == 0) {
4 if (skip == 0 && !mark_shown) {
5- xs *s = xs_fmt("%s/admin#top", user->actor);
6+ xs *s = xs_fmt("%s/admin", user->actor);
7
8 xs_html_add(posts,
9 xs_html_tag("div",
10@@ -2665,7 +2665,7 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
11 xs_html_text(L("No more unseen posts")),
12 xs_html_text(" - "),
13 xs_html_tag("a",
14- xs_html_attr("href", s),
15+ xs_html_attr("href", s),
16 xs_html_text(L("Back to top")))));
17 }
18