Class: Decidim::Admin::UpdateExternalDomainAllowlist

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(form, organization) ⇒ UpdateExternalDomainAllowlist

Returns a new instance of UpdateExternalDomainAllowlist.



10
11
12
13
# File 'app/commands/decidim/admin/update_external_domain_allowlist.rb', line 10

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

Instance Attribute Details

#formObject (readonly)

Returns the value of attribute form.



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

def form
  @form
end

#organizationObject (readonly)

Returns the value of attribute organization.



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

def organization
  @organization
end

Instance Method Details

#callObject



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

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

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

  broadcast(:ok)
end