From 3d400ca21d3ecdf3ac482ff50ae9a84d6a89c7c6 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 11 Feb 2021 14:53:17 +0100 Subject: [PATCH] Hide followed communities, except for own user (fixes #1303) --- crates/api/src/user.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/api/src/user.rs b/crates/api/src/user.rs index da2b8f30..93d40bda 100644 --- a/crates/api/src/user.rs +++ b/crates/api/src/user.rs @@ -563,10 +563,15 @@ impl Perform for GetUserDetails { }) .await??; - let follows = blocking(context.pool(), move |conn| { - CommunityFollowerView::for_user(conn, user_details_id) - }) - .await??; + let mut follows = vec![]; + if let Some(uid) = user_id { + if uid == user_details_id { + follows = blocking(context.pool(), move |conn| { + CommunityFollowerView::for_user(conn, user_details_id) + }) + .await??; + } + }; let moderates = blocking(context.pool(), move |conn| { CommunityModeratorView::for_user(conn, user_details_id) }) -- 2.44.1