Sha256: ef14db3cda876ffd645b24975d9a4dfa5ee05c3e4d68745c204dd3b4d0fe7eb8
Contents?: true
Size: 907 Bytes
Versions: 3
Compression:
Stored size: 907 Bytes
Contents
# frozen_string_literal: true module Panda module CMS module Admin class UserActivityComponent < ViewComponent::Base attr_accessor :model attr_accessor :time attr_accessor :user # @param whodunnit_to [ActiveRecord::Base] Model instance to which the user activity is related def initialize(whodunnit_to: nil, at: nil, user: nil) if whodunnit_to @model = whodunnit_to whodunnit_id = @model.versions&.last&.whodunnit if whodunnit_id @user = User.find(whodunnit_id) @time = @model.updated_at end elsif user.is_a?(::Panda::CMS::User) && at.is_a?(::ActiveSupport::TimeWithZone) @user = user @time = at end if !@time @user = nil @time = nil end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems