]> Untitled Git - lemmy.git/commitdiff
Hide followed communities, except for own user (fixes #1303)
authorFelix Ableitner <me@nutomic.com>
Thu, 11 Feb 2021 13:53:17 +0000 (14:53 +0100)
committerFelix Ableitner <me@nutomic.com>
Thu, 11 Feb 2021 13:53:17 +0000 (14:53 +0100)
crates/api/src/user.rs

index da2b8f30ddbc3972e1a368ffdbd830786c1a09b4..93d40bdafc9527c9bbdd37a938c608e553448030 100644 (file)
@@ -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)
     })