event comment delete

This commit is contained in:
Kyle Drake 2014-05-02 22:45:57 -07:00
parent a4a2b5165b
commit 8210670122
6 changed files with 47 additions and 16 deletions

13
app.rb
View file

@ -896,6 +896,19 @@ post '/event/:event_id/delete' do |event_id|
return {result: 'error'}.to_json
end
post '/comment/:comment_id/delete' do |comment_id|
require_login
content_type :json
comment = Comment[id: comment_id]
if comment.event.site == current_site || comment.actioning_site == current_site
comment.delete
return {result: 'success'}.to_json
end
return {result: 'error'}.to_json
end
def require_admin
redirect '/' unless signed_in? && current_site.is_admin
end