|
|
@ -188,10 +188,10 @@ class ContestsController < ApplicationController
|
|
|
|
# Added by Longjun
|
|
|
|
# Added by Longjun
|
|
|
|
def destroy_contest
|
|
|
|
def destroy_contest
|
|
|
|
@contest = Contest.find(params[:id])
|
|
|
|
@contest = Contest.find(params[:id])
|
|
|
|
if @contest.author_id == User.current.id
|
|
|
|
if @contest.author_id == User.current.id || User.current.admin?
|
|
|
|
|
|
|
|
|
|
|
|
@contest.destroy
|
|
|
|
@contest.destroy
|
|
|
|
redirect_to action: 'index'
|
|
|
|
redirect_to welcome_contest_url
|
|
|
|
else
|
|
|
|
else
|
|
|
|
render_403 :message => :notice_not_contest_delete_authorized
|
|
|
|
render_403 :message => :notice_not_contest_delete_authorized
|
|
|
|
end
|
|
|
|
end
|
|
|
|