Limit users to 50 lists, remove pagination from lists API (#5933)
This commit is contained in:
parent
f08e6e9ab5
commit
2f4c5f504f
4 changed files with 15 additions and 42 deletions
|
@ -13,6 +13,8 @@
|
|||
class List < ApplicationRecord
|
||||
include Paginable
|
||||
|
||||
PER_ACCOUNT_LIMIT = 50
|
||||
|
||||
belongs_to :account
|
||||
|
||||
has_many :list_accounts, inverse_of: :list, dependent: :destroy
|
||||
|
@ -20,6 +22,10 @@ class List < ApplicationRecord
|
|||
|
||||
validates :title, presence: true
|
||||
|
||||
validates_each :account_id, on: :create do |record, _attr, value|
|
||||
record.errors.add(:base, I18n.t('lists.errors.limit')) if List.where(account_id: value).count >= PER_ACCOUNT_LIMIT
|
||||
end
|
||||
|
||||
before_destroy :clean_feed_manager
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue