Rename FromId07 -> FromId

This commit is contained in:
Kitaiti Makoto 2022-05-02 16:07:08 +09:00
parent 2804f44a06
commit d8a2e1925f
12 changed files with 25 additions and 25 deletions

View File

@ -199,9 +199,9 @@ where
/// Registers an handler on this Inbox. /// Registers an handler on this Inbox.
pub fn with07<A, V, M>(self, proxy: Option<&reqwest::Proxy>) -> Self pub fn with07<A, V, M>(self, proxy: Option<&reqwest::Proxy>) -> Self
where where
A: AsActor<&'a C> + FromId07<C, Error = E>, A: AsActor<&'a C> + FromId<C, Error = E>,
V: activitystreams::markers::Activity + serde::de::DeserializeOwned, V: activitystreams::markers::Activity + serde::de::DeserializeOwned,
M: AsObject07<A, V, &'a C, Error = E> + FromId07<C, Error = E>, M: AsObject07<A, V, &'a C, Error = E> + FromId<C, Error = E>,
M::Output: Into<R>, M::Output: Into<R>,
{ {
if let Self::NotHandled(ctx, mut act, e) = self { if let Self::NotHandled(ctx, mut act, e) = self {
@ -328,7 +328,7 @@ fn get_id(json: serde_json::Value) -> Option<String> {
/// a full object, and if so, save it with `from_activity`. If it is only an ID, it will try to find /// a full object, and if so, save it with `from_activity`. If it is only an ID, it will try to find
/// it in the database with `from_db`, and otherwise dereference (fetch) the full object and parse it /// it in the database with `from_db`, and otherwise dereference (fetch) the full object and parse it
/// with `from_activity`. /// with `from_activity`.
pub trait FromId07<C>: Sized { pub trait FromId<C>: Sized {
/// The type representing a failure /// The type representing a failure
type Error: From<InboxError<Self::Error>> + Debug; type Error: From<InboxError<Self::Error>> + Debug;
@ -742,7 +742,7 @@ mod tests {
} }
struct MyActor; struct MyActor;
impl FromId07<()> for MyActor { impl FromId<()> for MyActor {
type Error = (); type Error = ();
type Object = Person07; type Object = Person07;
@ -811,7 +811,7 @@ mod tests {
} }
struct MyObject07; struct MyObject07;
impl FromId07<()> for MyObject07 { impl FromId<()> for MyObject07 {
type Error = (); type Error = ();
type Object = Note07; type Object = Note07;
@ -977,7 +977,7 @@ mod tests {
} }
} }
impl FromId07<()> for FailingActor { impl FromId<()> for FailingActor {
type Error = (); type Error = ();
type Object = Person07; type Object = Person07;

View File

@ -27,7 +27,7 @@ use openssl::{
sign::{Signer, Verifier}, sign::{Signer, Verifier},
}; };
use plume_common::activity_pub::{ use plume_common::activity_pub::{
inbox::{AsActor, FromId07}, inbox::{AsActor, FromId},
sign, ActivityStream, ApSignature, ApSignature07, CustomGroup as CustomGroup07, Id, IntoId, sign, ActivityStream, ApSignature, ApSignature07, CustomGroup as CustomGroup07, Id, IntoId,
PublicKey, PublicKey07, Source, SourceProperty, ToAsString, ToAsUri, PublicKey, PublicKey07, Source, SourceProperty, ToAsString, ToAsUri,
}; };
@ -470,7 +470,7 @@ impl IntoId for Blog {
} }
} }
impl FromId07<DbConn> for Blog { impl FromId<DbConn> for Blog {
type Error = Error; type Error = Error;
type Object = CustomGroup07; type Object = CustomGroup07;

View File

@ -30,7 +30,7 @@ use chrono::{self, NaiveDateTime, TimeZone, Utc};
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
use plume_common::{ use plume_common::{
activity_pub::{ activity_pub::{
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
sign::Signer, sign::Signer,
Id, IntoId, ToAsString, ToAsUri, PUBLIC_VISIBILITY, Id, IntoId, ToAsString, ToAsUri, PUBLIC_VISIBILITY,
}, },
@ -294,7 +294,7 @@ impl Comment {
} }
} }
impl FromId07<DbConn> for Comment { impl FromId<DbConn> for Comment {
type Error = Error; type Error = Error;
type Object = Note07; type Object = Note07;

View File

@ -12,7 +12,7 @@ use activitystreams::{
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
use plume_common::activity_pub::{ use plume_common::activity_pub::{
broadcast, broadcast07, broadcast, broadcast07,
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
sign::Signer, sign::Signer,
Id, IntoId, PUBLIC_VISIBILITY, Id, IntoId, PUBLIC_VISIBILITY,
}; };
@ -272,7 +272,7 @@ impl AsObject07<User, FollowAct07, &DbConn> for User {
} }
} }
impl FromId07<DbConn> for Follow { impl FromId<DbConn> for Follow {
type Error = Error; type Error = Error;
type Object = FollowAct07; type Object = FollowAct07;

View File

@ -12,7 +12,7 @@ use activitystreams::{
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use plume_common::activity_pub::{ use plume_common::activity_pub::{
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
sign::Signer, sign::Signer,
Id, IntoId, PUBLIC_VISIBILITY, Id, IntoId, PUBLIC_VISIBILITY,
}; };
@ -158,7 +158,7 @@ impl AsObject07<User, Like07, &DbConn> for Post {
} }
} }
impl FromId07<DbConn> for Like { impl FromId<DbConn> for Like {
type Error = Error; type Error = Error;
type Object = Like07; type Object = Like07;

View File

@ -7,7 +7,7 @@ use activitystreams::{object::Image as Image07, prelude::*};
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use guid_create::GUID; use guid_create::GUID;
use plume_common::{ use plume_common::{
activity_pub::{inbox::FromId07, request, Id, ToAsString, ToAsUri}, activity_pub::{inbox::FromId, request, Id, ToAsString, ToAsUri},
utils::{escape, MediaProcessor}, utils::{escape, MediaProcessor},
}; };
use std::{ use std::{

View File

@ -26,7 +26,7 @@ use diesel::{self, BelongingToDsl, ExpressionMethods, QueryDsl, RunQueryDsl};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use plume_common::{ use plume_common::{
activity_pub::{ activity_pub::{
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
sign::Signer, sign::Signer,
Hashtag, Hashtag07, HashtagType07, Id, IntoId, Licensed, Licensed07, Hashtag, Hashtag07, HashtagType07, Id, IntoId, Licensed, Licensed07,
LicensedArticle as LicensedArticle07, Source, SourceProperty, ToAsString, ToAsUri, LicensedArticle as LicensedArticle07, Source, SourceProperty, ToAsString, ToAsUri,
@ -863,7 +863,7 @@ impl Post {
} }
} }
impl FromId07<DbConn> for Post { impl FromId<DbConn> for Post {
type Error = Error; type Error = Error;
type Object = LicensedArticle07; type Object = LicensedArticle07;
@ -1119,7 +1119,7 @@ pub struct PostUpdate {
pub tags: Option<serde_json::Value>, pub tags: Option<serde_json::Value>,
} }
impl FromId07<DbConn> for PostUpdate { impl FromId<DbConn> for PostUpdate {
type Error = Error; type Error = Error;
type Object = LicensedArticle07; type Object = LicensedArticle07;

View File

@ -10,7 +10,7 @@ use activitystreams::{
base::AnyBase, base::AnyBase,
object::kind::ArticleType, object::kind::ArticleType,
}; };
use plume_common::activity_pub::{inbox::FromId07, LicensedArticle as LicensedArticle07}; use plume_common::activity_pub::{inbox::FromId, LicensedArticle as LicensedArticle07};
use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell}; use riker::actors::{Actor, ActorFactoryArgs, ActorRefFactory, Context, Sender, Subscribe, Tell};
use std::sync::Arc; use std::sync::Arc;
use tracing::{error, info, warn}; use tracing::{error, info, warn};

View File

@ -12,7 +12,7 @@ use activitystreams::{
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use plume_common::activity_pub::{ use plume_common::activity_pub::{
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
sign::Signer, sign::Signer,
Id, IntoId, PUBLIC_VISIBILITY, Id, IntoId, PUBLIC_VISIBILITY,
}; };
@ -186,7 +186,7 @@ impl AsObject07<User, Announce07, &DbConn> for Post {
} }
} }
impl FromId07<DbConn> for Reshare { impl FromId<DbConn> for Reshare {
type Error = Error; type Error = Error;
type Object = Announce07; type Object = Announce07;

View File

@ -35,7 +35,7 @@ use openssl::{
}; };
use plume_common::{ use plume_common::{
activity_pub::{ activity_pub::{
inbox::{AsActor, AsObject, AsObject07, FromId07}, inbox::{AsActor, AsObject, AsObject07, FromId},
request::get, request::get,
sign::{gen_keypair, Error as SignError, Result as SignResult, Signer}, sign::{gen_keypair, Error as SignError, Result as SignResult, Signer},
ActivityStream, ApSignature, ApSignature07, CustomPerson as CustomPerson07, Id, IntoId, ActivityStream, ApSignature, ApSignature07, CustomPerson as CustomPerson07, Id, IntoId,
@ -1127,7 +1127,7 @@ impl IntoId for User {
impl Eq for User {} impl Eq for User {}
impl FromId07<DbConn> for User { impl FromId<DbConn> for User {
type Error = Error; type Error = Error;
type Object = CustomPerson07; type Object = CustomPerson07;

View File

@ -1,5 +1,5 @@
use plume_common::activity_pub::{ use plume_common::activity_pub::{
inbox::FromId07, inbox::FromId,
request::Digest, request::Digest,
sign::{verify_http_headers, Signable}, sign::{verify_http_headers, Signable},
}; };

View File

@ -11,7 +11,7 @@ use validator::{Validate, ValidationErrors};
use crate::inbox; use crate::inbox;
use crate::routes::{errors::ErrorPage, rocket_uri_macro_static_files, Page, RespondOrRedirect}; use crate::routes::{errors::ErrorPage, rocket_uri_macro_static_files, Page, RespondOrRedirect};
use crate::template_utils::{IntoContext, Ructe}; use crate::template_utils::{IntoContext, Ructe};
use plume_common::activity_pub::{broadcast, inbox::FromId07}; use plume_common::activity_pub::{broadcast, inbox::FromId};
use plume_models::{ use plume_models::{
admin::*, admin::*,
blocklisted_emails::*, blocklisted_emails::*,