From 9395312079a333446c617aaaaf9ab375ace8a33e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 21 Sep 2020 09:35:13 -0500 Subject: [PATCH] Fixing remote subscribe result. Fixes #1144 --- src/api/community.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/community.rs b/src/api/community.rs index 77a945a64..c5199fe54 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, })