Give reshare and like ap_url before inserting (#369)

Fix #367
This commit is contained in:
fdb-hiroshima
2018-12-23 11:13:02 +01:00
committed by GitHub
parent 0ea1d57e48
commit 0df9c4d400
4 changed files with 24 additions and 42 deletions
+1 -6
View File
@@ -18,12 +18,7 @@ pub fn create(blog: String, slug: String, user: User, conn: DbConn, worker: Work
let post = Post::find_by_slug(&*conn, &slug, b.id)?;
if !user.has_liked(&*conn, &post) {
let like = likes::Like::insert(&*conn, likes::NewLike {
post_id: post.id,
user_id: user.id,
ap_url: "".to_string()
});
like.update_ap_url(&*conn);
let like = likes::Like::insert(&*conn, likes::NewLike::new(&post ,&user));
like.notify(&*conn);
let dest = User::one_by_instance(&*conn);
+1 -6
View File
@@ -18,12 +18,7 @@ pub fn create(blog: String, slug: String, user: User, conn: DbConn, worker: Work
let post = Post::find_by_slug(&*conn, &slug, b.id)?;
if !user.has_reshared(&*conn, &post) {
let reshare = Reshare::insert(&*conn, NewReshare {
post_id: post.id,
user_id: user.id,
ap_url: "".to_string()
});
reshare.update_ap_url(&*conn);
let reshare = Reshare::insert(&*conn, NewReshare::new(&post, &user));
reshare.notify(&*conn);
let dest = User::one_by_instance(&*conn);