community::{BanFromCommunity, BanFromCommunityResponse},
context::LemmyContext,
utils::{get_local_user_view_from_jwt, is_mod_or_admin, remove_user_data_in_community},
- websocket::{messages::SendCommunityRoomMessage, UserOperation},
+ websocket::UserOperation,
};
use lemmy_db_schema::{
source::{
},
traits::{Bannable, Crud, Followable},
};
-use lemmy_db_views_actor::structs::PersonViewSafe;
-use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
+use lemmy_db_views_actor::structs::PersonView;
+use lemmy_utils::{error::LemmyError, utils::time::naive_from_unix, ConnectionId};
#[async_trait::async_trait(?Send)]
impl Perform for BanFromCommunity {
ModBanFromCommunity::create(context.pool(), &form).await?;
let person_id = data.person_id;
- let person_view = PersonViewSafe::read(context.pool(), person_id).await?;
+ let person_view = PersonView::read(context.pool(), person_id).await?;
let res = BanFromCommunityResponse {
person_view,
banned: data.ban,
};
- context.chat_server().do_send(SendCommunityRoomMessage {
- op: UserOperation::BanFromCommunity,
- response: res.clone(),
- community_id,
- websocket_id,
- });
+ context
+ .chat_server()
+ .send_community_room_message(
+ &UserOperation::BanFromCommunity,
+ &res,
+ community_id,
+ websocket_id,
+ )
+ .await?;
Ok(res)
}