From: Dessalines Date: Mon, 21 Sep 2020 14:35:13 +0000 (-0500) Subject: Fixing remote subscribe result. Fixes #1144 X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%22https:/hacktivis.me/%7Bs.link%7D?a=commitdiff_plain;h=9395312079a333446c617aaaaf9ab375ace8a33e;p=lemmy.git Fixing remote subscribe result. Fixes #1144 --- diff --git a/src/api/community.rs b/src/api/community.rs index 77a945a6..c5199fe5 100644 --- a/src/api/community.rs +++ b/src/api/community.rs @@ -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, })