Stop checking for non-existing conference_id in versions controller
This commit is contained in:
parent
58a3913735
commit
5965bcf193
2 changed files with 0 additions and 11 deletions
|
|
@ -7,11 +7,6 @@ module Admin
|
||||||
@conf_ids_for_organizer = current_user.is_admin? ? Conference.pluck(:id) : Conference.with_role(:organizer, current_user).pluck(:id)
|
@conf_ids_for_organizer = current_user.is_admin? ? Conference.pluck(:id) : Conference.with_role(:organizer, current_user).pluck(:id)
|
||||||
@conference_id = params[:conference_id].to_i unless params[:conference_id].nil?
|
@conference_id = params[:conference_id].to_i unless params[:conference_id].nil?
|
||||||
|
|
||||||
unless @conference_id.nil? || Conference.exists?(id: @conference_id)
|
|
||||||
redirect_to admin_revision_history_path, error: "Conference with ID #{@conference_id} does not exist!"
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return unless @conference_id.present?
|
return unless @conference_id.present?
|
||||||
authorize! :index, PaperTrail::Version.new(conference_id: @conference_id)
|
authorize! :index, PaperTrail::Version.new(conference_id: @conference_id)
|
||||||
@versions = @versions.where(conference_id: @conference_id)
|
@versions = @versions.where(conference_id: @conference_id)
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,6 @@ describe Admin::VersionsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #index' do
|
describe 'GET #index' do
|
||||||
it 'raises error if conference_id is invalid' do
|
|
||||||
sign_in admin
|
|
||||||
get :index, conference_id: 88
|
|
||||||
expect(flash[:error]).to match('Conference with ID 88 does not exist!')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'raises error if user is not an organizer of specified conference' do
|
it 'raises error if user is not an organizer of specified conference' do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue