use actix_web::web::Data;
use lemmy_api_common::{
private_message::{EditPrivateMessage, PrivateMessageResponse},
use actix_web::web::Data;
use lemmy_api_common::{
private_message::{EditPrivateMessage, PrivateMessageResponse},
- utils::{blocking, get_local_user_view_from_jwt},
+ utils::{blocking, get_local_user_view_from_jwt, local_site_to_slur_regex},
};
use lemmy_apub::protocol::activities::{
create_or_update::private_message::CreateOrUpdatePrivateMessage,
CreateOrUpdateType,
};
};
use lemmy_apub::protocol::activities::{
create_or_update::private_message::CreateOrUpdatePrivateMessage,
CreateOrUpdateType,
};
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
let data: &EditPrivateMessage = self;
let local_user_view =
get_local_user_view_from_jwt(&data.auth, context.pool(), context.secret()).await?;
let data: &EditPrivateMessage = self;
let local_user_view =
get_local_user_view_from_jwt(&data.auth, context.pool(), context.secret()).await?;
let private_message_id = data.private_message_id;
let updated_private_message = blocking(context.pool(), move |conn| {
let private_message_id = data.private_message_id;
let updated_private_message = blocking(context.pool(), move |conn| {
- PrivateMessage::update_content(conn, private_message_id, &content_slurs_removed)
+ PrivateMessage::update(
+ conn,
+ private_message_id,
+ &PrivateMessageUpdateForm::builder()
+ .content(Some(content_slurs_removed))
+ .updated(Some(Some(naive_now())))
+ .build(),
+ )