activity_lists::AnnouncableActivities,
insert_activity,
protocol::{
- activities::{
- community::lock_page::{LockPage, LockType, UndoLockPage},
- create_or_update::page::CreateOrUpdatePage,
- CreateOrUpdateType,
- },
+ activities::community::lock_page::{LockPage, LockType, UndoLockPage},
InCommunity,
},
SendActivity,
use lemmy_api_common::{
context::LemmyContext,
post::{LockPost, PostResponse},
- utils::get_local_user_view_from_jwt,
+ utils::local_user_view_from_jwt,
};
use lemmy_db_schema::{
source::{
async fn receive(self, context: &Data<Self::DataType>) -> Result<(), Self::Error> {
let form = PostUpdateForm::builder().locked(Some(true)).build();
let post = self.object.dereference(context).await?;
- Post::update(context.pool(), post.id, &form).await?;
+ Post::update(&mut context.pool(), post.id, &form).await?;
Ok(())
}
}
insert_activity(&self.id, &self, false, false, context).await?;
let form = PostUpdateForm::builder().locked(Some(false)).build();
let post = self.object.object.dereference(context).await?;
- Post::update(context.pool(), post.id, &form).await?;
+ Post::update(&mut context.pool(), post.id, &form).await?;
Ok(())
}
}
response: &Self::Response,
context: &Data<LemmyContext>,
) -> Result<(), LemmyError> {
- let local_user_view =
- get_local_user_view_from_jwt(&request.auth, context.pool(), context.secret()).await?;
- // For backwards compat with 0.17
- CreateOrUpdatePage::send(
- &response.post_view.post,
- local_user_view.person.id,
- CreateOrUpdateType::Update,
- context,
- )
- .await?;
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
let id = generate_activity_id(
LockType::Lock,
&context.settings().get_protocol_and_hostname(),
};
AnnouncableActivities::UndoLockPost(undo)
};
- let community = Community::read(context.pool(), response.post_view.community.id).await?;
+ let community = Community::read(&mut context.pool(), response.post_view.community.id).await?;
send_activity_in_community(
activity,
&local_user_view.person.into(),