refactor code to use Shrinkwraprs and diesel-derive-newtype (#598)
* add shrinkwraprs and implement Id thru it This also means we can automatically convert Id to String without using .into()! * cleanup with the help of clippy! * cleanup with the help of cargo fmt! * remove extra block * Shrinkwrap Page, ContentLen and RemoteForm * translations
This commit is contained in:
committed by
Baptiste Gelez
parent
59023e9602
commit
8c59c822b6
@@ -163,25 +163,11 @@ impl FromId<PlumeRocket> for Follow {
|
||||
}
|
||||
|
||||
fn from_activity(c: &PlumeRocket, follow: FollowAct) -> Result<Self> {
|
||||
let actor = User::from_id(
|
||||
c,
|
||||
&{
|
||||
let res: String = follow.follow_props.actor_link::<Id>()?.into();
|
||||
res
|
||||
},
|
||||
None,
|
||||
)
|
||||
.map_err(|(_, e)| e)?;
|
||||
let actor =
|
||||
User::from_id(c, &follow.follow_props.actor_link::<Id>()?, None).map_err(|(_, e)| e)?;
|
||||
|
||||
let target = User::from_id(
|
||||
c,
|
||||
&{
|
||||
let res: String = follow.follow_props.object_link::<Id>()?.into();
|
||||
res
|
||||
},
|
||||
None,
|
||||
)
|
||||
.map_err(|(_, e)| e)?;
|
||||
let target = User::from_id(c, &follow.follow_props.object_link::<Id>()?, None)
|
||||
.map_err(|(_, e)| e)?;
|
||||
Follow::accept_follow(&c.conn, &actor, &target, follow, actor.id, target.id)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user