Rename modules
This commit is contained in:
parent
e0053f19c7
commit
d3db42ec9e
8 changed files with 19 additions and 16 deletions
|
@ -7,7 +7,7 @@ use crate::activitypub::{
|
||||||
activity::Object,
|
activity::Object,
|
||||||
actors::types::{Actor, ActorAddress},
|
actors::types::{Actor, ActorAddress},
|
||||||
handlers::{
|
handlers::{
|
||||||
create_note::handle_note,
|
create::handle_note,
|
||||||
update_person::update_remote_profile,
|
update_person::update_remote_profile,
|
||||||
},
|
},
|
||||||
identifiers::parse_local_object_id,
|
identifiers::parse_local_object_id,
|
||||||
|
|
|
@ -16,11 +16,12 @@ use crate::models::relationships::queries::{
|
||||||
use crate::models::relationships::types::FollowRequestStatus;
|
use crate::models::relationships::types::FollowRequestStatus;
|
||||||
use super::HandlerResult;
|
use super::HandlerResult;
|
||||||
|
|
||||||
pub async fn handle_accept_follow(
|
pub async fn handle_accept(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
db_client: &mut impl GenericClient,
|
db_client: &mut impl GenericClient,
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
) -> HandlerResult {
|
) -> HandlerResult {
|
||||||
|
// Accept(Follow)
|
||||||
let actor_profile = get_profile_by_remote_actor_id(
|
let actor_profile = get_profile_by_remote_actor_id(
|
||||||
db_client,
|
db_client,
|
||||||
&activity.actor,
|
&activity.actor,
|
|
@ -3,15 +3,15 @@ pub use super::receiver::HandlerError;
|
||||||
// or None if it has been ignored
|
// or None if it has been ignored
|
||||||
pub type HandlerResult = Result<Option<&'static str>, HandlerError>;
|
pub type HandlerResult = Result<Option<&'static str>, HandlerError>;
|
||||||
|
|
||||||
pub mod accept_follow;
|
pub mod accept;
|
||||||
pub mod add;
|
pub mod add;
|
||||||
pub mod announce;
|
pub mod announce;
|
||||||
pub mod create_note;
|
pub mod create;
|
||||||
pub mod delete;
|
pub mod delete;
|
||||||
pub mod follow;
|
pub mod follow;
|
||||||
pub mod like;
|
pub mod like;
|
||||||
pub mod move_person;
|
pub mod r#move;
|
||||||
pub mod reject_follow;
|
pub mod reject;
|
||||||
pub mod remove;
|
pub mod remove;
|
||||||
pub mod undo;
|
pub mod undo;
|
||||||
mod undo_follow;
|
mod undo_follow;
|
||||||
|
|
|
@ -26,11 +26,12 @@ use crate::models::{
|
||||||
};
|
};
|
||||||
use super::HandlerResult;
|
use super::HandlerResult;
|
||||||
|
|
||||||
pub async fn handle_move_person(
|
pub async fn handle_move(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
db_client: &mut impl GenericClient,
|
db_client: &mut impl GenericClient,
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
) -> HandlerResult {
|
) -> HandlerResult {
|
||||||
|
// Move(Person)
|
||||||
let object_id = find_object_id(&activity.object)?;
|
let object_id = find_object_id(&activity.object)?;
|
||||||
let target_value = activity.target
|
let target_value = activity.target
|
||||||
.ok_or(ValidationError("target is missing"))?;
|
.ok_or(ValidationError("target is missing"))?;
|
|
@ -16,11 +16,12 @@ use crate::models::relationships::queries::{
|
||||||
use crate::models::relationships::types::FollowRequestStatus;
|
use crate::models::relationships::types::FollowRequestStatus;
|
||||||
use super::HandlerResult;
|
use super::HandlerResult;
|
||||||
|
|
||||||
pub async fn handle_reject_follow(
|
pub async fn handle_reject(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
db_client: &impl GenericClient,
|
db_client: &impl GenericClient,
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
) -> HandlerResult {
|
) -> HandlerResult {
|
||||||
|
// Reject(Follow)
|
||||||
let actor_profile = get_profile_by_remote_actor_id(
|
let actor_profile = get_profile_by_remote_actor_id(
|
||||||
db_client,
|
db_client,
|
||||||
&activity.actor,
|
&activity.actor,
|
|
@ -10,7 +10,7 @@ use crate::models::posts::queries::{
|
||||||
};
|
};
|
||||||
use crate::models::posts::types::PostUpdateData;
|
use crate::models::posts::types::PostUpdateData;
|
||||||
use super::HandlerResult;
|
use super::HandlerResult;
|
||||||
use super::create_note::get_note_content;
|
use super::create::get_note_content;
|
||||||
|
|
||||||
pub async fn handle_update_note(
|
pub async fn handle_update_note(
|
||||||
db_client: &mut impl GenericClient,
|
db_client: &mut impl GenericClient,
|
||||||
|
|
|
@ -18,15 +18,15 @@ use super::authentication::{
|
||||||
};
|
};
|
||||||
use super::fetcher::fetchers::FetchError;
|
use super::fetcher::fetchers::FetchError;
|
||||||
use super::handlers::{
|
use super::handlers::{
|
||||||
accept_follow::handle_accept_follow,
|
accept::handle_accept,
|
||||||
add::handle_add,
|
add::handle_add,
|
||||||
announce::handle_announce,
|
announce::handle_announce,
|
||||||
create_note::handle_create,
|
create::handle_create,
|
||||||
delete::handle_delete,
|
delete::handle_delete,
|
||||||
follow::handle_follow,
|
follow::handle_follow,
|
||||||
like::handle_like,
|
like::handle_like,
|
||||||
move_person::handle_move_person,
|
r#move::handle_move,
|
||||||
reject_follow::handle_reject_follow,
|
reject::handle_reject,
|
||||||
remove::handle_remove,
|
remove::handle_remove,
|
||||||
undo::handle_undo,
|
undo::handle_undo,
|
||||||
update::handle_update,
|
update::handle_update,
|
||||||
|
@ -211,11 +211,11 @@ pub async fn receive_activity(
|
||||||
let maybe_object_type = match activity_type.as_str() {
|
let maybe_object_type = match activity_type.as_str() {
|
||||||
ACCEPT => {
|
ACCEPT => {
|
||||||
require_actor_signature(&activity.actor, &signer_id)?;
|
require_actor_signature(&activity.actor, &signer_id)?;
|
||||||
handle_accept_follow(config, db_client, activity).await?
|
handle_accept(config, db_client, activity).await?
|
||||||
},
|
},
|
||||||
REJECT => {
|
REJECT => {
|
||||||
require_actor_signature(&activity.actor, &signer_id)?;
|
require_actor_signature(&activity.actor, &signer_id)?;
|
||||||
handle_reject_follow(config, db_client, activity).await?
|
handle_reject(config, db_client, activity).await?
|
||||||
},
|
},
|
||||||
CREATE => {
|
CREATE => {
|
||||||
handle_create(config, db_client, activity, &signer_id).await?
|
handle_create(config, db_client, activity, &signer_id).await?
|
||||||
|
@ -249,7 +249,7 @@ pub async fn receive_activity(
|
||||||
},
|
},
|
||||||
MOVE => {
|
MOVE => {
|
||||||
require_actor_signature(&activity.actor, &signer_id)?;
|
require_actor_signature(&activity.actor, &signer_id)?;
|
||||||
handle_move_person(config, db_client, activity).await?
|
handle_move(config, db_client, activity).await?
|
||||||
},
|
},
|
||||||
ADD => {
|
ADD => {
|
||||||
require_actor_signature(&activity.actor, &signer_id)?;
|
require_actor_signature(&activity.actor, &signer_id)?;
|
||||||
|
|
Loading…
Reference in a new issue