1 use lemmy_api_common::{blocking, post::PostResponse};
2 use lemmy_db_schema::PostId;
3 use lemmy_db_views::post_view::PostView;
4 use lemmy_utils::LemmyError;
5 use lemmy_websocket::{messages::SendPost, LemmyContext};
7 pub mod create_or_update;
9 pub(crate) async fn send_websocket_message<
10 OP: ToString + Send + lemmy_websocket::OperationType + 'static,
14 context: &LemmyContext,
15 ) -> Result<(), LemmyError> {
16 let post_view = blocking(context.pool(), move |conn| {
17 PostView::read(conn, post_id, None)
21 let res = PostResponse { post_view };
23 context.chat_server().do_send(SendPost {