Sha256: 95b76281f6fdfff0746ac9710a018b074788bcf4957428ded3f4550266a4a45a

Contents?: true

Size: 472 Bytes

Versions: 24

Compression:

Stored size: 472 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)
        .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

24 entries across 24 versions & 1 rubygems

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