Remove unnecessary ability from adminAbilities

CanCanCan can load @events and @event in EventsController by itself
This commit is contained in:
AEtherC0r3 2017-08-09 12:05:11 +03:00 committed by Stella Rouzi
parent c4eec6a3de
commit a87c6e55f7
4 changed files with 4 additions and 19 deletions

View file

@ -5,8 +5,6 @@ module Admin
load_and_authorize_resource :event, through: :program
load_and_authorize_resource :events_registration, only: :toggle_attendance
before_action :get_event, except: [:index, :create, :new]
# FIXME: The timezome should only be applied on output, otherwise
# you get lost in timezone conversions...
# around_filter :set_timezone_for_this_request
@ -16,7 +14,6 @@ module Admin
end
def index
@events = @program.events
@tracks = @program.tracks.confirmed.cfp_active
@difficulty_levels = @program.difficulty_levels
@event_types = @program.event_types
@ -187,16 +184,6 @@ module Admin
params.require(:comment).permit(:commentable, :body, :user_id)
end
def get_event
@event = @conference.program.events.find(params[:id])
unless @event
redirect_to admin_conference_program_events_path(conference_id: @conference.short_title),
error: 'Error! Could not find event!'
return
end
@event
end
def update_state(transition, notice, mail = false, subject = false, send_mail = false)
alert = @event.update_state(transition, mail, subject, send_mail, params[:send_mail].blank?)