mirror of
https://github.com/neocities/neocities.git
synced 2025-08-06 09:34:57 +02:00
event comment delete
This commit is contained in:
parent
a4a2b5165b
commit
8210670122
6 changed files with 47 additions and 16 deletions
13
app.rb
13
app.rb
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue