diff --git a/decidim-admin/app/commands/decidim/admin/update_share_token.rb b/decidim-admin/app/commands/decidim/admin/update_share_token.rb index 8bd67345ea6e..6334c5da65c3 100644 --- a/decidim-admin/app/commands/decidim/admin/update_share_token.rb +++ b/decidim-admin/app/commands/decidim/admin/update_share_token.rb @@ -2,10 +2,10 @@ module Decidim module Admin - # A command with all the business logic to create a taxonomy. + # A command with all the business logic to update a taxonomy. # This command is called from the controller. class UpdateShareToken < Decidim::Commands::UpdateResource - fetch_form_attributes :token, :expires_at, :organization, :user, :token_for + fetch_form_attributes :token, :expires_at end end end diff --git a/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb b/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb index ea51f388eeb4..e99fc1fbbc29 100644 --- a/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb @@ -35,7 +35,7 @@ def edit def update @form = form(ShareTokenForm).from_params(params, component:) - UpdateShareToken.call(@form) do + UpdateShareToken.call(@form, share_token) do on(:ok) do flash[:notice] = I18n.t("share_tokens.update.success", scope: "decidim.admin") redirect_to share_tokens_path(component) diff --git a/decidim-admin/app/views/decidim/admin/share_tokens/edit.html.erb b/decidim-admin/app/views/decidim/admin/share_tokens/edit.html.erb index beffe3ab1fb8..82c6a7489862 100644 --- a/decidim-admin/app/views/decidim/admin/share_tokens/edit.html.erb +++ b/decidim-admin/app/views/decidim/admin/share_tokens/edit.html.erb @@ -5,7 +5,7 @@
- <%= decidim_form_for(@form, html: { class: "form-defaults form edit_component_share_token" }) do |f| %> + <%= decidim_form_for(@form, url: component_share_token_path(id: share_token), html: { class: "form-defaults form edit_component_share_token" }) do |f| %>
<%= render partial: "form", object: f %> diff --git a/decidim-admin/config/locales/en.yml b/decidim-admin/config/locales/en.yml index c86aeae00b89..62ed37d176c2 100644 --- a/decidim-admin/config/locales/en.yml +++ b/decidim-admin/config/locales/en.yml @@ -991,6 +991,7 @@ en: help: These tokens are used to publicly share this unpublished resource to any user. They will be hidden when the resource is published. Click on the token's share icon to visit the shareable URL. title: Share tokens update: + error: There was a problem updating this token. invalid: There was a problem updating the token. success: Token updated successfully. shared: