Implement Deletable for Reshare

This commit is contained in:
Bat 2018-06-19 10:47:11 +01:00
parent 78be09c47c
commit 82d3afe7b6

View File

@ -2,7 +2,7 @@ use activitypub::activity::{Announce, Undo};
use chrono::NaiveDateTime;
use diesel::{self, PgConnection, QueryDsl, RunQueryDsl, ExpressionMethods};
use activity_pub::{Id, IntoId, actor::Actor, inbox::{FromActivity, Notify}, object::Object};
use activity_pub::{Id, IntoId, actor::Actor, inbox::{FromActivity, Notify, Deletable}, object::Object};
use models::{notifications::*, posts::Post, users::User};
use schema::reshares;
@ -102,3 +102,14 @@ impl Notify<Announce> for Reshare {
}
}
}
impl Deletable for Reshare {
fn delete_activity(conn: &PgConnection, id: Id) -> bool {
if let Some(reshare) = Reshare::find_by_ap_url(conn, id.into()) {
reshare.delete(conn);
true
} else {
false
}
}
}