app/commands/decidim/admin/promote_managed_user.rb in decidim-admin-0.28.4 vs app/commands/decidim/admin/promote_managed_user.rb in decidim-admin-0.29.0.rc1

- old
+ new

@@ -6,19 +6,18 @@ # # Managed users can be promoted to standard users. It means they # will be invited to the application and will lose the managed flag # so the user cannot be impersonated anymore. class PromoteManagedUser < Decidim::Command + delegate :current_user, to: :form # Public: Initializes the command. # # form - A form object with the params. # user - The user to promote - # promoted_by - The user performing the operation - def initialize(form, user, promoted_by) + def initialize(form, user) @form = form @user = user - @promoted_by = promoted_by end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. @@ -33,21 +32,21 @@ create_action_log broadcast(:ok) end - attr_reader :form, :user, :promoted_by + attr_reader :form, :user private def promote_user user.email = form.email.downcase user.skip_reconfirmation! user.save(validate: false) end def invite_user - user.invite!(promoted_by) + user.invite!(current_user) end def email_already_exists? Decidim::User.where(email: form.email.downcase).any? end