summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2024-03-07 09:29:01 +0100
committerGravatar default2024-03-07 09:29:01 +0100
commit7fe866d60de77e1accf56afb14724bcd2a00992f (patch)
treeb2e7bf17b7c916c230ee730857726212b590416e
parentMerge pull request 'Add defines for time to enable macos builds.' (#148) from... (diff)
downloadsnac2-7fe866d60de77e1accf56afb14724bcd2a00992f.tar.gz
snac2-7fe866d60de77e1accf56afb14724bcd2a00992f.tar.xz
snac2-7fe866d60de77e1accf56afb14724bcd2a00992f.zip
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,
1324 return NULL; 1324 return NULL;
1325 1325
1326 /* hidden? do nothing more for this conversation */ 1326 /* hidden? do nothing more for this conversation */
1327 if (user && is_hidden(user, id)) 1327 if (user && is_hidden(user, id)) {
1328 return NULL; 1328 xs *s1 = xs_fmt("%s_entry", md5);
1329
1330 /* return just an dummy anchor, to keep position after hitting 'Hide' */
1331 return xs_html_tag("div",
1332 xs_html_tag("a",
1333 xs_html_attr("name", s1)));
1334 }
1329 1335
1330 /* avoid too deep nesting, as it may be a loop */ 1336 /* avoid too deep nesting, as it may be a loop */
1331 if (level >= 256) 1337 if (level >= 256)
@@ -1356,8 +1362,14 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
1356 return NULL; 1362 return NULL;
1357 1363
1358 /* ignore muted morons immediately */ 1364 /* ignore muted morons immediately */
1359 if (user && is_muted(user, actor)) 1365 if (user && is_muted(user, actor)) {
1360 return NULL; 1366 xs *s1 = xs_fmt("%s_entry", md5);
1367
1368 /* return just an dummy anchor, to keep position after hitting 'MUTE' */
1369 return xs_html_tag("div",
1370 xs_html_tag("a",
1371 xs_html_attr("name", s1)));
1372 }
1361 1373
1362 if ((user == NULL || strcmp(actor, user->actor) != 0) 1374 if ((user == NULL || strcmp(actor, user->actor) != 0)
1363 && !valid_status(actor_get(actor, NULL))) 1375 && !valid_status(actor_get(actor, NULL)))