From: Dessalines Date: Fri, 7 Feb 2020 17:34:14 +0000 (-0500) Subject: Merge branch 'dev' into federation X-Git-Url: http://these/git/readmes/README.ja.md?a=commitdiff_plain;h=8130535af4e66e738fe8bf8dfc51db02f4389228;p=lemmy.git Merge branch 'dev' into federation --- 8130535af4e66e738fe8bf8dfc51db02f4389228 diff --cc server/src/websocket/server.rs index 0c606284,bf3249e1..7ba79e6c --- a/server/src/websocket/server.rs +++ b/server/src/websocket/server.rs @@@ -518,17 -545,14 +563,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)?;