Merge pull request #3433 from BrokenEagle/fix-fav-privacy

Fix incorrect showing of favorites and favorite groups with privacy settings enabled
This commit is contained in:
Albert Yi
2017-12-18 14:58:54 -08:00
committed by GitHub
4 changed files with 44 additions and 11 deletions

View File

@@ -400,12 +400,6 @@ class PostQueryBuilder
if q[:ordfav].present?
user_id = q[:ordfav].to_i
user = User.find(user_id)
if user.hide_favorites?
raise User::PrivilegeError.new
end
relation = relation.joins("INNER JOIN favorites ON favorites.post_id = posts.id")
relation = relation.where("favorites.user_id % 100 = ? and favorites.user_id = ?", user_id % 100, user_id).order("favorites.id DESC")
end