Class: Decidim::Admin::InviteAdmin

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-admin/app/commands/decidim/admin/invite_admin.rb

Overview

A command to invite an admin.

Instance Method Summary collapse

Constructor Details

#initialize(form) ⇒ InviteAdmin

Public: Initializes the command.

form - A form object with the params.


10
11
12
# File 'decidim-admin/app/commands/decidim/admin/invite_admin.rb', line 10

def initialize(form)
  @form = form
end

Instance Method Details

#callObject


14
15
16
17
18
19
20
21
22
23
# File 'decidim-admin/app/commands/decidim/admin/invite_admin.rb', line 14

def call
  return broadcast(:invalid) if form.invalid?

  transaction do
    invite_user
    log_action
  end

  broadcast(:ok)
end