From 7dd56a71e35af514eb2ea318b9afa344166842b9 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 3 May 2022 01:23:37 +0900 Subject: [PATCH] Rename: from_db07() -> from_db() --- plume-common/src/activity_pub/inbox.rs | 10 +++++----- plume-models/src/blogs.rs | 2 +- plume-models/src/comments.rs | 2 +- plume-models/src/follows.rs | 2 +- plume-models/src/likes.rs | 2 +- plume-models/src/posts.rs | 6 +++--- plume-models/src/reshares.rs | 2 +- plume-models/src/users.rs | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plume-common/src/activity_pub/inbox.rs b/plume-common/src/activity_pub/inbox.rs index f8ce6a7d..daf3e949 100644 --- a/plume-common/src/activity_pub/inbox.rs +++ b/plume-common/src/activity_pub/inbox.rs @@ -349,7 +349,7 @@ pub trait FromId: Sized { object: Option, proxy: Option<&reqwest::Proxy>, ) -> Result, Self::Error)> { - match Self::from_db07(ctx, id) { + match Self::from_db(ctx, id) { Ok(x) => Ok(x), _ => match object { Some(o) => Self::from_activity(ctx, o).map_err(|e| (None, e)), @@ -380,7 +380,7 @@ pub trait FromId: Sized { fn from_activity(ctx: &C, activity: Self::Object) -> Result; /// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database) - fn from_db07(ctx: &C, id: &str) -> Result; + fn from_db(ctx: &C, id: &str) -> Result; fn get_sender07() -> &'static dyn Signer; } @@ -606,7 +606,7 @@ mod tests { type Error = (); type Object = Person07; - fn from_db07(_: &(), _id: &str) -> Result { + fn from_db(_: &(), _id: &str) -> Result { Ok(Self) } @@ -634,7 +634,7 @@ mod tests { type Error = (); type Object = Note07; - fn from_db07(_: &(), _id: &str) -> Result { + fn from_db(_: &(), _id: &str) -> Result { Ok(Self) } @@ -785,7 +785,7 @@ mod tests { type Error = (); type Object = Person07; - fn from_db07(_: &(), _id: &str) -> Result { + fn from_db(_: &(), _id: &str) -> Result { Err(()) } diff --git a/plume-models/src/blogs.rs b/plume-models/src/blogs.rs index 0ffc38a9..54ab27b7 100644 --- a/plume-models/src/blogs.rs +++ b/plume-models/src/blogs.rs @@ -365,7 +365,7 @@ impl FromId for Blog { type Error = Error; type Object = CustomGroup; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Self::find_by_ap_url(conn, id) } diff --git a/plume-models/src/comments.rs b/plume-models/src/comments.rs index 18f63d6b..aa3f61bd 100644 --- a/plume-models/src/comments.rs +++ b/plume-models/src/comments.rs @@ -221,7 +221,7 @@ impl FromId for Comment { type Error = Error; type Object = Note; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Self::find_by_ap_url(conn, id) } diff --git a/plume-models/src/follows.rs b/plume-models/src/follows.rs index b3d5a07c..c8e7e691 100644 --- a/plume-models/src/follows.rs +++ b/plume-models/src/follows.rs @@ -172,7 +172,7 @@ impl FromId for Follow { type Error = Error; type Object = FollowAct; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Follow::find_by_ap_url(conn, id) } diff --git a/plume-models/src/likes.rs b/plume-models/src/likes.rs index 8fac8bc3..fc0b016c 100644 --- a/plume-models/src/likes.rs +++ b/plume-models/src/likes.rs @@ -109,7 +109,7 @@ impl FromId for Like { type Error = Error; type Object = LikeAct; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Like::find_by_ap_url(conn, id) } diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 8217e6b8..d305578e 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -620,7 +620,7 @@ impl FromId for Post { type Error = Error; type Object = LicensedArticle; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Self::find_by_ap_url(conn, id) } @@ -674,7 +674,7 @@ impl FromId for Post { .url() .and_then(|url| url.to_as_uri().or(id)) .ok_or(Error::MissingApProperty)?; - let post = Post::from_db07(conn, &ap_url) + let post = Post::from_db(conn, &ap_url) .and_then(|mut post| { let mut updated = false; @@ -849,7 +849,7 @@ impl FromId for PostUpdate { type Error = Error; type Object = LicensedArticle; - fn from_db07(_: &DbConn, _: &str) -> Result { + fn from_db(_: &DbConn, _: &str) -> Result { // Always fail because we always want to deserialize the AP object Err(Error::NotFound) } diff --git a/plume-models/src/reshares.rs b/plume-models/src/reshares.rs index 72628a0e..d2c943bd 100644 --- a/plume-models/src/reshares.rs +++ b/plume-models/src/reshares.rs @@ -138,7 +138,7 @@ impl FromId for Reshare { type Error = Error; type Object = Announce; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Reshare::find_by_ap_url(conn, id) } diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index b65b839a..4015f29a 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -948,7 +948,7 @@ impl FromId for User { type Error = Error; type Object = CustomPerson; - fn from_db07(conn: &DbConn, id: &str) -> Result { + fn from_db(conn: &DbConn, id: &str) -> Result { Self::find_by_ap_url(conn, id) }