Sha256: 7d7f80a37f433995df37896d0b92b3a5ac8b094f662709885da487869a36db1e

Contents?: true

Size: 491 Bytes

Versions: 4

Compression:

Stored size: 491 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 = PrivatePost.find(quote_id)
          authorize_reading post
          p[:quote_post] = post
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thredded-0.13.0 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.12.4 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.12.3 app/controllers/concerns/thredded/new_private_post_params.rb
thredded-0.12.2 app/controllers/concerns/thredded/new_private_post_params.rb