Sha256: 1fdcd74b515a7ea79fcb8a86e03f4d4fa71ba404cb7e71e53ac47f3675eb7fe3
Contents?: true
Size: 1012 Bytes
Versions: 16
Compression:
Stored size: 1012 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 # current_user - the user performing the action def initialize(user_group, current_user) @user_group = user_group @current_user = current_user 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 Decidim.traceability.perform_action!( "verify", @user_group, @current_user ) do @user_group.update!(verified_at: Time.current, rejected_at: nil) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems