X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fapi%2Fcommunity.rs;fp=server%2Fsrc%2Fapi%2Fcommunity.rs;h=7c8c93f14bd195736626c96aac0269e953c37196;hb=5c6258390c46159c16f49295314c6519215fc6ae;hp=8486861c4b38fb4d20a3aa3a355276b62997a8d1;hpb=b69524b498983da636b3a31f5acb74fbb1f13ab4;p=lemmy.git diff --git a/server/src/api/community.rs b/src/api/community.rs similarity index 97% rename from server/src/api/community.rs rename to src/api/community.rs index 8486861c..7c8c93f1 100644 --- a/server/src/api/community.rs +++ b/src/api/community.rs @@ -44,7 +44,7 @@ impl Perform for GetCommunity { async fn perform( &self, context: &Data, - websocket_id: Option, + _websocket_id: Option, ) -> Result { let data: &GetCommunity = &self; let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?; @@ -83,12 +83,6 @@ impl Perform for GetCommunity { Err(_e) => return Err(APIError::err("couldnt_find_community").into()), }; - if let Some(id) = websocket_id { - context - .chat_server() - .do_send(JoinCommunityRoom { community_id, id }); - } - let online = context .chat_server() .send(GetCommunityUsersOnline { community_id }) @@ -844,3 +838,25 @@ pub fn send_community_websocket( websocket_id, }); } + +#[async_trait::async_trait(?Send)] +impl Perform for CommunityJoin { + type Response = CommunityJoinResponse; + + async fn perform( + &self, + context: &Data, + websocket_id: Option, + ) -> Result { + let data: &CommunityJoin = &self; + + if let Some(ws_id) = websocket_id { + context.chat_server().do_send(JoinCommunityRoom { + community_id: data.community_id, + id: ws_id, + }); + } + + Ok(CommunityJoinResponse { joined: true }) + } +}