commit 7fe866d

default  ·  2024-03-07 08:29:01 +0000 UTC
parent f28e520
Returns empty anchors for hidden posts or muted actors.

This will help keeping the previous position after 'Hide' or 'MUTE'.
1 files changed,  +16, -4
M html.c
M html.c
+16, -4
 1@@ -1324,8 +1324,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
 2         return NULL;
 3 
 4     /* hidden? do nothing more for this conversation */
 5-    if (user && is_hidden(user, id))
 6-        return NULL;
 7+    if (user && is_hidden(user, id)) {
 8+        xs *s1 = xs_fmt("%s_entry", md5);
 9+
10+        /* return just an dummy anchor, to keep position after hitting 'Hide' */
11+        return xs_html_tag("div",
12+            xs_html_tag("a",
13+                xs_html_attr("name", s1)));
14+    }
15 
16     /* avoid too deep nesting, as it may be a loop */
17     if (level >= 256)
18@@ -1356,8 +1362,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
19         return NULL;
20 
21     /* ignore muted morons immediately */
22-    if (user && is_muted(user, actor))
23-        return NULL;
24+    if (user && is_muted(user, actor)) {
25+        xs *s1 = xs_fmt("%s_entry", md5);
26+
27+        /* return just an dummy anchor, to keep position after hitting 'MUTE' */
28+        return xs_html_tag("div",
29+            xs_html_tag("a",
30+                xs_html_attr("name", s1)));
31+    }
32 
33     if ((user == NULL || strcmp(actor, user->actor) != 0)
34         && !valid_status(actor_get(actor, NULL)))