users: give all users unlimited favorites.
Let all users have unlimited favorites. Formerly the limit was 10k favorites for regular members, 20k for Gold, and unlimited for Platinum. Limiting favorites doesn't make sense since upvotes are unlimited.
This commit is contained in:
@@ -29,9 +29,7 @@ class Favorite < ApplicationRecord
|
||||
Favorite.transaction do
|
||||
User.where(id: user.id).select("id").lock("FOR UPDATE").first
|
||||
|
||||
if user.favorite_count >= user.favorite_limit
|
||||
raise Error, "You can only keep up to #{user.favorite_limit} favorites. Upgrade your account to save more."
|
||||
elsif Favorite.for_user(user.id).where(:user_id => user.id, :post_id => post.id).exists?
|
||||
if Favorite.for_user(user.id).where(:user_id => user.id, :post_id => post.id).exists?
|
||||
raise Error, "You have already favorited this post"
|
||||
end
|
||||
|
||||
|
||||
@@ -436,16 +436,6 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def favorite_limit(level)
|
||||
if level >= User::Levels::PLATINUM
|
||||
Float::INFINITY
|
||||
elsif level == User::Levels::GOLD
|
||||
20_000
|
||||
else
|
||||
10_000
|
||||
end
|
||||
end
|
||||
|
||||
def favorite_group_limit(level)
|
||||
if level >= User::Levels::BUILDER
|
||||
Float::INFINITY
|
||||
@@ -514,10 +504,6 @@ class User < ApplicationRecord
|
||||
User.tag_query_limit(level)
|
||||
end
|
||||
|
||||
def favorite_limit
|
||||
User.favorite_limit(level)
|
||||
end
|
||||
|
||||
def favorite_group_limit
|
||||
User.favorite_group_limit(level)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user