List authors of a blog
Update french translation accordingly Fixes #129
This commit is contained in:
@@ -23,6 +23,7 @@ use plume_common::activity_pub::{
|
||||
sign
|
||||
};
|
||||
use instance::*;
|
||||
use users::User;
|
||||
use schema::blogs;
|
||||
|
||||
pub type CustomGroup = CustomObject<ApSignature, Group>;
|
||||
@@ -68,6 +69,15 @@ impl Blog {
|
||||
Instance::get(conn, self.instance_id).expect("Couldn't find instance")
|
||||
}
|
||||
|
||||
pub fn list_authors(&self, conn: &PgConnection) -> Vec<User> {
|
||||
use schema::blog_authors;
|
||||
use schema::users;
|
||||
let authors_ids = blog_authors::table.filter(blog_authors::blog_id.eq(self.id)).select(blog_authors::author_id);
|
||||
users::table.filter(users::id.eq(any(authors_ids)))
|
||||
.load::<User>(conn)
|
||||
.expect("Couldn't load authors of a blog")
|
||||
}
|
||||
|
||||
pub fn find_for_author(conn: &PgConnection, author_id: i32) -> Vec<Blog> {
|
||||
use schema::blog_authors;
|
||||
let author_ids = blog_authors::table.filter(blog_authors::author_id.eq(author_id)).select(blog_authors::blog_id);
|
||||
|
||||
Reference in New Issue
Block a user