Sha256: a7da6fa5a635a6393048f81e2dbd1043a24b9e499e8493b9ff10c1660ba12fce

Contents?: true

Size: 633 Bytes

Versions: 13

Compression:

Stored size: 633 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # A form object used to block users or user groups on 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::UserBaseEntity.find_by(
          id: user_id,
          organization: current_organization
        )
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-admin-0.27.9 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.8 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.7 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.6 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.10 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.9 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.5 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.8 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.4 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.7 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.26.5 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.27.2 app/forms/decidim/admin/block_user_form.rb