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("fav_count = fav_count + 1", "id = #{post.id}")
|
||||||
Post.update_all("score = score + 1", "id = #{post.id}") if user.is_gold?
|
Post.update_all("score = score + 1", "id = #{post.id}") if user.is_gold?
|
||||||
post.append_user_to_fav_string(user.id)
|
post.append_user_to_fav_string(user.id)
|
||||||
user.add_favorite!(post)
|
User.update_all("favorite_count = favorite_count + 1", "id = #{user.id}")
|
||||||
user.increment!(:favorite_count)
|
|
||||||
post.add_favorite!(user)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.remove(post, user)
|
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("fav_count = fav_count - 1", "id = #{post.id}")
|
||||||
Post.update_all("score = score - 1", "id = #{post.id}") if user.is_gold?
|
Post.update_all("score = score - 1", "id = #{post.id}") if user.is_gold?
|
||||||
post.delete_user_from_fav_string(user.id)
|
post.delete_user_from_fav_string(user.id)
|
||||||
user.remove_favorite!(post)
|
User.update_all("favorite_count = favorite_count - 1", "id = #{user.id}")
|
||||||
user.decrement!(:favorite_count)
|
|
||||||
post.remove_favorite!(user)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user