Sha256: 5aa90e82e34233f3de335410e2dde2777cd835a0a80c31a10035a811d8a4fde8

Contents?: true

Size: 1012 Bytes

Versions: 3

Compression:

Stored size: 1012 Bytes

Contents

# frozen-string_literal: true

module Decidim
  module Verifications
    class ManagedUserErrorEvent < Decidim::Events::SimpleEvent
      include Rails.application.routes.mounted_helpers

      delegate :profile_path, :profile_url, :name, to: :updated_user

      def i18n_scope
        "decidim.events.verifications.verify_with_managed_user"
      end

      delegate :conflicts_path, to: :decidim_admin

      def resource_path
        profile_path
      end

      def resource_url
        profile_url
      end

      def resource_title
        updated_user.name
      end

      def default_i18n_options
        super.merge({ conflicts_path: conflicts_path, managed_user_path: managed_user.profile_path, managed_user_name: managed_user.name })
      end

      private

      def updated_user
        @updated_user ||= Decidim::UserPresenter.new(resource.current_user)
      end

      def managed_user
        @managed_user ||= Decidim::UserPresenter.new(resource.managed_user)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-verifications-0.27.0.rc1 app/events/decidim/verifications/managed_user_error_event.rb
decidim-verifications-0.26.2 app/events/decidim/verifications/managed_user_error_event.rb
decidim-verifications-0.26.1 app/events/decidim/verifications/managed_user_error_event.rb