From 7f69abf6c04b41f39aeb061f2f2fc669d166c85a Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 25 Mar 2024 02:27:31 +0100 Subject: [PATCH] fix: cleanup --- src/activitypub/user/outbox.rs | 30 +++++++++++------------------- src/auth.rs | 2 +- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/activitypub/user/outbox.rs b/src/activitypub/user/outbox.rs index 95b77574..403d5db6 100644 --- a/src/activitypub/user/outbox.rs +++ b/src/activitypub/user/outbox.rs @@ -1,7 +1,7 @@ use axum::{extract::{Path, Query, State}, http::StatusCode, Json}; -use sea_orm::{ColumnTrait, Condition, EntityTrait, Order, QueryFilter, QueryOrder, QuerySelect}; +use sea_orm::{EntityTrait, Order, QueryOrder, QuerySelect}; -use crate::{activitypub::{jsonld::LD, JsonLD, Pagination, PUBLIC_TARGET}, activitystream::{object::{activity::{accept::AcceptType, reject::RejectType, ActivityMut, ActivityType}, collection::{page::CollectionPageMut, CollectionMut, CollectionType}}, Base, BaseMut, BaseType, Node, ObjectType}, auth::{AuthIdentity, Identity}, model::{self, activity, object}, server::Context, url}; +use crate::{activitypub::{jsonld::LD, JsonLD, Pagination}, activitystream::{object::{activity::ActivityMut, collection::{page::CollectionPageMut, CollectionMut, CollectionType}}, Base, BaseMut, BaseType, Node}, auth::{AuthIdentity, Identity}, model::{activity, object}, server::Context, url}; pub async fn get( State(ctx): State, @@ -20,29 +20,21 @@ pub async fn page( State(ctx): State, Path(id): Path, Query(page): Query, - AuthIdentity(auth): AuthIdentity, + AuthIdentity(_auth): AuthIdentity, ) -> Result, StatusCode> { let limit = page.batch.unwrap_or(20).min(50); let offset = page.offset.unwrap_or(0); - let mut conditions = Condition::any() - .add(model::addressing::Column::Actor.eq(PUBLIC_TARGET)); + // let mut conditions = Condition::any() + // .add(model::addressing::Column::Actor.eq(PUBLIC_TARGET)); - if let Identity::User(x) = auth { - conditions = conditions.add(model::addressing::Column::Actor.eq(x)); - } - - if let Identity::Server(x) = auth { - conditions = conditions.add(model::addressing::Column::Server.eq(x)); - } - - let x = model::addressing::Entity::find() - .filter(conditions) - .inner_join(model::activity::Entity) - .left_join(model::object::Entity) - .all(ctx.db()) - .await; + // if let Identity::User(ref x) = auth { + // conditions = conditions.add(model::addressing::Column::Actor.eq(x)); + // } + // if let Identity::Server(ref x) = auth { + // conditions = conditions.add(model::addressing::Column::Server.eq(x)); + // } match activity::Entity::find() .find_also_related(object::Entity) diff --git a/src/auth.rs b/src/auth.rs index 2d40582c..b5583d90 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1,4 +1,4 @@ -use axum::{extract::{FromRef, FromRequestParts}, http::{header::{self, HeaderValue, USER_AGENT}, request::Parts, StatusCode}}; +use axum::{extract::{FromRef, FromRequestParts}, http::{header, request::Parts, StatusCode}}; use sea_orm::{ColumnTrait, Condition, EntityTrait, QueryFilter}; use crate::{model, server::Context};