Parcourir la source

New user toggle 'show_unlisted', to show unlisted posts in public pages and RSS feeds.

grunfink il y a 3 mois
Parent
commit
d704c796ff
2 fichiers modifiés avec 18 ajouts et 3 suppressions
  1. 10 2
      html.c
  2. 8 1
      rss.c

+ 10 - 2
html.c

@@ -3595,6 +3595,8 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
 
     int mark_shown = 0;
 
+    int show_unlisted = xs_is_true(xs_dict_get(user->config, "show_unlisted"));
+
     while (xs_list_iter(&p, &v)) {
         xs *msg = NULL;
         int status;
@@ -3651,9 +3653,15 @@ xs_str *html_timeline(snac *user, const xs_list *list, int read_only,
         /* hide non-public posts from /instance view */
         if (page != NULL && strcmp(page, "/instance") == 0 && scope != SCOPE_PUBLIC)
             continue;
+
         /* hide non-public posts viewed from outside */
-        if (read_only && (scope != SCOPE_PUBLIC && scope != SCOPE_UNLISTED))
-            continue;
+        if (read_only) {
+            if (scope == SCOPE_MENTIONED || scope == SCOPE_FOLLOWERS)
+                continue;
+
+            if (scope == SCOPE_UNLISTED && !show_unlisted)
+                continue;
+        }
 
         xs_html *entry = html_entry(user, msg, read_only, 0, v, (user && !hide_children) ? 0 : 1);
 

+ 8 - 1
rss.c

@@ -44,6 +44,8 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline,
     int cnt = 0;
     const char *v;
 
+    int show_unlisted = xs_is_true(xs_dict_get(user->config, "show_unlisted"));
+
     xs_list_foreach(timeline, v) {
         xs *msg = NULL;
 
@@ -66,7 +68,12 @@ xs_str *rss_from_timeline(snac *user, const xs_list *timeline,
         if (!id || !content || !published)
             continue;
 
-        if (!is_msg_public(msg))
+        int scope = get_msg_visibility(msg);
+
+        if (scope == SCOPE_MENTIONED || scope == SCOPE_FOLLOWERS)
+            continue;
+
+        if (scope == SCOPE_UNLISTED && !show_unlisted)
             continue;
 
         /* create a title with the first line of the content */