FIX: raise invalid params for bad callback

Corrects it so we raise a 400 instead of logged 500 error
This commit is contained in:
Sam 2018-06-29 10:43:33 +10:00
parent e0bc6590fd
commit 6a54da0902
1 changed files with 5 additions and 1 deletions

View File

@ -69,7 +69,11 @@ class GroupsController < ApplicationController
end
if type = params[:type]&.to_sym
groups = TYPE_FILTERS[type].call(groups, current_user)
callback = TYPE_FILTERS[type]
if !callback
raise Discourse::InvalidParameters.new(:type)
end
groups = callback.call(groups, current_user)
end
if current_user