Compare commits
1 commit
0.7.0-beta
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 754b2a0f3d |
9 changed files with 20 additions and 20 deletions
|
|
@ -32,10 +32,10 @@ impl Object for SearchableDbObjects {
|
|||
type Kind = SearchableObjects;
|
||||
type Error = anyhow::Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
fn id(&self) -> Url {
|
||||
match self {
|
||||
SearchableDbObjects::User(p) => &p.federation_id,
|
||||
SearchableDbObjects::Post(n) => &n.federation_id,
|
||||
SearchableDbObjects::User(p) => p.federation_id.clone(),
|
||||
SearchableDbObjects::Post(n) => n.federation_id.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,8 @@ impl Object for DbUser {
|
|||
type Kind = Person;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
self.ap_id.inner()
|
||||
fn id(&self) -> Url {
|
||||
self.ap_id.inner().clone()
|
||||
}
|
||||
|
||||
fn last_refreshed_at(&self) -> Option<DateTime<Utc>> {
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ impl Object for DbPost {
|
|||
type Kind = Note;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
self.ap_id.inner()
|
||||
fn id(&self) -> Url {
|
||||
self.ap_id.inner().clone()
|
||||
}
|
||||
|
||||
async fn read_from_id(
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ impl Object for DbUser {
|
|||
type Kind = Person;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
self.ap_id.inner()
|
||||
fn id(&self) -> Url {
|
||||
self.ap_id.inner().clone()
|
||||
}
|
||||
|
||||
fn last_refreshed_at(&self) -> Option<DateTime<Utc>> {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ impl Object for DbPost {
|
|||
type Kind = Note;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
self.ap_id.inner()
|
||||
fn id(&self) -> Url {
|
||||
self.ap_id.inner().clone()
|
||||
}
|
||||
|
||||
async fn read_from_id(
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ where
|
|||
// PKey is internally like an Arc<>, so cloning is ok
|
||||
data.config
|
||||
.actor_pkey_cache
|
||||
.try_get_with_by_ref(actor_id, async {
|
||||
.try_get_with_by_ref(&actor_id, async {
|
||||
let private_key_pem = actor.private_key_pem().ok_or_else(|| {
|
||||
Error::Other(format!(
|
||||
"Actor {actor_id} does not contain a private key for signing"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ where
|
|||
type Error = E;
|
||||
|
||||
/// `id` field of the object
|
||||
fn id(&self) -> &Url {
|
||||
fn id(&self) -> Url {
|
||||
match self {
|
||||
Either::Left(l) => l.id(),
|
||||
Either::Right(r) => r.id(),
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ pub mod tests;
|
|||
/// type Kind = Note;
|
||||
/// type Error = anyhow::Error;
|
||||
///
|
||||
/// fn id(&self) -> &Url { self.ap_id.inner() }
|
||||
/// fn id(&self) -> Url { self.ap_id.inner().clone() }
|
||||
///
|
||||
/// async fn read_from_id(object_id: Url, data: &Data<Self::DataType>) -> Result<Option<Self>, Self::Error> {
|
||||
/// // Attempt to read object from local database. Return Ok(None) if not found.
|
||||
|
|
@ -110,7 +110,7 @@ pub trait Object: Sized + Debug {
|
|||
type Error;
|
||||
|
||||
/// `id` field of the object
|
||||
fn id(&self) -> &Url;
|
||||
fn id(&self) -> Url;
|
||||
|
||||
/// Returns the last time this object was updated.
|
||||
///
|
||||
|
|
@ -194,8 +194,8 @@ pub trait Object: Sized + Debug {
|
|||
redirect_remote_object,
|
||||
};
|
||||
let id = self.id();
|
||||
let res = if !data.config.is_local_url(id) {
|
||||
redirect_remote_object(id)
|
||||
let res = if !data.config.is_local_url(&id) {
|
||||
redirect_remote_object(&id)
|
||||
} else if !self.is_deleted() {
|
||||
let json = self.into_json(data).await?;
|
||||
create_http_response(json, federation_context)?
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ impl Object for DbUser {
|
|||
type Kind = Person;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.federation_id
|
||||
fn id(&self) -> Url {
|
||||
self.federation_id.clone()
|
||||
}
|
||||
|
||||
async fn read_from_id(
|
||||
|
|
@ -179,7 +179,7 @@ impl Object for DbPost {
|
|||
type Kind = Note;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
fn id(&self) -> Url {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue