Rename activitypub::activity module to activitypub::types

This commit is contained in:
silverpill 2023-01-14 23:31:11 +00:00
parent 72637fe80c
commit 41fdb8abb0
7 changed files with 13 additions and 9 deletions

View file

@ -3,7 +3,6 @@ use serde::Serialize;
use tokio_postgres::GenericClient; use tokio_postgres::GenericClient;
use crate::activitypub::{ use crate::activitypub::{
activity::{Attachment, Tag},
actors::types::Actor, actors::types::Actor,
constants::{AP_MEDIA_TYPE, AP_CONTEXT, AP_PUBLIC}, constants::{AP_MEDIA_TYPE, AP_CONTEXT, AP_PUBLIC},
deliverer::OutgoingActivity, deliverer::OutgoingActivity,
@ -13,6 +12,7 @@ use crate::activitypub::{
local_actor_subscribers, local_actor_subscribers,
local_object_id, local_object_id,
}, },
types::{Attachment, Tag},
vocabulary::{CREATE, DOCUMENT, HASHTAG, LINK, MENTION, NOTE}, vocabulary::{CREATE, DOCUMENT, HASHTAG, LINK, MENTION, NOTE},
}; };
use crate::config::Instance; use crate::config::Instance;

View file

@ -4,9 +4,11 @@ use std::time::Duration;
use reqwest::{Client, Method, Proxy, RequestBuilder}; use reqwest::{Client, Method, Proxy, RequestBuilder};
use serde_json::Value; use serde_json::Value;
use crate::activitypub::activity::Object; use crate::activitypub::{
use crate::activitypub::actors::types::Actor; actors::types::Actor,
use crate::activitypub::constants::AP_MEDIA_TYPE; constants::AP_MEDIA_TYPE,
types::Object,
};
use crate::config::Instance; use crate::config::Instance;
use crate::http_signatures::create::{ use crate::http_signatures::create::{
create_http_signature, create_http_signature,

View file

@ -4,11 +4,11 @@ use std::path::Path;
use tokio_postgres::GenericClient; use tokio_postgres::GenericClient;
use crate::activitypub::{ use crate::activitypub::{
activity::Object,
actors::helpers::{create_remote_profile, update_remote_profile}, actors::helpers::{create_remote_profile, update_remote_profile},
handlers::create::handle_note, handlers::create::handle_note,
identifiers::parse_local_object_id, identifiers::parse_local_object_id,
receiver::HandlerError, receiver::HandlerError,
types::Object,
}; };
use crate::config::{Config, Instance}; use crate::config::{Config, Instance};
use crate::database::DatabaseError; use crate::database::DatabaseError;

View file

@ -7,7 +7,6 @@ use tokio_postgres::GenericClient;
use uuid::Uuid; use uuid::Uuid;
use crate::activitypub::{ use crate::activitypub::{
activity::{Attachment, Link, Object, Tag},
constants::{AP_MEDIA_TYPE, AP_PUBLIC, AS_MEDIA_TYPE}, constants::{AP_MEDIA_TYPE, AP_PUBLIC, AS_MEDIA_TYPE},
fetcher::fetchers::fetch_file, fetcher::fetchers::fetch_file,
fetcher::helpers::{ fetcher::helpers::{
@ -17,6 +16,7 @@ use crate::activitypub::{
}, },
identifiers::parse_local_actor_id, identifiers::parse_local_actor_id,
receiver::{parse_array, parse_property_value, HandlerError}, receiver::{parse_array, parse_property_value, HandlerError},
types::{Attachment, Link, Object, Tag},
vocabulary::*, vocabulary::*,
}; };
use crate::config::{Config, Instance}; use crate::config::{Config, Instance};
@ -417,8 +417,8 @@ pub async fn handle_create(
mod tests { mod tests {
use serde_json::json; use serde_json::json;
use crate::activitypub::{ use crate::activitypub::{
activity::Object,
actors::types::Actor, actors::types::Actor,
types::Object,
vocabulary::NOTE, vocabulary::NOTE,
}; };
use super::*; use super::*;

View file

@ -4,12 +4,12 @@ use serde_json::Value;
use tokio_postgres::GenericClient; use tokio_postgres::GenericClient;
use crate::activitypub::{ use crate::activitypub::{
activity::Object,
actors::{ actors::{
helpers::update_remote_profile, helpers::update_remote_profile,
types::Actor, types::Actor,
}, },
handlers::create::get_note_content, handlers::create::get_note_content,
types::Object,
vocabulary::{NOTE, PERSON}, vocabulary::{NOTE, PERSON},
}; };
use crate::config::Config; use crate::config::Config;

View file

@ -1,4 +1,3 @@
mod activity;
pub mod actors; pub mod actors;
mod authentication; mod authentication;
pub mod builders; pub mod builders;
@ -10,6 +9,7 @@ mod handlers;
pub mod identifiers; pub mod identifiers;
pub mod queues; pub mod queues;
mod receiver; mod receiver;
mod types;
pub mod views; pub mod views;
mod vocabulary; mod vocabulary;

View file

@ -41,6 +41,8 @@ pub struct Tag {
#[cfg_attr(test, derive(Default))] #[cfg_attr(test, derive(Default))]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Object { pub struct Object {
// https://www.w3.org/TR/activitypub/#obj-id
// "id" and "type" are required properties
pub id: String, pub id: String,
#[serde(rename = "type")] #[serde(rename = "type")]