Perform,
},
apub::{ApubLikeableType, ApubObjectType},
- websocket::{
- messages::{JoinCommunityRoom, SendComment},
- UserOperation,
- },
+ websocket::{messages::SendComment, UserOperation},
LemmyContext,
};
use actix_web::web::Data;
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?;
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| {
.listing_type(type_)
.sort(&sort)
.for_community_id(community_id)
+ .for_community_name(community_name)
.my_user_id(user_id)
.page(page)
.limit(limit)
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 })
}
}