]> Untitled Git - lemmy.git/blobdiff - src/api/comment.rs
Isomorphic docker (#1124)
[lemmy.git] / src / api / comment.rs
similarity index 97%
rename from server/src/api/comment.rs
rename to src/api/comment.rs
index dd1970393187a99dd9f3646e87ebfb653f38d9d4..68481a40a4e38513a173bad9a2c7c64044ed7dc4 100644 (file)
@@ -8,10 +8,7 @@ use crate::{
     Perform,
   },
   apub::{ApubLikeableType, ApubObjectType},
-  websocket::{
-    messages::{JoinCommunityRoom, SendComment},
-    UserOperation,
-  },
+  websocket::{messages::SendComment, UserOperation},
   LemmyContext,
 };
 use actix_web::web::Data;
@@ -655,7 +652,7 @@ impl Perform for GetComments {
   async fn perform(
     &self,
     context: &Data<LemmyContext>,
-    websocket_id: Option<ConnectionId>,
+    _websocket_id: Option<ConnectionId>,
   ) -> Result<GetCommentsResponse, LemmyError> {
     let data: &GetComments = &self;
     let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
@@ -665,6 +662,7 @@ impl Perform for GetComments {
     let sort = SortType::from_str(&data.sort)?;
 
     let community_id = data.community_id;
+    let community_name = data.community_name.to_owned();
     let page = data.page;
     let limit = data.limit;
     let comments = blocking(context.pool(), move |conn| {
@@ -672,6 +670,7 @@ impl Perform for GetComments {
         .listing_type(type_)
         .sort(&sort)
         .for_community_id(community_id)
+        .for_community_name(community_name)
         .my_user_id(user_id)
         .page(page)
         .limit(limit)
@@ -683,18 +682,6 @@ impl Perform for GetComments {
       Err(_) => return Err(APIError::err("couldnt_get_comments").into()),
     };
 
-    if let Some(id) = websocket_id {
-      // You don't need to join the specific community room, bc this is already handled by
-      // GetCommunity
-      if data.community_id.is_none() {
-        // 0 is the "all" community
-        context.chat_server().do_send(JoinCommunityRoom {
-          community_id: 0,
-          id,
-        });
-      }
-    }
-
     Ok(GetCommentsResponse { comments })
   }
 }