Sha256: 8e1c2b0a9c75d8cd1348589af379e03a77bb182652a3d86e8d819e01d9fca49c

Contents?: true

Size: 501 Bytes

Versions: 14

Compression:

Stored size: 501 Bytes

Contents

# frozen_string_literal: true

module Thredded
  # @api private
  module NewPrivatePostParams
    protected

    def new_private_post_params
      params.fetch(:post, {})
        .permit(:content, :quote_private_post_id)
        .merge(ip: request.remote_ip).tap do |p|
        quote_id = p.delete(:quote_private_post_id)
        if quote_id
          post = Thredded::PrivatePost.find(quote_id)
          authorize_reading post
          p[:quote_post] = post
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
threddedDANIEL-0.14.5 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.14.4 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.14.3 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.14.2 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.14.1 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.14.0 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.8 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.7 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.6 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.5 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.4 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.3 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.2 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.13.1 app/controllers/concerns/thredded/new_private_post_params.rb