2021-03-25 19:19:40 +00:00
|
|
|
use actix_web::web::Data;
|
|
|
|
use lemmy_api_common::community::CommunityResponse;
|
|
|
|
use lemmy_utils::ConnectionId;
|
2021-03-25 19:30:15 +00:00
|
|
|
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperationCrud};
|
2021-03-25 19:19:40 +00:00
|
|
|
|
|
|
|
mod create;
|
|
|
|
mod delete;
|
|
|
|
mod read;
|
|
|
|
mod update;
|
|
|
|
|
|
|
|
pub(in crate::community) fn send_community_websocket(
|
|
|
|
res: &CommunityResponse,
|
|
|
|
context: &Data<LemmyContext>,
|
|
|
|
websocket_id: Option<ConnectionId>,
|
2021-03-25 19:30:15 +00:00
|
|
|
op: UserOperationCrud,
|
2021-03-25 19:19:40 +00:00
|
|
|
) {
|
|
|
|
// Strip out the person id and subscribed when sending to others
|
|
|
|
let mut res_sent = res.clone();
|
|
|
|
res_sent.community_view.subscribed = false;
|
|
|
|
|
|
|
|
context.chat_server().do_send(SendCommunityRoomMessage {
|
|
|
|
op,
|
|
|
|
response: res_sent,
|
|
|
|
community_id: res.community_view.community.id,
|
|
|
|
websocket_id,
|
|
|
|
});
|
|
|
|
}
|