Add a button to reshare
This commit is contained in:
@@ -17,6 +17,7 @@ use models::{
|
||||
blogs::Blog,
|
||||
likes::Like,
|
||||
post_authors::PostAuthor,
|
||||
reshares::Reshare,
|
||||
users::User
|
||||
};
|
||||
use schema::posts;
|
||||
@@ -127,6 +128,13 @@ impl Post {
|
||||
.expect("Couldn't load likes associted to post")
|
||||
}
|
||||
|
||||
pub fn get_reshares(&self, conn: &PgConnection) -> Vec<Reshare> {
|
||||
use schema::reshares;
|
||||
reshares::table.filter(reshares::post_id.eq(self.id))
|
||||
.load::<Reshare>(conn)
|
||||
.expect("Couldn't load reshares associted to post")
|
||||
}
|
||||
|
||||
pub fn update_ap_url(&self, conn: &PgConnection) {
|
||||
if self.ap_url.len() == 0 {
|
||||
diesel::update(self)
|
||||
|
||||
Reference in New Issue
Block a user