3 comment::{get_notif_recipients, send_websocket_message},
6 verify_person_in_community,
12 use activitystreams::{activity::kind::UpdateType, base::BaseExt};
15 verify_domains_match_opt,
19 use lemmy_db_schema::source::comment::Comment;
20 use lemmy_utils::LemmyError;
21 use lemmy_websocket::{LemmyContext, UserOperationCrud};
24 #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
25 #[serde(rename_all = "camelCase")]
26 pub struct UpdateComment {
30 #[serde(rename = "type")]
33 common: ActivityCommonFields,
36 #[async_trait::async_trait(?Send)]
37 impl ActivityHandler for UpdateComment {
40 context: &LemmyContext,
41 request_counter: &mut i32,
42 ) -> Result<(), LemmyError> {
43 let community = extract_community(&self.cc, context, request_counter).await?;
45 verify_activity(self.common())?;
46 verify_person_in_community(
48 &community.actor_id(),
53 verify_domains_match_opt(&self.common.actor, self.object.id_unchecked())?;
59 context: &LemmyContext,
60 request_counter: &mut i32,
61 ) -> Result<(), LemmyError> {
62 let comment = Comment::from_apub(
65 self.common.actor.clone(),
72 get_notif_recipients(&self.common.actor, &comment, context, request_counter).await?;
73 send_websocket_message(
76 UserOperationCrud::EditComment,
82 fn common(&self) -> &ActivityCommonFields {