Implement activity_pub::Actor for models::blogs::Blog
This commit is contained in:
parent
74ce9aeec0
commit
ab66886093
@ -1,8 +1,8 @@
|
||||
use models::instance::Instance;
|
||||
use diesel::PgConnection;
|
||||
|
||||
trait Actor {
|
||||
fn get_box_prefix() -> String;
|
||||
pub trait Actor {
|
||||
fn get_box_prefix() -> &'static str;
|
||||
|
||||
fn get_actor_id(&self) -> String;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
use diesel;
|
||||
use diesel::{QueryDsl, RunQueryDsl, ExpressionMethods, PgConnection};
|
||||
use schema::blogs;
|
||||
use activity_pub::Actor;
|
||||
use models::instance::Instance;
|
||||
|
||||
#[derive(Queryable, Identifiable)]
|
||||
pub struct Blog {
|
||||
@ -56,3 +58,17 @@ impl Blog {
|
||||
.into_iter().nth(0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Actor for Blog {
|
||||
fn get_box_prefix() -> &'static str {
|
||||
"~"
|
||||
}
|
||||
|
||||
fn get_actor_id(&self) -> String {
|
||||
self.actor_id.to_string()
|
||||
}
|
||||
|
||||
fn get_instance(&self, conn: &PgConnection) -> Instance {
|
||||
Instance::get(conn, self.instance_id).unwrap()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user