Sha256: 7f768a71770e723100f48dac14ebdc645edd9c43598fb2b48ec3f30de992cef1

Contents?: true

Size: 434 Bytes

Versions: 24

Compression:

Stored size: 434 Bytes

Contents

# frozen_string_literal: true

module Thredded
  # @api private
  module NewPostParams
    protected

    def new_post_params
      params.fetch(:post, {})
        .permit(:content, :quote_post_id)
        .tap do |p|
        quote_id = p.delete(:quote_post_id)
        if quote_id
          post = Thredded::Post.find(quote_id)
          authorize_reading post
          p[:quote_post] = post
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
thredded-1.1.0 app/controllers/concerns/thredded/new_post_params.rb
thredded-1.0.1 app/controllers/concerns/thredded/new_post_params.rb
thredded-1.0.0 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.16 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.15 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.14 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.13 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.12 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.11 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.10 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.9 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.8 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.7 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.6 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.5 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.4 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.3 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.1 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.16.0 app/controllers/concerns/thredded/new_post_params.rb
thredded-0.15.5 app/controllers/concerns/thredded/new_post_params.rb