Rename modules

This commit is contained in:
silverpill 2022-12-07 20:26:51 +00:00
parent e0053f19c7
commit d3db42ec9e
8 changed files with 19 additions and 16 deletions

View file

@ -7,7 +7,7 @@ use crate::activitypub::{
activity::Object,
actors::types::{Actor, ActorAddress},
handlers::{
create_note::handle_note,
create::handle_note,
update_person::update_remote_profile,
},
identifiers::parse_local_object_id,

View file

@ -16,11 +16,12 @@ use crate::models::relationships::queries::{
use crate::models::relationships::types::FollowRequestStatus;
use super::HandlerResult;
pub async fn handle_accept_follow(
pub async fn handle_accept(
config: &Config,
db_client: &mut impl GenericClient,
activity: Activity,
) -> HandlerResult {
// Accept(Follow)
let actor_profile = get_profile_by_remote_actor_id(
db_client,
&activity.actor,

View file

@ -3,15 +3,15 @@ pub use super::receiver::HandlerError;
// or None if it has been ignored
pub type HandlerResult = Result<Option<&'static str>, HandlerError>;
pub mod accept_follow;
pub mod accept;
pub mod add;
pub mod announce;
pub mod create_note;
pub mod create;
pub mod delete;
pub mod follow;
pub mod like;
pub mod move_person;
pub mod reject_follow;
pub mod r#move;
pub mod reject;
pub mod remove;
pub mod undo;
mod undo_follow;

View file

@ -26,11 +26,12 @@ use crate::models::{
};
use super::HandlerResult;
pub async fn handle_move_person(
pub async fn handle_move(
config: &Config,
db_client: &mut impl GenericClient,
activity: Activity,
) -> HandlerResult {
// Move(Person)
let object_id = find_object_id(&activity.object)?;
let target_value = activity.target
.ok_or(ValidationError("target is missing"))?;

View file

@ -16,11 +16,12 @@ use crate::models::relationships::queries::{
use crate::models::relationships::types::FollowRequestStatus;
use super::HandlerResult;
pub async fn handle_reject_follow(
pub async fn handle_reject(
config: &Config,
db_client: &impl GenericClient,
activity: Activity,
) -> HandlerResult {
// Reject(Follow)
let actor_profile = get_profile_by_remote_actor_id(
db_client,
&activity.actor,

View file

@ -10,7 +10,7 @@ use crate::models::posts::queries::{
};
use crate::models::posts::types::PostUpdateData;
use super::HandlerResult;
use super::create_note::get_note_content;
use super::create::get_note_content;
pub async fn handle_update_note(
db_client: &mut impl GenericClient,

View file

@ -18,15 +18,15 @@ use super::authentication::{
};
use super::fetcher::fetchers::FetchError;
use super::handlers::{
accept_follow::handle_accept_follow,
accept::handle_accept,
add::handle_add,
announce::handle_announce,
create_note::handle_create,
create::handle_create,
delete::handle_delete,
follow::handle_follow,
like::handle_like,
move_person::handle_move_person,
reject_follow::handle_reject_follow,
r#move::handle_move,
reject::handle_reject,
remove::handle_remove,
undo::handle_undo,
update::handle_update,
@ -211,11 +211,11 @@ pub async fn receive_activity(
let maybe_object_type = match activity_type.as_str() {
ACCEPT => {
require_actor_signature(&activity.actor, &signer_id)?;
handle_accept_follow(config, db_client, activity).await?
handle_accept(config, db_client, activity).await?
},
REJECT => {
require_actor_signature(&activity.actor, &signer_id)?;
handle_reject_follow(config, db_client, activity).await?
handle_reject(config, db_client, activity).await?
},
CREATE => {
handle_create(config, db_client, activity, &signer_id).await?
@ -249,7 +249,7 @@ pub async fn receive_activity(
},
MOVE => {
require_actor_signature(&activity.actor, &signer_id)?;
handle_move_person(config, db_client, activity).await?
handle_move(config, db_client, activity).await?
},
ADD => {
require_actor_signature(&activity.actor, &signer_id)?;