},
activity_queue::send_to_community_new,
extensions::context::lemmy_context,
},
activity_queue::send_to_community_new,
extensions::context::lemmy_context,
#[derive(Clone, Debug, Deserialize, Serialize, ActivityFields)]
#[serde(rename_all = "camelCase")]
pub struct AddMod {
#[derive(Clone, Debug, Deserialize, Serialize, ActivityFields)]
#[serde(rename_all = "camelCase")]
pub struct AddMod {
) -> Result<(), LemmyError> {
let id = generate_activity_id(AddType::Add)?;
let add = AddMod {
) -> Result<(), LemmyError> {
let id = generate_activity_id(AddType::Add)?;
let add = AddMod {
verify_activity(self)?;
verify_person_in_community(&self.actor, &self.cc[0], context, request_counter).await?;
verify_mod_action(&self.actor, self.cc[0].clone(), context).await?;
verify_activity(self)?;
verify_person_in_community(&self.actor, &self.cc[0], context, request_counter).await?;
verify_mod_action(&self.actor, self.cc[0].clone(), context).await?;
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let community =
- get_or_fetch_and_upsert_community(&self.cc[0], context, request_counter).await?;
- let new_mod = get_or_fetch_and_upsert_person(&self.object, context, request_counter).await?;
+ let community = self.cc[0].dereference(context, request_counter).await?;
+ let new_mod = self.object.dereference(context, request_counter).await?;
// If we had to refetch the community while parsing the activity, then the new mod has already
// been added. Skip it here as it would result in a duplicate key error.
// If we had to refetch the community while parsing the activity, then the new mod has already
// been added. Skip it here as it would result in a duplicate key error.