fix: capture user and ip details on Inbox delete (#7395)
Fixes: https://linear.app/chatwoot/issue/CW-1772/ip-address-and-user-details-are-missing-in-some-of-the-logs Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -63,7 +63,7 @@ class Api::V1::Accounts::InboxesController < Api::V1::Accounts::BaseController
|
||||
end
|
||||
|
||||
def destroy
|
||||
::DeleteObjectJob.perform_later(@inbox) if @inbox.present?
|
||||
::DeleteObjectJob.perform_later(@inbox, Current.user, request.ip) if @inbox.present?
|
||||
render status: :ok, json: { message: I18n.t('messages.inbox_deletetion_response') }
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
class DeleteObjectJob < ApplicationJob
|
||||
queue_as :low
|
||||
|
||||
def perform(object)
|
||||
def perform(object, user = nil, ip = nil)
|
||||
object.destroy!
|
||||
process_post_deletion_tasks(object, user, ip)
|
||||
end
|
||||
|
||||
def process_post_deletion_tasks(object, user, ip); end
|
||||
end
|
||||
|
||||
DeleteObjectJob.prepend_mod_with('DeleteObjectJob')
|
||||
|
||||
Reference in New Issue
Block a user