community::{BanFromCommunity, BanFromCommunityResponse},
context::LemmyContext,
person::{BanPerson, BanPersonResponse},
- utils::get_local_user_view_from_jwt,
+ utils::local_user_view_from_jwt,
};
use lemmy_db_schema::{
source::{community::Community, person::Person, site::Site},
}
}
-async fn generate_cc(target: &SiteOrCommunity, pool: &DbPool) -> Result<Vec<Url>, LemmyError> {
+async fn generate_cc(
+ target: &SiteOrCommunity,
+ pool: &mut DbPool<'_>,
+) -> Result<Vec<Url>, LemmyError> {
Ok(match target {
SiteOrCommunity::Site(_) => Site::read_remote_sites(pool)
.await?
_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?;
- let person = Person::read(context.pool(), request.person_id).await?;
- let site = SiteOrCommunity::Site(SiteView::read_local(context.pool()).await?.site.into());
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
+ let person = Person::read(&mut context.pool(), request.person_id).await?;
+ let site = SiteOrCommunity::Site(SiteView::read_local(&mut context.pool()).await?.site.into());
let expires = request.expires.map(naive_from_unix);
// if the action affects a local user, federate to other instances
_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?;
- let community: ApubCommunity = Community::read(context.pool(), request.community_id)
+ let local_user_view = local_user_view_from_jwt(&request.auth, context).await?;
+ let community: ApubCommunity = Community::read(&mut context.pool(), request.community_id)
.await?
.into();
- let banned_person: ApubPerson = Person::read(context.pool(), request.person_id)
+ let banned_person: ApubPerson = Person::read(&mut context.pool(), request.person_id)
.await?
.into();
let expires = request.expires.map(naive_from_unix);