]> Untitled Git - lemmy.git/commitdiff
Merge branch 'dev' into federation
authorDessalines <tyhou13@gmx.com>
Fri, 7 Feb 2020 17:34:14 +0000 (12:34 -0500)
committerDessalines <tyhou13@gmx.com>
Fri, 7 Feb 2020 17:34:14 +0000 (12:34 -0500)
1  2 
server/config/defaults.hjson
server/src/websocket/server.rs

Simple merge
index 0c606284537c4c6f3fa4de9b8edfca6d39a53a6d,bf3249e1ddada0aded6d99461b79815cb7772e77..7ba79e6c49dff70ef074ca773ba318bcf341ae5f
@@@ -518,17 -545,14 +563,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)?;