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.6.8 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.8 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.7 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.7 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.6 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.6 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.5 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.5 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.4 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.4 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.3 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.3 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.2 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.2 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.1 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.1 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.6.0 app/commands/decidim/admin/reject_user_group.rb
decidim-0.6.0 decidim-admin/app/commands/decidim/admin/reject_user_group.rb
decidim-admin-0.5.1 app/commands/decidim/admin/reject_user_group.rb
decidim-0.5.1 decidim-admin/app/commands/decidim/admin/reject_user_group.rb