1 # frozen_string_literal: true
 
   5     class RedactionsController < ApiController
 
   6       before_action :check_api_writable
 
   7       before_action :authorize
 
   9       authorize_resource :class => :element_version_redaction
 
  11       before_action :lookup_old_element
 
  14         redaction_id = params["redaction"]
 
  16           redaction = Redaction.find(redaction_id.to_i)
 
  17           @old_element.redact!(redaction)
 
  19         elsif params["allow_delete"]
 
  20           # legacy unredact if no redaction ID was provided for /api/0.6/:element_type/:id/:version/redact paths mapped here
 
  23           raise OSM::APIBadUserInput, "No redaction was given" unless redaction_id
 
  28         @old_element.redact!(nil)