Sha256: bfb2f66473fe8acc9c07a316690e7e179def2d146e7d5c83565b7cc87908f858

Contents?: true

Size: 616 Bytes

Versions: 24

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # A form object used to officialize users from the admin dashboard.
    class BlockUserForm < Form
      attribute :user_id, Integer
      attribute :justification, String

      validates :user, presence: true
      validates :justification, presence: true, length: { minimum: UserBlock::MINIMUM_JUSTIFICATION_LENGTH }

      def map_model(user)
        self.user_id = user.id
      end

      def user
        @user ||= Decidim::User.find_by(
          id: user_id,
          organization: current_organization
        )
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-admin-0.27.1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.4 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.0 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.0.rc2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.0.rc1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.0 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.0.rc2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.0.rc1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.0 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.0.rc4 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.0.rc3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.0.rc2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.25.0.rc1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.24.3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.24.2 app/forms/decidim/admin/block_user_form.rb