summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-08-09 14:29:09 +0200
committerdefault <nobody@localhost>2023-08-09 14:29:09 +0200
commitb3797d24162bd2c8637d267ae0a08f3cd6e45dff (patch)
tree0fa22fac8b4846e85b5b18addf7eb2764dda86e8 /html.c
parent3e5bb109d14e194958a448a0e2feb55f685afaf2 (diff)
Implemented hide_followers_only.
Diffstat (limited to 'html.c')
-rw-r--r--html.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/html.c b/html.c
index 98ae4a5..0fe4ad8 100644
--- a/html.c
+++ b/html.c
@@ -843,9 +843,10 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
int sensitive = 0;
char *v;
xs *boosts = NULL;
+ int is_public = is_msg_public(snac, msg);
/* do not show non-public messages in the public timeline */
- if (local && !is_msg_public(snac, msg))
+ if (local && !is_public)
return os;
/* hidden? do nothing more for this conversation */
@@ -856,6 +857,20 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local,
if (level >= 256)
return os;
+ if (xs_type(xs_dict_get(snac->config, "hide_followers_only")) == XSTYPE_TRUE) {
+ /* test if this is a non-public message not explicitly for this user */
+ if (!is_public) {
+ const char *to = xs_dict_get(msg, "to");
+ const char *cc = xs_dict_get(msg, "cc");
+
+ if ((xs_is_null(to) || xs_list_in(to, snac->actor) == -1) &&
+ (xs_is_null(cc) || xs_list_in(cc, snac->actor) == -1)) {
+ snac_debug(snac, 0, xs_fmt("hidden message %s for followers only (%s)", id, md5));
+ return os;
+ }
+ }
+ }
+
xs *s = xs_str_new("<div>\n");
{