Skip to content

Commit

Permalink
Fix wrong score incrementation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
DefiPanda committed Jan 3, 2015
1 parent 4136099 commit 6530b7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/controllers/post_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

1 comment on commit 6530b7d

@DefiPanda
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug是如果是管理员删的帖子,就会扣管理员的分数。这个Patch修复了这个Bug。

Please sign in to comment.