]> Untitled Git - lemmy.git/commitdiff
Merge branch 'master' into federation
authorFelix <me@nutomic.com>
Fri, 28 Feb 2020 23:47:37 +0000 (00:47 +0100)
committerFelix <me@nutomic.com>
Fri, 28 Feb 2020 23:47:37 +0000 (00:47 +0100)
1  2 
server/config/defaults.hjson
server/src/websocket/server.rs

Simple merge
index 0c606284537c4c6f3fa4de9b8edfca6d39a53a6d,1cbcb34fb738ebd10e853d65a196fa10246b5e28..76a55540f887ea2b5fad8b444e48dcdaeb52d0d8
@@@ -518,17 -564,14 +582,20 @@@ fn parse_json_message(chat: &mut ChatSe
        to_json_string(&user_operation, &res)
      }
      UserOperation::ListCommunities => {
 -      do_user_operation::<ListCommunities, ListCommunitiesResponse>(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::<ListCommunities, ListCommunitiesResponse>(user_operation, data, &conn)
 +      }
      }
      UserOperation::CreateCommunity => {
-       chat.check_rate_limit_register(msg.id)?;
-       do_user_operation::<CreateCommunity, CommunityResponse>(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)?;