about summary refs log tree commit diff
path: root/src/database
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2021-12-07 16:12:13 +0300
committerVika <vika@fireburn.ru>2021-12-07 16:12:13 +0300
commit6d853ace9419e9abaa5959f5dba6f51646dea09c (patch)
treec91e3ebf4f6493dfdc7cd069b633628d5254e8cd /src/database
parent87bd73fc619ae6a50d1c3871e92825328ea3e88f (diff)
downloadkittybox-6d853ace9419e9abaa5959f5dba6f51646dea09c.tar.zst
Add protected locations that are visible only to logged-in users
Diffstat (limited to 'src/database')
-rw-r--r--src/database/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database/mod.rs b/src/database/mod.rs
index 6a874ed..c0f9f29 100644
--- a/src/database/mod.rs
+++ b/src/database/mod.rs
@@ -187,7 +187,9 @@ pub fn filter_post(
             .unwrap_or(&empty_vec)
             .iter()
             .map(|i| i.as_str().unwrap().to_string());
-        if location_visibility == "private" && !author.any(|i| Some(i) == *user) {
+        if (location_visibility == "private" && !author.any(|i| Some(i) == *user))
+            || (location_visibility == "protected" && user.is_none())
+        {
             post["properties"]
                 .as_object_mut()
                 .unwrap()