Sha256: 1f8da0dc924ace3922c847a1a2ca72434bb319ca6abad2284c91f0cc2b880e19

Contents?: true

Size: 537 Bytes

Versions: 24

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

module Thredded
  # @api private
  module NewPrivateTopicParams
    protected

    def new_private_topic_params
      params
        .fetch(:private_topic, {})
        .permit(:title, :content, :user_names, user_ids: [])
        .merge(
          user: thredded_current_user,
        ).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

24 entries across 24 versions & 1 rubygems

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