Sha256: 47307097e737874fffbbcf3ab2675a8d5cb30b138c8dba966a14b7dc53aa39bb

Contents?: true

Size: 463 Bytes

Versions: 14

Compression:

Stored size: 463 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)
        .merge(ip: request.remote_ip).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

14 entries across 14 versions & 2 rubygems

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