diff --git a/assets/javascripts/discourse/templates/admin-wizards-api.hbs b/assets/javascripts/discourse/templates/admin-wizards-api.hbs
index 32618101..6a0a8067 100644
--- a/assets/javascripts/discourse/templates/admin-wizards-api.hbs
+++ b/assets/javascripts/discourse/templates/admin-wizards-api.hbs
@@ -8,10 +8,10 @@
{{/if}}
{{/if}}
- {{d-button label="admin.wizard.api.save" action="save" class="btn-primary" disabled=saveDisabled}}
+ {{d-button label="admin.wizard.api.save" action=(action "save") class="btn-primary" disabled=saveDisabled}}
{{#if showRemove}}
- {{d-button action="remove" label="admin.wizard.api.remove"}}
+ {{d-button action=(action "remove") label="admin.wizard.api.remove"}}
{{/if}}
{{#if error}}
@@ -57,7 +57,7 @@
{{/if}}
{{/if}}
{{d-button label="admin.wizard.api.auth.btn"
- action="authorize"
+ action=(action "authorize")
disabled=authDisabled
class="btn-primary"}}
{{/if}}
@@ -131,10 +131,10 @@
{{input value=param.key placeholder=(i18n 'admin.wizard.api.auth.params.key')}}
{{input value=param.value placeholder=(i18n 'admin.wizard.api.auth.params.value')}}
- {{d-button action='removeParam' actionParam=param icon='times'}}
+ {{d-button action=(action "removeParam") actionParam=param icon='times'}}
{{/each}}
- {{d-button label='admin.wizard.api.auth.params.new' icon='plus' action='addParam'}}
+ {{d-button label='admin.wizard.api.auth.params.new' icon='plus' action=(action "addParam")}}
{{/if}}
@@ -219,7 +219,7 @@
- {{d-button action='addEndpoint' label='admin.wizard.api.endpoint.add' icon='plus'}}
+ {{d-button action=(action "addEndpoint") label='admin.wizard.api.endpoint.add' icon='plus'}}
{{#if api.endpoints}}
@@ -236,7 +236,7 @@
{{input value=endpoint.url
placeholder=(i18n 'admin.wizard.api.endpoint.url')
class='endpoint-url'}}
- {{d-button action='removeEndpoint'
+ {{d-button action=(action "removeEndpoint")
actionParam=endpoint
icon='times'
class='remove-endpoint'}}
@@ -251,7 +251,7 @@
diff --git a/lib/api/authorization.rb b/lib/api/authorization.rb
index 3c57a955..9dd51d50 100644
--- a/lib/api/authorization.rb
+++ b/lib/api/authorization.rb
@@ -32,6 +32,7 @@ class CustomWizard::Api::Authorization
end
def self.set(api_name, new_data = {})
+
api_name = api_name.underscore
data = self.get(api_name, data_only: true) || {}
@@ -40,6 +41,12 @@ class CustomWizard::Api::Authorization
data[k.to_sym] = v
end
+ data.each do |k, v|
+ unless new_data.key?(k.to_s)
+ data.delete(k)
+ end
+ end
+
PluginStore.set("custom_wizard_api_#{api_name}", 'authorization', data)
self.get(api_name)