From: Felix Date: Fri, 28 Feb 2020 23:47:37 +0000 (+0100) Subject: Merge branch 'master' into federation X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/%22%7Burl%7D/%24%7Bargs.pageFn.jump%20n%7D?a=commitdiff_plain;h=f9443dfbd3d542676385f37f68b60b0a61b48b2e;p=lemmy.git Merge branch 'master' into federation --- f9443dfbd3d542676385f37f68b60b0a61b48b2e diff --cc server/src/websocket/server.rs index 0c606284,1cbcb34f..76a55540 --- a/server/src/websocket/server.rs +++ b/server/src/websocket/server.rs @@@ -518,17 -564,14 +582,20 @@@ fn parse_json_message(chat: &mut ChatSe to_json_string(&user_operation, &res) } UserOperation::ListCommunities => { - do_user_operation::(user_operation, data, &conn) + if Settings::get().federation_enabled { + let res = get_all_communities()?; + let val = ListCommunitiesResponse { communities: res }; + to_json_string(&user_operation, &val) + } else { + do_user_operation::(user_operation, data, &conn) + } } UserOperation::CreateCommunity => { - chat.check_rate_limit_register(msg.id)?; - do_user_operation::(user_operation, data, &conn) + chat.check_rate_limit_register(msg.id, true)?; + let create_community: CreateCommunity = serde_json::from_str(data)?; + let res = Oper::new(create_community).perform(&conn)?; + chat.check_rate_limit_register(msg.id, false)?; + to_json_string(&user_operation, &res) } UserOperation::EditCommunity => { let edit_community: EditCommunity = serde_json::from_str(data)?;