Sha256: 27b3957a3fb06dea5856ad028ed884d2f5f2fedaaf1cbfc964cd9d3f0365c1eb

Contents?: true

Size: 777 Bytes

Versions: 40

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

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

      # Executes the command. Broadcasts these events:
      #
      # - :ok when everything is valid.
      #
      # Returns nothing.
      def call
        return broadcast(:invalid) unless @user_group.valid?
        verify_user_group
        broadcast(:ok)
      end

      private

      def verify_user_group
        @user_group.update_attributes(verified_at: Time.current, rejected_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/verify_user_group.rb
decidim-0.6.8 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.7 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.7 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.6 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.6 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.5 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.5 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.4 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.4 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.3 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.3 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.2 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.2 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.1 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.1 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.6.0 app/commands/decidim/admin/verify_user_group.rb
decidim-0.6.0 decidim-admin/app/commands/decidim/admin/verify_user_group.rb
decidim-admin-0.5.1 app/commands/decidim/admin/verify_user_group.rb
decidim-0.5.1 decidim-admin/app/commands/decidim/admin/verify_user_group.rb