1 use crate::activities::{
2 comment::{get_notif_recipients, send_websocket_message},
4 verify_person_in_community,
6 use activitystreams::{activity::kind::UpdateType, base::BaseExt};
7 use lemmy_apub::{objects::FromApub, NoteExt};
8 use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler, PublicUrl};
9 use lemmy_db_schema::source::comment::Comment;
10 use lemmy_utils::LemmyError;
11 use lemmy_websocket::{LemmyContext, UserOperationCrud};
14 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
15 #[serde(rename_all = "camelCase")]
16 pub struct UpdateComment {
20 #[serde(rename = "type")]
23 common: ActivityCommonFields,
26 #[async_trait::async_trait(?Send)]
27 impl ActivityHandler for UpdateComment {
30 context: &LemmyContext,
31 request_counter: &mut i32,
32 ) -> Result<(), LemmyError> {
33 verify_activity(self.common())?;
34 verify_person_in_community(&self.common.actor, &self.cc, context, request_counter).await?;
35 verify_domains_match_opt(&self.common.actor, self.object.id_unchecked())?;
41 context: &LemmyContext,
42 request_counter: &mut i32,
43 ) -> Result<(), LemmyError> {
44 let comment = Comment::from_apub(
47 self.common.actor.clone(),
54 get_notif_recipients(&self.common.actor, &comment, context, request_counter).await?;
55 send_websocket_message(
58 UserOperationCrud::EditComment,
64 fn common(&self) -> &ActivityCommonFields {