User outbox
This commit is contained in:
parent
e592e692ff
commit
80472506ca
@ -59,6 +59,7 @@ fn main() {
|
|||||||
routes::user::me,
|
routes::user::me,
|
||||||
routes::user::details,
|
routes::user::details,
|
||||||
routes::user::activity_details,
|
routes::user::activity_details,
|
||||||
|
routes::user::outbox,
|
||||||
routes::user::new,
|
routes::user::new,
|
||||||
routes::user::create,
|
routes::user::create,
|
||||||
|
|
||||||
|
@ -3,7 +3,9 @@ use diesel::{self, QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
|
|||||||
use rocket::request::{self, FromRequest, Request};
|
use rocket::request::{self, FromRequest, Request};
|
||||||
use rocket::outcome::IntoOutcome;
|
use rocket::outcome::IntoOutcome;
|
||||||
|
|
||||||
|
use activity_pub::activity::Activity;
|
||||||
use activity_pub::actor::{ActorType, Actor};
|
use activity_pub::actor::{ActorType, Actor};
|
||||||
|
use activity_pub::outbox::Outbox;
|
||||||
use activity_pub::webfinger::Webfinger;
|
use activity_pub::webfinger::Webfinger;
|
||||||
use db_conn::DbConn;
|
use db_conn::DbConn;
|
||||||
use models::instance::Instance;
|
use models::instance::Instance;
|
||||||
@ -94,6 +96,14 @@ impl User {
|
|||||||
.get_result::<User>(conn).expect("Couldn't update outbox URL");
|
.get_result::<User>(conn).expect("Couldn't update outbox URL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn outbox(&self, conn: &PgConnection) -> Outbox {
|
||||||
|
Outbox::new(self.compute_outbox(conn), self.get_activities())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_activities(&self) -> Vec<Activity> {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'r> FromRequest<'a, 'r> for User {
|
impl<'a, 'r> FromRequest<'a, 'r> for User {
|
||||||
|
@ -5,6 +5,7 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use activity_pub::ActivityPub;
|
use activity_pub::ActivityPub;
|
||||||
use activity_pub::actor::Actor;
|
use activity_pub::actor::Actor;
|
||||||
|
use activity_pub::outbox::Outbox;
|
||||||
use db_conn::DbConn;
|
use db_conn::DbConn;
|
||||||
use models::instance::Instance;
|
use models::instance::Instance;
|
||||||
use models::users::*;
|
use models::users::*;
|
||||||
@ -57,3 +58,9 @@ fn create(conn: DbConn, data: Form<NewUserForm>) -> Redirect {
|
|||||||
|
|
||||||
Redirect::to(format!("/@/{}", data.get().username).as_str())
|
Redirect::to(format!("/@/{}", data.get().username).as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[get("/@/<name>/outbox")]
|
||||||
|
fn outbox(name: String, conn: DbConn) -> Outbox {
|
||||||
|
let user = User::find_by_name(&*conn, name).unwrap();
|
||||||
|
user.outbox(&*conn)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user