]> Untitled Git - lemmy.git/commitdiff
Merge pull request 'Hide followed communities, except for own user (fixes #1303)...
authordessalines <dessalines@noreply.yerbamate.ml>
Thu, 11 Feb 2021 15:31:04 +0000 (15:31 +0000)
committerdessalines <dessalines@noreply.yerbamate.ml>
Thu, 11 Feb 2021 15:31:04 +0000 (15:31 +0000)
Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/168

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)
     })