summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-03-07 09:29:01 +0100
committerdefault <nobody@localhost>2024-03-07 09:29:01 +0100
commit7fe866d60de77e1accf56afb14724bcd2a00992f (patch)
treeb2e7bf17b7c916c230ee730857726212b590416e
parentf28e52032215722dc6e0e3fe0543b9699d5a87bf (diff)
Returns empty anchors for hidden posts or muted actors.
This will help keeping the previous position after 'Hide' or 'MUTE'.
-rw-r--r--html.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/html.c b/html.c
index 8a21986..162a2da 100644
--- a/html.c
+++ b/html.c
@@ -1324,8 +1324,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
return NULL;
/* hidden? do nothing more for this conversation */
- if (user && is_hidden(user, id))
- return NULL;
+ if (user && is_hidden(user, id)) {
+ xs *s1 = xs_fmt("%s_entry", md5);
+
+ /* return just an dummy anchor, to keep position after hitting 'Hide' */
+ return xs_html_tag("div",
+ xs_html_tag("a",
+ xs_html_attr("name", s1)));
+ }
/* avoid too deep nesting, as it may be a loop */
if (level >= 256)
@@ -1356,8 +1362,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
return NULL;
/* ignore muted morons immediately */
- if (user && is_muted(user, actor))
- return NULL;
+ if (user && is_muted(user, actor)) {
+ xs *s1 = xs_fmt("%s_entry", md5);
+
+ /* return just an dummy anchor, to keep position after hitting 'MUTE' */
+ return xs_html_tag("div",
+ xs_html_tag("a",
+ xs_html_attr("name", s1)));
+ }
if ((user == NULL || strcmp(actor, user->actor) != 0)
&& !valid_status(actor_get(actor, NULL)))