Rename: get_sender07() -> get_sender()

This commit is contained in:
Kitaiti Makoto 2022-05-03 01:24:22 +09:00
parent 7dd56a71e3
commit 15134eed60
9 changed files with 18 additions and 18 deletions

View File

@ -364,7 +364,7 @@ pub trait FromId<C>: Sized {
id: &str,
proxy: Option<reqwest::Proxy>,
) -> Result<Self::Object, (Option<serde_json::Value>, Self::Error)> {
request::get(id, Self::get_sender07(), proxy)
request::get(id, Self::get_sender(), proxy)
.map_err(|_| (None, InboxError::DerefError))
.and_then(|mut r| {
let json: serde_json::Value = r
@ -382,7 +382,7 @@ pub trait FromId<C>: Sized {
/// Tries to find a `Self` with a given ID (`id`), using `ctx` (a database)
fn from_db(ctx: &C, id: &str) -> Result<Self, Self::Error>;
fn get_sender07() -> &'static dyn Signer;
fn get_sender() -> &'static dyn Signer;
}
/// Should be implemented by anything representing an ActivityPub actor.
@ -614,7 +614,7 @@ mod tests {
Ok(Self)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
&*MY_SIGNER
}
}
@ -642,7 +642,7 @@ mod tests {
Ok(Self)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
&*MY_SIGNER
}
}
@ -793,7 +793,7 @@ mod tests {
Err(())
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
&*MY_SIGNER
}
}

View File

@ -475,7 +475,7 @@ impl FromId<DbConn> for Blog {
Blog::insert(conn, new_blog)
}
fn get_sender07() -> &'static dyn sign::Signer {
fn get_sender() -> &'static dyn sign::Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -349,7 +349,7 @@ impl FromId<DbConn> for Comment {
Ok(comm)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -203,7 +203,7 @@ impl FromId<DbConn> for Follow {
Follow::accept_follow07(conn, &actor, &target, follow, actor.id, target.id)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -149,7 +149,7 @@ impl FromId<DbConn> for Like {
Ok(res)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -221,7 +221,7 @@ impl Media {
// TODO: conditional GET
request::get(
remote_url.as_str(),
User::get_sender07(),
User::get_sender(),
CONFIG.proxy().cloned(),
)?
.copy_to(&mut dest)?;

View File

@ -802,7 +802,7 @@ impl FromId<DbConn> for Post {
Ok(post)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to get local instance user")
}
}
@ -897,7 +897,7 @@ impl FromId<DbConn> for PostUpdate {
Ok(post_update)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -178,7 +178,7 @@ impl FromId<DbConn> for Reshare {
Ok(res)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}

View File

@ -244,7 +244,7 @@ impl User {
}
fn fetch(url: &str) -> Result<CustomPerson> {
let mut res = get(url, Self::get_sender07(), CONFIG.proxy().cloned())?;
let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
let text = &res.text()?;
// without this workaround, publicKey is not correctly deserialized
let ap_sign = serde_json::from_str::<ApSignature>(text)?;
@ -517,7 +517,7 @@ impl User {
&self,
url: &str,
) -> Result<(Vec<T>, Option<String>)> {
let mut res = get(url, Self::get_sender07(), CONFIG.proxy().cloned())?;
let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
let text = &res.text()?;
let json: serde_json::Value = serde_json::from_str(text)?;
let items = json["items"]
@ -534,7 +534,7 @@ impl User {
pub fn fetch_outbox07<T: Activity + serde::de::DeserializeOwned>(&self) -> Result<Vec<T>> {
let mut res = get(
&self.outbox_url[..],
Self::get_sender07(),
Self::get_sender(),
CONFIG.proxy().cloned(),
)?;
let text = &res.text()?;
@ -570,7 +570,7 @@ impl User {
pub fn fetch_followers_ids(&self) -> Result<Vec<String>> {
let mut res = get(
&self.followers_endpoint[..],
Self::get_sender07(),
Self::get_sender(),
CONFIG.proxy().cloned(),
)?;
let text = &res.text()?;
@ -1044,7 +1044,7 @@ impl FromId<DbConn> for User {
Ok(user)
}
fn get_sender07() -> &'static dyn Signer {
fn get_sender() -> &'static dyn Signer {
Instance::get_local_instance_user().expect("Failed to local instance user")
}
}