Sha256: cf3fbf8ad286a1cc9502189fcc86eeda4b9acfbf74c00615d7d5228341032e15

Contents?: true

Size: 680 Bytes

Versions: 13

Compression:

Stored size: 680 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
      attribute :hide, Boolean, default: false

      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.29.1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.4 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.29.0 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.29.0.rc4 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.29.0.rc3 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.29.0.rc2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.29.0.rc1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.2 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.1 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.0 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.0.rc5 app/forms/decidim/admin/block_user_form.rb
decidim-admin-0.28.0.rc4 app/forms/decidim/admin/block_user_form.rb