diff --git a/src/activitypub/user/following.rs b/src/activitypub/user/following.rs index ff75f610..52360fe7 100644 --- a/src/activitypub/user/following.rs +++ b/src/activitypub/user/following.rs @@ -3,20 +3,20 @@ use sea_orm::{ColumnTrait, Condition, EntityTrait, PaginatorTrait, QueryFilter, use crate::{activitypub::{jsonld::LD, JsonLD, Pagination}, activitystream::{object::collection::{page::CollectionPageMut, CollectionMut, CollectionType}, BaseMut, Node}, model, server::Context, url}; -pub async fn follow___( +pub async fn follow___( State(ctx): State, Path(id): Path, Query(page): Query, ) -> Result, StatusCode> { - let follow___ = if out { "following" } else { "followers" }; + let follow___ = if OUTGOING { "following" } else { "followers" }; let limit = page.batch.unwrap_or(20).min(50); let offset = page.offset.unwrap_or(0); if let Some(true) = page.page { use model::relation::Column::{Following, Follower}; match model::relation::Entity::find() - .filter(Condition::all().add(if out { Follower } else { Following }.eq(id.clone()))) - .select_column(if out { Following } else { Follower }) + .filter(Condition::all().add(if OUTGOING { Follower } else { Following }.eq(id.clone()))) + .select_column(if OUTGOING { Following } else { Follower }) .limit(limit) .offset(page.offset.unwrap_or(0)) .all(ctx.db()).await diff --git a/src/migrations/m20240322_000002_add_likes_shares.rs b/src/migrations/m20240322_000002_add_likes_shares.rs index 24311ea2..54361a8a 100644 --- a/src/migrations/m20240322_000002_add_likes_shares.rs +++ b/src/migrations/m20240322_000002_add_likes_shares.rs @@ -60,6 +60,7 @@ impl MigrationTrait for Migration { } #[derive(DeriveIden)] +#[allow(clippy::enum_variant_names)] enum Likes { Table, Id, @@ -69,6 +70,7 @@ enum Likes { } #[derive(DeriveIden)] +#[allow(clippy::enum_variant_names)] enum Shares { Table, Id, diff --git a/src/migrations/m20240322_000003_add_indexes.rs b/src/migrations/m20240322_000003_add_indexes.rs index 825376aa..3469e4a5 100644 --- a/src/migrations/m20240322_000003_add_indexes.rs +++ b/src/migrations/m20240322_000003_add_indexes.rs @@ -140,6 +140,7 @@ impl MigrationTrait for Migration { } #[derive(DeriveIden)] +#[allow(clippy::enum_variant_names)] enum Likes { Table, Actor, @@ -147,6 +148,7 @@ enum Likes { } #[derive(DeriveIden)] +#[allow(clippy::enum_variant_names)] enum Shares { Table, Actor, diff --git a/src/model/user.rs b/src/model/user.rs index 47b2787d..ef1da4db 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -1,12 +1,7 @@ use sea_orm::entity::prelude::*; -use crate::activitypub::jsonld::LD; -use crate::activitystream::key::{PublicKey as _, PublicKeyMut as _}; -use crate::activitystream::object::actor::ActorMut as _; -use crate::activitystream::object::document::{DocumentMut as _, DocumentType}; +use crate::activitystream::key::PublicKey as _; -use crate::activitystream::object::ObjectMut as _; -use crate::activitystream::{BaseMut as _, Object as _}; -use crate::{activitypub, activitystream::{object::actor::ActorType, BaseType, Node, ObjectType}}; +use crate::{activitypub, activitystream::object::actor::{Actor, ActorType}}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "users")] @@ -40,7 +35,6 @@ pub struct Model { // pub streams: Option, } -use crate::activitystream::object::{actor::Actor, collection::Collection, document::Image}; #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {