convert private message handlers

This commit is contained in:
Felix Ableitner 2021-06-24 04:17:46 +02:00
parent dfce4b67ca
commit 350ef7c2c6
14 changed files with 341 additions and 329 deletions

View file

@ -1,6 +1,4 @@
use activitystreams::{
error::DomainError,
};
use activitystreams::error::DomainError;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use std::marker::PhantomData;

View file

@ -1,157 +1,14 @@
use crate::activities::receive::verify_activity_domains_valid;
use activitystreams::{
activity::{ActorAndObjectRefExt, Delete, Undo, Update},
base::{AsBase, ExtendsExt},
object::AsObject,
public,
};
use activitystreams::{activity::ActorAndObjectRefExt, base::AsBase, object::AsObject, public};
use anyhow::{anyhow, Context};
use lemmy_api_common::{blocking, person::PrivateMessageResponse};
use lemmy_apub::{
check_is_apub_id_valid,
fetcher::person::get_or_fetch_and_upsert_person,
get_activity_to_and_cc,
objects::FromApub,
NoteExt,
};
use lemmy_db_queries::source::private_message::PrivateMessage_;
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_db_views::{local_user_view::LocalUserView, private_message_view::PrivateMessageView};
use lemmy_utils::{location_info, LemmyError};
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperationCrud};
use url::Url;
pub(crate) async fn receive_update_private_message(
context: &LemmyContext,
update: Update,
expected_domain: Url,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
check_private_message_activity_valid(&update, context, request_counter).await?;
let object = update
.object()
.as_one()
.context(location_info!())?
.to_owned();
let note = NoteExt::from_any_base(object)?.context(location_info!())?;
let private_message =
PrivateMessage::from_apub(&note, context, expected_domain, request_counter, false).await?;
let private_message_id = private_message.id;
let message = blocking(&context.pool(), move |conn| {
PrivateMessageView::read(conn, private_message_id)
})
.await??;
let res = PrivateMessageResponse {
private_message_view: message,
};
let recipient_id = res.private_message_view.recipient.id;
let local_recipient_id = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, recipient_id)
})
.await??
.local_user
.id;
context.chat_server().do_send(SendUserRoomMessage {
op: UserOperationCrud::EditPrivateMessage,
response: res,
local_recipient_id,
websocket_id: None,
});
Ok(())
}
pub(crate) async fn receive_delete_private_message(
context: &LemmyContext,
delete: Delete,
private_message: PrivateMessage,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
check_private_message_activity_valid(&delete, context, request_counter).await?;
let deleted_private_message = blocking(context.pool(), move |conn| {
PrivateMessage::update_deleted(conn, private_message.id, true)
})
.await??;
let message = blocking(&context.pool(), move |conn| {
PrivateMessageView::read(&conn, deleted_private_message.id)
})
.await??;
let res = PrivateMessageResponse {
private_message_view: message,
};
let recipient_id = res.private_message_view.recipient.id;
let local_recipient_id = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, recipient_id)
})
.await??
.local_user
.id;
context.chat_server().do_send(SendUserRoomMessage {
op: UserOperationCrud::EditPrivateMessage,
response: res,
local_recipient_id,
websocket_id: None,
});
Ok(())
}
pub(crate) async fn receive_undo_delete_private_message(
context: &LemmyContext,
undo: Undo,
expected_domain: &Url,
private_message: PrivateMessage,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
check_private_message_activity_valid(&undo, context, request_counter).await?;
let object = undo.object().to_owned().one().context(location_info!())?;
let delete = Delete::from_any_base(object)?.context(location_info!())?;
verify_activity_domains_valid(&delete, expected_domain, true)?;
check_private_message_activity_valid(&delete, context, request_counter).await?;
let deleted_private_message = blocking(context.pool(), move |conn| {
PrivateMessage::update_deleted(conn, private_message.id, false)
})
.await??;
let message = blocking(&context.pool(), move |conn| {
PrivateMessageView::read(&conn, deleted_private_message.id)
})
.await??;
let res = PrivateMessageResponse {
private_message_view: message,
};
let recipient_id = res.private_message_view.recipient.id;
let local_recipient_id = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, recipient_id)
})
.await??
.local_user
.id;
context.chat_server().do_send(SendUserRoomMessage {
op: UserOperationCrud::EditPrivateMessage,
response: res,
local_recipient_id,
websocket_id: None,
});
Ok(())
}
use lemmy_websocket::LemmyContext;
// TODO: which of this do we still need?
async fn check_private_message_activity_valid<T, Kind>(
activity: &T,
context: &LemmyContext,

View file

@ -1,75 +0,0 @@
use url::Url;
use lemmy_apub::NoteExt;
use activitystreams::
activity::kind::{CreateType};
use lemmy_websocket::{LemmyContext, UserOperationCrud};
use lemmy_utils::LemmyError;
use lemmy_db_views::comment_view::CommentView;
use lemmy_api_common::comment::CommentResponse;
use lemmy_websocket::messages::SendComment;
use lemmy_api_common::{send_local_notifs, blocking};
use lemmy_db_schema::source::comment::Comment;
use lemmy_apub::objects::FromApub;
use lemmy_utils::utils::scrape_text_for_mentions;
use lemmy_db_schema::source::post::Post;
use lemmy_db_queries::Crud;
use lemmy_apub::fetcher::person::get_or_fetch_and_upsert_person;
use lemmy_apub_lib::{PublicUrl, ReceiveActivity};
use crate::inbox::new_inbox_routing::Activity;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CreateComment {
actor: Url,
to: PublicUrl,
object: NoteExt,
#[serde(rename = "type")]
kind: CreateType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<CreateComment> {
async fn receive(&self, context: &LemmyContext, request_counter: &mut i32) -> Result<(), LemmyError> {
let comment =
Comment::from_apub(&self.inner.object, context, self.inner.actor.clone(), request_counter, false).await?;
let post_id = comment.post_id;
let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
let actor = get_or_fetch_and_upsert_person(&self.inner.actor, context, request_counter).await?;
// Note:
// Although mentions could be gotten from the post tags (they are included there), or the ccs,
// Its much easier to scrape them from the comment body, since the API has to do that
// anyway.
let mentions = scrape_text_for_mentions(&comment.content);
let recipient_ids = send_local_notifs(
mentions,
comment.clone(),
actor,
post,
context.pool(),
true,
)
.await?;
// Refetch the view
let comment_view = blocking(context.pool(), move |conn| {
CommentView::read(conn, comment.id, None)
})
.await??;
let res = CommentResponse {
comment_view,
recipient_ids,
form_id: None,
};
context.chat_server().do_send(SendComment {
op: UserOperationCrud::CreateComment,
comment: res,
websocket_id: None,
});
Ok(())
}
}

View file

@ -0,0 +1,71 @@
use crate::inbox::new_inbox_routing::Activity;
use activitystreams::activity::kind::CreateType;
use lemmy_api_common::{blocking, comment::CommentResponse, send_local_notifs};
use lemmy_apub::{fetcher::person::get_or_fetch_and_upsert_person, objects::FromApub, NoteExt};
use lemmy_apub_lib::{PublicUrl, ReceiveActivity};
use lemmy_db_queries::Crud;
use lemmy_db_schema::source::{comment::Comment, post::Post};
use lemmy_db_views::comment_view::CommentView;
use lemmy_utils::{utils::scrape_text_for_mentions, LemmyError};
use lemmy_websocket::{messages::SendComment, LemmyContext, UserOperationCrud};
use url::Url;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CreateComment {
actor: Url,
to: PublicUrl,
object: NoteExt,
#[serde(rename = "type")]
kind: CreateType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<CreateComment> {
async fn receive(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
let comment = Comment::from_apub(
&self.inner.object,
context,
self.inner.actor.clone(),
request_counter,
false,
)
.await?;
let post_id = comment.post_id;
let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
let actor = get_or_fetch_and_upsert_person(&self.inner.actor, context, request_counter).await?;
// Note:
// Although mentions could be gotten from the post tags (they are included there), or the ccs,
// Its much easier to scrape them from the comment body, since the API has to do that
// anyway.
let mentions = scrape_text_for_mentions(&comment.content);
let recipient_ids =
send_local_notifs(mentions, comment.clone(), actor, post, context.pool(), true).await?;
// Refetch the view
let comment_view = blocking(context.pool(), move |conn| {
CommentView::read(conn, comment.id, None)
})
.await??;
let res = CommentResponse {
comment_view,
recipient_ids,
form_id: None,
};
context.chat_server().do_send(SendComment {
op: UserOperationCrud::CreateComment,
comment: res,
websocket_id: None,
});
Ok(())
}
}

View file

@ -0,0 +1 @@
pub mod create;

View file

@ -1,22 +1,20 @@
use activitystreams::{
activity::kind::{AcceptType, FollowType},
};
use crate::inbox::new_inbox_routing::Activity;
use activitystreams::activity::kind::{AcceptType, FollowType};
use lemmy_api_common::blocking;
use lemmy_apub::fetcher::{
community::get_or_fetch_and_upsert_community,
person::get_or_fetch_and_upsert_person,
};
use lemmy_apub_lib::{verify_domains_match, ReceiveActivity};
use lemmy_db_queries::Followable;
use lemmy_db_schema::source::community::CommunityFollower;
use lemmy_utils::{LemmyError};
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
use lemmy_apub_lib::{ReceiveActivity, verify_domains_match};
use crate::inbox::new_inbox_routing::Activity;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Follow {
pub struct FollowCommunity {
actor: Url,
to: Url,
object: Url,
@ -25,7 +23,7 @@ pub struct Follow {
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<Follow> {
impl ReceiveActivity for Activity<FollowCommunity> {
async fn receive(
&self,
_context: &LemmyContext,
@ -38,17 +36,17 @@ impl ReceiveActivity for Activity<Follow> {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Accept {
pub struct AcceptFollowCommunity {
actor: Url,
to: Url,
object: Activity<Follow>,
object: Activity<FollowCommunity>,
#[serde(rename = "type")]
kind: AcceptType,
}
/// Handle accepted follows
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<Accept> {
impl ReceiveActivity for Activity<AcceptFollowCommunity> {
async fn receive(
&self,
context: &LemmyContext,

View file

@ -1,65 +0,0 @@
use activitystreams::activity::kind::CreateType;
use lemmy_api_common::{blocking, person::PrivateMessageResponse};
use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_db_views::{local_user_view::LocalUserView, private_message_view::PrivateMessageView};
use lemmy_utils::LemmyError;
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperationCrud};
use url::Url;
use lemmy_apub_lib::{ReceiveActivity};
use crate::inbox::new_inbox_routing::Activity;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CreatePrivateMessage {
actor: Url,
to: Url,
object: NoteExt,
#[serde(rename = "type")]
kind: CreateType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<CreatePrivateMessage> {
async fn receive(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
let private_message = PrivateMessage::from_apub(
&self.inner.object,
context,
self.inner.actor.clone(),
request_counter,
false,
)
.await?;
let message = blocking(&context.pool(), move |conn| {
PrivateMessageView::read(conn, private_message.id)
})
.await??;
let res = PrivateMessageResponse {
private_message_view: message,
};
// Send notifications to the local recipient, if one exists
let recipient_id = res.private_message_view.recipient.id;
let local_recipient_id = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, recipient_id)
})
.await??
.local_user
.id;
context.chat_server().do_send(SendUserRoomMessage {
op: UserOperationCrud::CreatePrivateMessage,
response: res,
local_recipient_id,
websocket_id: None,
});
Ok(())
}
}

View file

@ -0,0 +1,45 @@
use crate::{
activities_new::private_message::send_websocket_message,
inbox::new_inbox_routing::Activity,
};
use activitystreams::activity::kind::CreateType;
use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{verify_domains_match, ReceiveActivity};
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CreatePrivateMessage {
actor: Url,
to: Url,
object: NoteExt,
#[serde(rename = "type")]
kind: CreateType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<CreatePrivateMessage> {
async fn receive(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_domains_match(&self.inner.actor, self.id_unchecked())?;
let private_message = PrivateMessage::from_apub(
&self.inner.object,
context,
self.inner.actor.clone(),
request_counter,
false,
)
.await?;
send_websocket_message(private_message.id, context).await?;
Ok(())
}
}

View file

@ -0,0 +1,48 @@
use crate::{
activities_new::private_message::send_websocket_message,
inbox::new_inbox_routing::Activity,
};
use activitystreams::activity::kind::DeleteType;
use lemmy_api_common::blocking;
use lemmy_apub_lib::{verify_domains_match, ReceiveActivity};
use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject};
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DeletePrivateMessage {
pub(in crate::activities_new::private_message) actor: Url,
to: Url,
pub(in crate::activities_new::private_message) object: Url,
#[serde(rename = "type")]
kind: DeleteType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<DeletePrivateMessage> {
async fn receive(
&self,
context: &LemmyContext,
_request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_domains_match(&self.inner.actor, self.id_unchecked())?;
verify_domains_match(&self.inner.actor, &self.inner.object)?;
let ap_id = self.inner.object.clone();
let private_message = blocking(context.pool(), move |conn| {
PrivateMessage::read_from_apub_id(conn, &ap_id.into())
})
.await??;
let deleted_private_message = blocking(context.pool(), move |conn| {
PrivateMessage::update_deleted(conn, private_message.id, true)
})
.await??;
send_websocket_message(deleted_private_message.id, context).await?;
Ok(())
}
}

View file

@ -0,0 +1,41 @@
use lemmy_api_common::{blocking, person::PrivateMessageResponse};
use lemmy_db_schema::PrivateMessageId;
use lemmy_db_views::{local_user_view::LocalUserView, private_message_view::PrivateMessageView};
use lemmy_utils::LemmyError;
use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperationCrud};
pub mod create;
pub mod delete;
pub mod undo_delete;
pub mod update;
async fn send_websocket_message(
private_message_id: PrivateMessageId,
context: &LemmyContext,
) -> Result<(), LemmyError> {
let message = blocking(&context.pool(), move |conn| {
PrivateMessageView::read(conn, private_message_id)
})
.await??;
let res = PrivateMessageResponse {
private_message_view: message,
};
// Send notifications to the local recipient, if one exists
let recipient_id = res.private_message_view.recipient.id;
let local_recipient_id = blocking(context.pool(), move |conn| {
LocalUserView::read_person(conn, recipient_id)
})
.await??
.local_user
.id;
context.chat_server().do_send(SendUserRoomMessage {
op: UserOperationCrud::CreatePrivateMessage,
response: res,
local_recipient_id,
websocket_id: None,
});
Ok(())
}

View file

@ -0,0 +1,50 @@
use crate::{
activities_new::private_message::{delete::DeletePrivateMessage, send_websocket_message},
inbox::new_inbox_routing::Activity,
};
use activitystreams::activity::kind::UndoType;
use lemmy_api_common::blocking;
use lemmy_apub_lib::{verify_domains_match, ReceiveActivity};
use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject};
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct UndoDeletePrivateMessage {
actor: Url,
to: Url,
object: Activity<DeletePrivateMessage>,
#[serde(rename = "type")]
kind: UndoType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<UndoDeletePrivateMessage> {
async fn receive(
&self,
context: &LemmyContext,
_request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_domains_match(&self.inner.actor, self.id_unchecked())?;
verify_domains_match(&self.inner.actor, &self.inner.object.id_unchecked())?;
verify_domains_match(&self.inner.actor, &self.inner.object.inner.actor)?;
let ap_id = self.inner.object.inner.object.clone();
let private_message = blocking(context.pool(), move |conn| {
PrivateMessage::read_from_apub_id(conn, &ap_id.into())
})
.await??;
let deleted_private_message = blocking(context.pool(), move |conn| {
PrivateMessage::update_deleted(conn, private_message.id, false)
})
.await??;
send_websocket_message(deleted_private_message.id, context).await?;
Ok(())
}
}

View file

@ -0,0 +1,45 @@
use crate::{
activities_new::private_message::send_websocket_message,
inbox::new_inbox_routing::Activity,
};
use activitystreams::activity::kind::UpdateType;
use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{verify_domains_match, ReceiveActivity};
use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use url::Url;
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct UpdatePrivateMessage {
actor: Url,
to: Url,
object: NoteExt,
#[serde(rename = "type")]
kind: UpdateType,
}
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for Activity<UpdatePrivateMessage> {
async fn receive(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_domains_match(&self.inner.actor, self.id_unchecked())?;
let private_message = PrivateMessage::from_apub(
&self.inner.object,
context,
self.inner.actor.clone(),
request_counter,
false,
)
.await?;
send_websocket_message(private_message.id, context).await?;
Ok(())
}
}

View file

@ -1,13 +1,18 @@
use crate::activities_new::follow::Accept;
use crate::activities_new::{
comment::create::CreateComment,
follow::AcceptFollowCommunity,
private_message::{
create::CreatePrivateMessage,
delete::DeletePrivateMessage,
undo_delete::UndoDeletePrivateMessage,
update::UpdatePrivateMessage,
},
};
use activitystreams::{base::AnyBase, primitives::OneOrMany, unparsed::Unparsed};
use lemmy_apub_lib::ReceiveActivity;
use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext;
use crate::activities_new::private_message::CreatePrivateMessage;
use crate::activities_new::comment::CreateComment;
use lemmy_apub_lib::ReceiveActivity;
use activitystreams::primitives::OneOrMany;
use activitystreams::base::AnyBase;
use url::Url;
use activitystreams::unparsed::Unparsed;
// TODO: would be nice if we could move this to lemmy_apub_lib crate. doing that gives error:
// "only traits defined in the current crate can be implemented for arbitrary types"
@ -36,12 +41,15 @@ impl<Kind> Activity<Kind> {
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub enum PersonAcceptedActivitiesNew {
Accept(Accept),
AcceptFollowCommunity(AcceptFollowCommunity),
CreatePrivateMessage(CreatePrivateMessage),
CreateComment(CreateComment)
UpdatePrivateMessage(UpdatePrivateMessage),
DeletePrivateMessage(DeletePrivateMessage),
UndoDeletePrivateMessage(UndoDeletePrivateMessage),
CreateComment(CreateComment),
}
// todo: there should be a better way to do this (maybe needs a derive macro)
// todo: can probably get rid of this?
#[async_trait::async_trait(?Send)]
impl ReceiveActivity for PersonAcceptedActivitiesNew {
async fn receive(

View file

@ -7,11 +7,6 @@ use crate::{
receive_undo_delete_community,
receive_undo_remove_community,
},
private_message::{
receive_delete_private_message,
receive_undo_delete_private_message,
receive_update_private_message,
},
receive_unhandled_activity,
verify_activity_domains_valid,
},
@ -19,6 +14,7 @@ use crate::{
is_activity_already_known,
is_addressed_to_community_followers,
is_addressed_to_local_person,
new_inbox_routing::{Activity, PersonAcceptedActivitiesNew},
receive_for_community::{
receive_add_for_community,
receive_block_user_for_community,
@ -42,11 +38,8 @@ use actix_web::{web, HttpRequest, HttpResponse};
use anyhow::{anyhow, Context};
use diesel::NotFound;
use lemmy_api_common::blocking;
use lemmy_apub::{
check_is_apub_id_valid,
get_activity_to_and_cc,
ActorType,
};
use lemmy_apub::{check_is_apub_id_valid, get_activity_to_and_cc, ActorType};
use lemmy_apub_lib::ReceiveActivity;
use lemmy_db_queries::{ApubObject, Followable};
use lemmy_db_schema::source::{
community::{Community, CommunityFollower},
@ -60,8 +53,6 @@ use serde::{Deserialize, Serialize};
use std::fmt::Debug;
use strum_macros::EnumString;
use url::Url;
use crate::inbox::new_inbox_routing::{PersonAcceptedActivitiesNew, Activity};
use lemmy_apub_lib::ReceiveActivity;
/// Allowed activities for person inbox.
#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Deserialize, Serialize)]
@ -326,7 +317,7 @@ async fn receive_update(
if verify_is_addressed_to_public(&update).is_ok() {
receive_update_comment(update, context, request_counter).await
} else {
receive_update_private_message(&context, update, expected_domain, request_counter).await
todo!()
}
}
@ -334,7 +325,7 @@ async fn receive_delete(
context: &LemmyContext,
any_base: AnyBase,
expected_domain: &Url,
request_counter: &mut i32,
_request_counter: &mut i32,
) -> Result<(), LemmyError> {
use CommunityOrPrivateMessage::*;
@ -348,7 +339,7 @@ async fn receive_delete(
match find_community_or_private_message_by_id(context, object_uri).await? {
Community(c) => receive_delete_community(context, c).await,
PrivateMessage(p) => receive_delete_private_message(context, delete, p, request_counter).await,
PrivateMessage(_) => todo!(),
}
}
@ -375,7 +366,7 @@ async fn receive_undo(
context: &LemmyContext,
any_base: AnyBase,
expected_domain: &Url,
request_counter: &mut i32,
_request_counter: &mut i32,
) -> Result<(), LemmyError> {
let undo = Undo::from_any_base(any_base)?.context(location_info!())?;
verify_activity_domains_valid(&undo, expected_domain, true)?;
@ -394,9 +385,8 @@ async fn receive_undo(
use CommunityOrPrivateMessage::*;
match find_community_or_private_message_by_id(context, object_uri).await? {
Community(c) => receive_undo_delete_community(context, c).await,
PrivateMessage(p) => {
receive_undo_delete_private_message(context, undo, expected_domain, p, request_counter)
.await
PrivateMessage(_) => {
todo!()
}
}
}