Rename actor module to actors::types
This commit is contained in:
parent
b185e1f391
commit
a00b704cf4
24 changed files with 31 additions and 28 deletions
1
src/activitypub/actors/mod.rs
Normal file
1
src/activitypub/actors/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod types;
|
|
@ -1,6 +1,11 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::activitypub::{
|
||||
constants::{ACTOR_KEY_SUFFIX, AP_CONTEXT},
|
||||
identifiers::{local_actor_id, LocalActorCollection},
|
||||
vocabulary::{IDENTITY_PROOF, IMAGE, PERSON, PROPERTY_VALUE, SERVICE},
|
||||
};
|
||||
use crate::config::Instance;
|
||||
use crate::errors::ValidationError;
|
||||
use crate::ethereum::identity::{
|
||||
|
@ -12,9 +17,6 @@ use crate::models::profiles::types::{ExtraField, IdentityProof};
|
|||
use crate::models::users::types::User;
|
||||
use crate::utils::crypto::{deserialize_private_key, get_public_key_pem};
|
||||
use crate::utils::files::get_file_url;
|
||||
use super::constants::{ACTOR_KEY_SUFFIX, AP_CONTEXT};
|
||||
use super::identifiers::{local_actor_id, LocalActorCollection};
|
||||
use super::vocabulary::{IDENTITY_PROOF, IMAGE, PERSON, PROPERTY_VALUE, SERVICE};
|
||||
|
||||
const W3ID_CONTEXT: &str = "https://w3id.org/security/v1";
|
||||
|
|
@ -2,7 +2,7 @@ use serde_json::json;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity, Object},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_CONTEXT,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::local_object_id,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use serde::Serialize;
|
||||
|
||||
use crate::activitypub::{
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_CONTEXT,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::{local_actor_id, local_object_id, LocalActorCollection},
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_PUBLIC,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::{local_actor_followers, local_object_id},
|
||||
|
@ -89,7 +89,7 @@ pub async fn prepare_announce_note(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serde_json::json;
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use crate::utils::id::new_uuid;
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use tokio_postgres::GenericClient;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity, Attachment, Tag},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::{AP_CONTEXT, AP_PUBLIC},
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::{
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_PUBLIC,
|
||||
deliverer::OutgoingActivity,
|
||||
vocabulary::DELETE,
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity, Object},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_CONTEXT,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::local_object_id,
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_PUBLIC,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::local_object_id,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::activitypub::{
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::LocalActorCollection,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity, Object},
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
constants::AP_CONTEXT,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::{local_actor_id, local_object_id},
|
||||
|
|
|
@ -3,7 +3,7 @@ use uuid::Uuid;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::{create_activity, Activity},
|
||||
actor::{get_local_actor, Actor, ActorKeyError},
|
||||
actors::types::{get_local_actor, Actor, ActorKeyError},
|
||||
constants::AP_PUBLIC,
|
||||
deliverer::OutgoingActivity,
|
||||
identifiers::{local_actor_followers, local_object_id},
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::config::Instance;
|
|||
use crate::http_signatures::create::{create_http_signature, SignatureError};
|
||||
use crate::models::users::types::User;
|
||||
use crate::utils::crypto::deserialize_private_key;
|
||||
use super::actor::Actor;
|
||||
use super::actors::types::Actor;
|
||||
use super::constants::{ACTIVITY_CONTENT_TYPE, ACTOR_KEY_SUFFIX};
|
||||
use super::identifiers::local_actor_id;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use reqwest::{Client, Method};
|
|||
use serde_json::Value;
|
||||
|
||||
use crate::activitypub::activity::Object;
|
||||
use crate::activitypub::actor::{Actor, ActorAddress};
|
||||
use crate::activitypub::actors::types::{Actor, ActorAddress};
|
||||
use crate::activitypub::constants::ACTIVITY_CONTENT_TYPE;
|
||||
use crate::config::Instance;
|
||||
use crate::http_signatures::create::{create_http_signature, SignatureError};
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::path::Path;
|
|||
use tokio_postgres::GenericClient;
|
||||
|
||||
use crate::activitypub::activity::Object;
|
||||
use crate::activitypub::actor::{Actor, ActorAddress};
|
||||
use crate::activitypub::actors::types::{Actor, ActorAddress};
|
||||
use crate::activitypub::handlers::{
|
||||
create_note::handle_note,
|
||||
update_person::update_remote_profile,
|
||||
|
|
|
@ -303,7 +303,7 @@ pub async fn handle_note(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::activitypub::activity::Object;
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use crate::activitypub::vocabulary::NOTE;
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ use tokio_postgres::GenericClient;
|
|||
|
||||
use crate::activitypub::{
|
||||
activity::Activity,
|
||||
actor::Actor,
|
||||
actors::types::Actor,
|
||||
fetcher::fetchers::{fetch_actor_avatar, fetch_actor_banner},
|
||||
fetcher::helpers::ImportError,
|
||||
vocabulary::PERSON,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
mod activity;
|
||||
pub mod actor;
|
||||
pub mod actors;
|
||||
pub mod builders;
|
||||
mod collections;
|
||||
pub mod constants;
|
||||
|
|
|
@ -15,8 +15,8 @@ use crate::errors::HttpError;
|
|||
use crate::frontend::{get_post_page_url, get_profile_page_url};
|
||||
use crate::models::posts::queries::{get_posts_by_author, get_thread};
|
||||
use crate::models::users::queries::get_user_by_name;
|
||||
use super::actors::types::{get_local_actor, get_instance_actor};
|
||||
use super::builders::create_note::{build_note, build_create_note};
|
||||
use super::actor::{get_local_actor, get_instance_actor};
|
||||
use super::collections::{
|
||||
COLLECTION_PAGE_SIZE,
|
||||
OrderedCollection,
|
||||
|
|
|
@ -2,7 +2,7 @@ use regex::Regex;
|
|||
use tokio_postgres::GenericClient;
|
||||
use url::Url;
|
||||
|
||||
use crate::activitypub::actor::ActorAddress;
|
||||
use crate::activitypub::actors::types::ActorAddress;
|
||||
use crate::activitypub::fetcher::helpers::{
|
||||
import_post,
|
||||
import_profile_by_actor_address,
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
|||
use regex::{Captures, Regex};
|
||||
use tokio_postgres::GenericClient;
|
||||
|
||||
use crate::activitypub::actor::ActorAddress;
|
||||
use crate::activitypub::actors::types::ActorAddress;
|
||||
use crate::errors::{DatabaseError, ValidationError};
|
||||
use crate::models::profiles::queries::get_profiles_by_accts;
|
||||
use crate::models::profiles::types::DbActorProfile;
|
||||
|
@ -104,7 +104,7 @@ pub fn mention_to_address(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use super::*;
|
||||
|
||||
const INSTANCE_HOST: &str = "server1.com";
|
||||
|
|
|
@ -488,7 +488,7 @@ pub async fn update_post_count(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serial_test::serial;
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::models::profiles::queries::create_profile;
|
||||
use crate::models::profiles::types::{
|
||||
|
|
|
@ -3,7 +3,7 @@ use postgres_types::FromSql;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use crate::activitypub::identifiers::local_actor_id;
|
||||
use crate::database::json_macro::{json_from_sql, json_to_sql};
|
||||
use crate::errors::ValidationError;
|
||||
|
@ -228,7 +228,7 @@ impl From<&DbActorProfile> for ProfileUpdateData {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use super::*;
|
||||
|
||||
const INSTANCE_HOST: &str = "example.com";
|
||||
|
|
|
@ -453,7 +453,7 @@ pub async fn show_replies(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use serial_test::serial;
|
||||
use crate::activitypub::actor::Actor;
|
||||
use crate::activitypub::actors::types::Actor;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::errors::DatabaseError;
|
||||
use crate::models::profiles::queries::create_profile;
|
||||
|
|
Loading…
Reference in a new issue