use lemmy_api_common::{
context::LemmyContext,
private_message::{CreatePrivateMessage, EditPrivateMessage, PrivateMessageResponse},
- websocket::{send::send_pm_ws_message, UserOperationCrud},
};
use lemmy_db_schema::{
newtypes::PersonId,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
let recipient_id = private_message.recipient_id;
- let sender: ApubPerson = Person::read(context.pool(), sender_id).await?.into();
- let recipient: ApubPerson = Person::read(context.pool(), recipient_id).await?.into();
+ let sender: ApubPerson = Person::read(&mut context.pool(), sender_id).await?.into();
+ let recipient: ApubPerson = Person::read(&mut context.pool(), recipient_id)
+ .await?
+ .into();
let id = generate_activity_id(
kind.clone(),
#[tracing::instrument(skip_all)]
async fn receive(self, context: &Data<Self::DataType>) -> Result<(), LemmyError> {
insert_activity(&self.id, &self, false, true, context).await?;
- let private_message = ApubPrivateMessage::from_json(self.object, context).await?;
-
- let notif_type = match self.kind {
- CreateOrUpdateType::Create => UserOperationCrud::CreatePrivateMessage,
- CreateOrUpdateType::Update => UserOperationCrud::EditPrivateMessage,
- };
- send_pm_ws_message(private_message.id, notif_type, None, context).await?;
-
+ ApubPrivateMessage::from_json(self.object, context).await?;
Ok(())
}
}