Sha256: aaceff177ffec76994ac4dd06730e818c0e1056821db68b52b8bcea09f5479b7

Contents?: true

Size: 803 Bytes

Versions: 7

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    class ShareTokensController < Decidim::Admin::ApplicationController
      def destroy
        enforce_permission_to(:destroy, :share_token, share_token:)

        DestroyShareToken.call(share_token, current_user) do
          on(:ok) do
            flash[:notice] = I18n.t("share_tokens.destroy.success", scope: "decidim.admin")
          end
          on(:invalid) do
            flash[:error] = I18n.t("share_tokens.destroy.error", scope: "decidim.admin")
          end
        end

        redirect_back(fallback_location: root_path)
      end

      private

      def share_token
        @share_token ||= Decidim::ShareToken.where(
          organization: current_organization
        ).find(params[:id])
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-admin-0.28.4 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.3 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.2 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.1 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.0 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.0.rc5 app/controllers/decidim/admin/share_tokens_controller.rb
decidim-admin-0.28.0.rc4 app/controllers/decidim/admin/share_tokens_controller.rb