Sha256: 9e2ad6d42cf5045e7b1a3312b6ad1651ad253b49bd3fc359a61a6652805885fe

Contents?: true

Size: 739 Bytes

Versions: 6

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module PayloadInfo
    extend ActiveSupport::Concern
    include Decidim::TranslatableAttributes

    included do
      def append_info_to_payload(payload)
        super
        payload[:user_id] = try(:current_user).try(:id)
        payload[:organization_id] = try(:current_organization).try(:id)
        payload[:app] = translated_attribute(try(:current_organization).try(:name))
        payload[:remote_ip] = request.remote_ip
        payload[:referer] = request.referer.to_s
        payload[:request_id] = request.uuid
        payload[:user_agent] = request.user_agent
        payload[:xhr] = request.xhr? ? "true" : "false"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/controllers/concerns/decidim/payload_info.rb
decidim-core-0.29.0 app/controllers/concerns/decidim/payload_info.rb
decidim-core-0.29.0.rc4 app/controllers/concerns/decidim/payload_info.rb
decidim-core-0.29.0.rc3 app/controllers/concerns/decidim/payload_info.rb
decidim-core-0.29.0.rc2 app/controllers/concerns/decidim/payload_info.rb
decidim-core-0.29.0.rc1 app/controllers/concerns/decidim/payload_info.rb