Class: Decidim::Admin::UpdateExternalDomainWhitelist

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(form, organization, user) ⇒ UpdateExternalDomainWhitelist

Returns a new instance of UpdateExternalDomainWhitelist.


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

def initialize(form, organization, user)
  @form = form
  @organization = organization
  @user = user
end

Instance Attribute Details

#formObject (readonly)

Returns the value of attribute form.


6
7
8
# File 'decidim-admin/app/commands/decidim/admin/update_external_domain_whitelist.rb', line 6

def form
  @form
end

#organizationObject (readonly)

Returns the value of attribute organization.


6
7
8
# File 'decidim-admin/app/commands/decidim/admin/update_external_domain_whitelist.rb', line 6

def organization
  @organization
end

Instance Method Details

#callObject


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

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

  Decidim.traceability.perform_action!("update_external_domain", @organization, @user) do
    save_domains!
  end

  broadcast(:ok)
end