Sha256: 4909a3a8be48b02305f8d09af3d956db1dbb30fe389807b1b876eb8fc3bf69b2

Contents?: true

Size: 846 Bytes

Versions: 40

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # A command with all the business logic when rejecting a user_group.
    class RejectUserGroup < Rectify::Command
      # Public: Initializes the command.
      #
      # user_group - The user_group to reject
      def initialize(user_group)
        @user_group = user_group
      end

      # Executes the command. Broadcasts these events:
      #
      # - :ok when everything is valid.
      # - :invalid if the form wasn't valid and we couldn't proceed.
      #
      # Returns nothing.
      def call
        return broadcast(:invalid) unless @user_group.valid?
        reject_user_group
        broadcast(:ok)
      end

      private

      def reject_user_group
        @user_group.update_attributes(rejected_at: Time.current, verified_at: nil)
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
decidim-admin-0.5.0 app/commands/decidim/admin/reject_user_group.rb
decidim-0.5.0 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.4.4 app/commands/decidim/admin/reject_user_group.rb
decidim-0.4.4 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.4.3 app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.4.2 app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.4.1 app/commands/decidim/admin/reject_user_group.rb
decidim-0.4.3 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-0.4.2 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-0.4.1 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.4.0 app/commands/decidim/admin/reject_user_group.rb
decidim-0.4.0 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.3.2 app/commands/decidim/admin/reject_user_group.rb
decidim-0.3.2 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.3.1 app/commands/decidim/admin/reject_user_group.rb
decidim-0.3.1 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.3.0 app/commands/decidim/admin/reject_user_group.rb
decidim-0.3.0 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.2.0 app/commands/decidim/admin/reject_user_group.rb
decidim-0.2.0 decidim-admin/app/commands/decidim/admin/reject_user_group.rb