From 22217993d1a0cba4d419ddf2867e1751df9248bc Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 23 Aug 2024 18:24:31 +0300 Subject: Fix private posts with no defined audience not being shown in feeds --- src/database/postgres/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/database') diff --git a/src/database/postgres/mod.rs b/src/database/postgres/mod.rs index 3aef08e..1780672 100644 --- a/src/database/postgres/mod.rs +++ b/src/database/postgres/mod.rs @@ -373,9 +373,12 @@ WHERE ) OR ( - $3 != null AND ( - mf2['properties']['audience'] ? $3 - OR mf2['properties']['author'] ? $3 + $3 IS NOT NULL AND ( + (NOT (mf2['properties'] ? 'audience')) + OR + (mf2['properties']['audience'] ? $3) + OR + (mf2['properties']['author'] ? $3) ) ) ) @@ -385,7 +388,7 @@ LIMIT $2" ) .bind(url) .bind(limit as i64) - .bind(user.map(url::Url::to_string)) + .bind(user.map(url::Url::as_str)) .bind(cursor) .fetch_all(&mut *txn) .await -- cgit 1.4.1