potential fix for #1500
This commit is contained in:
@@ -13,9 +13,7 @@ class Favorite < ActiveRecord::Base
|
||||
Post.update_all("fav_count = fav_count + 1", "id = #{post.id}")
|
||||
Post.update_all("score = score + 1", "id = #{post.id}") if user.is_gold?
|
||||
post.append_user_to_fav_string(user.id)
|
||||
user.add_favorite!(post)
|
||||
user.increment!(:favorite_count)
|
||||
post.add_favorite!(user)
|
||||
User.update_all("favorite_count = favorite_count + 1", "id = #{user.id}")
|
||||
end
|
||||
|
||||
def self.remove(post, user)
|
||||
@@ -24,8 +22,6 @@ class Favorite < ActiveRecord::Base
|
||||
Post.update_all("fav_count = fav_count - 1", "id = #{post.id}")
|
||||
Post.update_all("score = score - 1", "id = #{post.id}") if user.is_gold?
|
||||
post.delete_user_from_fav_string(user.id)
|
||||
user.remove_favorite!(post)
|
||||
user.decrement!(:favorite_count)
|
||||
post.remove_favorite!(user)
|
||||
User.update_all("favorite_count = favorite_count - 1", "id = #{user.id}")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user