Rename: from_db07() -> from_db()
This commit is contained in:
parent
06d2f68ecd
commit
7dd56a71e3
@ -349,7 +349,7 @@ pub trait FromId<C>: Sized {
|
|||||||
object: Option<Self::Object>,
|
object: Option<Self::Object>,
|
||||||
proxy: Option<&reqwest::Proxy>,
|
proxy: Option<&reqwest::Proxy>,
|
||||||
) -> Result<Self, (Option<serde_json::Value>, Self::Error)> {
|
) -> Result<Self, (Option<serde_json::Value>, Self::Error)> {
|
||||||
match Self::from_db07(ctx, id) {
|
match Self::from_db(ctx, id) {
|
||||||
Ok(x) => Ok(x),
|
Ok(x) => Ok(x),
|
||||||
_ => match object {
|
_ => match object {
|
||||||
Some(o) => Self::from_activity(ctx, o).map_err(|e| (None, e)),
|
Some(o) => Self::from_activity(ctx, o).map_err(|e| (None, e)),
|
||||||
@ -380,7 +380,7 @@ pub trait FromId<C>: Sized {
|
|||||||
fn from_activity(ctx: &C, activity: Self::Object) -> Result<Self, Self::Error>;
|
fn from_activity(ctx: &C, activity: Self::Object) -> Result<Self, Self::Error>;
|
||||||
|
|
||||||
/// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database)
|
/// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database)
|
||||||
fn from_db07(ctx: &C, id: &str) -> Result<Self, Self::Error>;
|
fn from_db(ctx: &C, id: &str) -> Result<Self, Self::Error>;
|
||||||
|
|
||||||
fn get_sender07() -> &'static dyn Signer;
|
fn get_sender07() -> &'static dyn Signer;
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ mod tests {
|
|||||||
type Error = ();
|
type Error = ();
|
||||||
type Object = Person07;
|
type Object = Person07;
|
||||||
|
|
||||||
fn from_db07(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
fn from_db(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
||||||
Ok(Self)
|
Ok(Self)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ mod tests {
|
|||||||
type Error = ();
|
type Error = ();
|
||||||
type Object = Note07;
|
type Object = Note07;
|
||||||
|
|
||||||
fn from_db07(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
fn from_db(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
||||||
Ok(Self)
|
Ok(Self)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,7 +785,7 @@ mod tests {
|
|||||||
type Error = ();
|
type Error = ();
|
||||||
type Object = Person07;
|
type Object = Person07;
|
||||||
|
|
||||||
fn from_db07(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
fn from_db(_: &(), _id: &str) -> Result<Self, Self::Error> {
|
||||||
Err(())
|
Err(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ impl FromId<DbConn> for Blog {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = CustomGroup;
|
type Object = CustomGroup;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Self::find_by_ap_url(conn, id)
|
Self::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ impl FromId<DbConn> for Comment {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = Note;
|
type Object = Note;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Self::find_by_ap_url(conn, id)
|
Self::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ impl FromId<DbConn> for Follow {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = FollowAct;
|
type Object = FollowAct;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Follow::find_by_ap_url(conn, id)
|
Follow::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ impl FromId<DbConn> for Like {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = LikeAct;
|
type Object = LikeAct;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Like::find_by_ap_url(conn, id)
|
Like::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ impl FromId<DbConn> for Post {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = LicensedArticle;
|
type Object = LicensedArticle;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Self::find_by_ap_url(conn, id)
|
Self::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ impl FromId<DbConn> for Post {
|
|||||||
.url()
|
.url()
|
||||||
.and_then(|url| url.to_as_uri().or(id))
|
.and_then(|url| url.to_as_uri().or(id))
|
||||||
.ok_or(Error::MissingApProperty)?;
|
.ok_or(Error::MissingApProperty)?;
|
||||||
let post = Post::from_db07(conn, &ap_url)
|
let post = Post::from_db(conn, &ap_url)
|
||||||
.and_then(|mut post| {
|
.and_then(|mut post| {
|
||||||
let mut updated = false;
|
let mut updated = false;
|
||||||
|
|
||||||
@ -849,7 +849,7 @@ impl FromId<DbConn> for PostUpdate {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = LicensedArticle;
|
type Object = LicensedArticle;
|
||||||
|
|
||||||
fn from_db07(_: &DbConn, _: &str) -> Result<Self> {
|
fn from_db(_: &DbConn, _: &str) -> Result<Self> {
|
||||||
// Always fail because we always want to deserialize the AP object
|
// Always fail because we always want to deserialize the AP object
|
||||||
Err(Error::NotFound)
|
Err(Error::NotFound)
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ impl FromId<DbConn> for Reshare {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = Announce;
|
type Object = Announce;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Reshare::find_by_ap_url(conn, id)
|
Reshare::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,7 +948,7 @@ impl FromId<DbConn> for User {
|
|||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = CustomPerson;
|
type Object = CustomPerson;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Self::find_by_ap_url(conn, id)
|
Self::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user