fix delete_conversations for the audit log
fixes VICE-1277 flag=none Test Plan: - Tests pass Change-Id: If601bf89a9cf3efdcf68972dede4cfe8a3ac98c1 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261910 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: Rob Orton <rob@instructure.com> Product-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
parent
e12300415c
commit
7bf1651a45
|
@ -136,7 +136,6 @@ class AuditLogFieldExtension < GraphQL::Schema::FieldExtension
|
||||||
next unless AuditLogFieldExtension.enabled?
|
next unless AuditLogFieldExtension.enabled?
|
||||||
|
|
||||||
mutation = field.mutation
|
mutation = field.mutation
|
||||||
next if mutation == Mutations::DeleteConversations
|
|
||||||
next if mutation == Mutations::AddConversationMessage
|
next if mutation == Mutations::AddConversationMessage
|
||||||
|
|
||||||
logger = Logger.new(mutation, context, arguments)
|
logger = Logger.new(mutation, context, arguments)
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Mutations::DeleteConversations < Mutations::BaseMutation
|
||||||
|
|
||||||
def resolve(input:)
|
def resolve(input:)
|
||||||
errors = {}
|
errors = {}
|
||||||
|
context[:deleted_models] = {conversations: {}}
|
||||||
# rubocop:disable Style/BlockDelimiters
|
# rubocop:disable Style/BlockDelimiters
|
||||||
resolved_ids = input[:ids].map { |id|
|
resolved_ids = input[:ids].map { |id|
|
||||||
conversation = Conversation.find_by(id: id)
|
conversation = Conversation.find_by(id: id)
|
||||||
|
@ -43,6 +44,7 @@ class Mutations::DeleteConversations < Mutations::BaseMutation
|
||||||
end
|
end
|
||||||
|
|
||||||
participant_record.remove_messages(:all)
|
participant_record.remove_messages(:all)
|
||||||
|
context[:deleted_models][:conversations][conversation.id] = conversation
|
||||||
conversation.id
|
conversation.id
|
||||||
}.compact
|
}.compact
|
||||||
# rubocop:enable Style/BlockDelimiters
|
# rubocop:enable Style/BlockDelimiters
|
||||||
|
@ -54,4 +56,8 @@ class Mutations::DeleteConversations < Mutations::BaseMutation
|
||||||
rescue ActiveRecord::RecordInvalid => e
|
rescue ActiveRecord::RecordInvalid => e
|
||||||
errors_for(e.record)
|
errors_for(e.record)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.conversation_ids_log_entry(entry, context)
|
||||||
|
context[:deleted_models][:conversations][entry]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue