chore: better comments, unreachable!()

This commit is contained in:
əlemi 2024-06-22 04:34:22 +02:00
parent 62628ea076
commit ee12ef37ad
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -389,13 +389,13 @@ pub async fn announce(ctx: &crate::Context, activity: impl apb::Activity, tx: &D
} }
} }
} { } {
crate::context::Internal::Activity(_) => unreachable!(),
crate::context::Internal::Actor(_) => Err(ProcessorError::Unprocessable(activity.id()?.to_string())), crate::context::Internal::Actor(_) => Err(ProcessorError::Unprocessable(activity.id()?.to_string())),
crate::context::Internal::Activity(_) => Err(ProcessorError::AlreadyProcessed), // ???
crate::context::Internal::Object(internal) => { crate::context::Internal::Object(internal) => {
let actor = ctx.fetch_user(activity.actor().id()?, tx).await?; let actor = ctx.fetch_user(activity.actor().id()?, tx).await?;
// we only care about "organic" announces, as in those produced by people // we only care about announces produced by "Person" actors, because there's intention
// anything shared by groups, services or applications is just mirroring: fetch it and be done // anything shared by groups, services or applications is automated: fetch it and be done
if actor.actor_type == apb::ActorType::Person { if actor.actor_type == apb::ActorType::Person {
let share = crate::model::announce::ActiveModel { let share = crate::model::announce::ActiveModel {
internal: NotSet, internal: NotSet,