From 6530b7d831e58b137f203b11399c6f7327560c0f Mon Sep 17 00:00:00 2001 From: jw2013 Date: Sat, 3 Jan 2015 12:36:59 -0800 Subject: [PATCH] Fix wrong score incrementation bug --- web/controllers/post_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/controllers/post_controller.ex b/web/controllers/post_controller.ex index b2ea033..2e01449 100644 --- a/web/controllers/post_controller.ex +++ b/web/controllers/post_controller.ex @@ -86,8 +86,8 @@ defmodule ElixirChina.PostController do post when is_map(post) -> (from n in Notification, where: n.post_id == ^String.to_integer(id)) |> Repo.delete_all (from comment in Comment, where: comment.post_id == ^String.to_integer(id)) |> Repo.delete_all + increment_score(Repo.get(User, post.user_id), -10) Repo.delete(post) - increment_score(Repo.get(User, get_user_id(conn)), -10) json conn, %{location: "/"} _ -> unauthorized conn