mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-25 19:40:31 +00:00
Implement activity_pub::Actor for models::blogs::Blog
This commit is contained in:
parent
74ce9aeec0
commit
ab66886093
2 changed files with 18 additions and 2 deletions
|
@ -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 a new issue