Rename: with07() -> with()

This commit is contained in:
Kitaiti Makoto 2022-05-03 01:20:40 +09:00
parent ccd3c8a3f2
commit 9791607793
2 changed files with 23 additions and 23 deletions

View file

@ -197,7 +197,7 @@ where
}
/// Registers an handler on this Inbox.
pub fn with07<A, V, M>(self, proxy: Option<&reqwest::Proxy>) -> Self
pub fn with<A, V, M>(self, proxy: Option<&reqwest::Proxy>) -> Self
where
A: AsActor<&'a C> + FromId<C, Error = E>,
V: activitystreams::markers::Activity + serde::de::DeserializeOwned,
@ -742,7 +742,7 @@ mod tests {
fn test_inbox_basic07() {
let act = serde_json::to_value(build_create07()).unwrap();
let res: Result<(), ()> = Inbox::handle(&(), act)
.with07::<MyActor, Create07, MyObject07>(None)
.with::<MyActor, Create07, MyObject07>(None)
.done();
assert!(res.is_ok());
}
@ -751,10 +751,10 @@ mod tests {
fn test_inbox_multi_handlers07() {
let act = serde_json::to_value(build_create()).unwrap();
let res: Result<(), ()> = Inbox::handle(&(), act)
.with07::<MyActor, Announce07, MyObject07>(None)
.with07::<MyActor, Delete07, MyObject07>(None)
.with07::<MyActor, Create07, MyObject07>(None)
.with07::<MyActor, Like07, MyObject07>(None)
.with::<MyActor, Announce07, MyObject07>(None)
.with::<MyActor, Delete07, MyObject07>(None)
.with::<MyActor, Create07, MyObject07>(None)
.with::<MyActor, Like07, MyObject07>(None)
.done();
assert!(res.is_ok());
}
@ -764,8 +764,8 @@ mod tests {
let act = serde_json::to_value(build_create07()).unwrap();
// Create is not handled by this inbox
let res: Result<(), ()> = Inbox::handle(&(), act)
.with07::<MyActor, Announce07, MyObject07>(None)
.with07::<MyActor, Like07, MyObject07>(None)
.with::<MyActor, Announce07, MyObject07>(None)
.with::<MyActor, Like07, MyObject07>(None)
.done();
assert!(res.is_err());
}
@ -818,13 +818,13 @@ mod tests {
let act = serde_json::to_value(build_create07()).unwrap();
let res: Result<(), ()> = Inbox::handle(&(), act.clone())
.with07::<FailingActor, Create07, MyObject07>(None)
.with::<FailingActor, Create07, MyObject07>(None)
.done();
assert!(res.is_err());
let res: Result<(), ()> = Inbox::handle(&(), act.clone())
.with07::<FailingActor, Create07, MyObject07>(None)
.with07::<MyActor, Create07, MyObject07>(None)
.with::<FailingActor, Create07, MyObject07>(None)
.with::<MyActor, Create07, MyObject07>(None)
.done();
assert!(res.is_ok());
}

View file

@ -51,18 +51,18 @@ impl_into_inbox_result! {
pub fn inbox(conn: &DbConn, act: serde_json::Value) -> Result<InboxResult, Error> {
Inbox::handle(conn, act)
.with07::<User, Announce07, Post>(CONFIG.proxy())
.with07::<User, Create07, Comment>(CONFIG.proxy())
.with07::<User, Create07, Post>(CONFIG.proxy())
.with07::<User, Delete07, Comment>(CONFIG.proxy())
.with07::<User, Delete07, Post>(CONFIG.proxy())
.with07::<User, Delete07, User>(CONFIG.proxy())
.with07::<User, Follow07, User>(CONFIG.proxy())
.with07::<User, Like07, Post>(CONFIG.proxy())
.with07::<User, Undo07, Reshare>(CONFIG.proxy())
.with07::<User, Undo07, follows::Follow>(CONFIG.proxy())
.with07::<User, Undo07, likes::Like>(CONFIG.proxy())
.with07::<User, Update07, PostUpdate>(CONFIG.proxy())
.with::<User, Announce07, Post>(CONFIG.proxy())
.with::<User, Create07, Comment>(CONFIG.proxy())
.with::<User, Create07, Post>(CONFIG.proxy())
.with::<User, Delete07, Comment>(CONFIG.proxy())
.with::<User, Delete07, Post>(CONFIG.proxy())
.with::<User, Delete07, User>(CONFIG.proxy())
.with::<User, Follow07, User>(CONFIG.proxy())
.with::<User, Like07, Post>(CONFIG.proxy())
.with::<User, Undo07, Reshare>(CONFIG.proxy())
.with::<User, Undo07, follows::Follow>(CONFIG.proxy())
.with::<User, Undo07, likes::Like>(CONFIG.proxy())
.with::<User, Update07, PostUpdate>(CONFIG.proxy())
.done()
}