Sha256: 89ff05b1813ffee1d40c97e1ed47c1b50c2efd2f074097f87935995e0cce18cd

Contents?: true

Size: 567 Bytes

Versions: 14

Compression:

Stored size: 567 Bytes

Contents

# frozen_string_literal: true

module Thredded
  # @api private
  module NewPrivateTopicParams
    protected

    def new_private_topic_params
      params
        .require(:private_topic)
        .permit(:title, :content, :user_names, user_ids: [])
        .merge(
          user: thredded_current_user,
          ip: request.remote_ip
        ).tap { |p| adapt_user_ids! p }
    end

    private

    # Allow a string of IDs joined with commas.
    def adapt_user_ids!(p)
      p[:user_ids] = p[:user_ids].split(',') if p[:user_ids].is_a?(String)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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