]> Untitled Git - lemmy.git/commitdiff
Fixing remote subscribe result. Fixes #1144
authorDessalines <tyhou13@gmx.com>
Mon, 21 Sep 2020 14:35:13 +0000 (09:35 -0500)
committerDessalines <tyhou13@gmx.com>
Mon, 21 Sep 2020 14:35:13 +0000 (09:35 -0500)
src/api/community.rs

index 77a945a644a7c5c1df96e4d8cf6a8b35aa4f42d5..c5199fe54b72ce32c26c71a81d9a84fc87baf6f4 100644 (file)
@@ -495,15 +495,21 @@ impl Perform for FollowCommunity {
         return Err(APIError::err("community_follower_already_exists").into());
       }
     }
-    // TODO: this needs to return a "pending" state, until Accept is received from the remote server
 
     let community_id = data.community_id;
     let user_id = user.id;
-    let community_view = blocking(context.pool(), move |conn| {
+    let mut community_view = blocking(context.pool(), move |conn| {
       CommunityView::read(conn, community_id, Some(user_id))
     })
     .await??;
 
+    // TODO: this needs to return a "pending" state, until Accept is received from the remote server
+    // For now, just assume that remote follows are accepted.
+    // Otherwise, the subscribed will be null
+    if !community.local {
+      community_view.subscribed = Some(data.follow);
+    }
+
     Ok(CommunityResponse {
       community: community_view,
     })