Use enum validation instead of ArgumentError rescue for List replies policy check (#34452)

This commit is contained in:
Matt Jankowski authored and GitHub committed 2025-04-14 21:11:10 +00:00
1 parent 5991caae87
commit 2eaef09166
3 files changed
+5 -6

No files matched your search

@@ -7,10 +7,6 @@ class Api::V1::ListsController < Api::BaseController
before_action :require_user!
before_action :set_list, except: [:index, :create]
rescue_from ArgumentError do |e|
render json: { error: e.to_s }, status: 422
end
def index
@lists = List.where(account: current_account).all
render json: @lists, each_serializer: REST::ListSerializer
+1 -1
View File
@@ -18,7 +18,7 @@ class List < ApplicationRecord
PER_ACCOUNT_LIMIT = 50
enum :replies_policy, { list: 0, followed: 1, none: 2 }, prefix: :show
enum :replies_policy, { list: 0, followed: 1, none: 2 }, prefix: :show, validate: true
belongs_to :account