diff --git a/app/controllers/message_threads/bulk/message_drafts_controller.rb b/app/controllers/message_threads/bulk/message_drafts_controller.rb index 247dab57..9a1a5403 100644 --- a/app/controllers/message_threads/bulk/message_drafts_controller.rb +++ b/app/controllers/message_threads/bulk/message_drafts_controller.rb @@ -45,7 +45,7 @@ def message_thread_policy_scope end def any_missing_signature?(message_threads) - message_threads.any? { |thread| thread.any_objects_with_requested_signature? } + MessageThreadsTag.where(message_thread: message_threads, tag: Current.tenant.tags.signature_requesting).exists? end end end diff --git a/app/models/message.rb b/app/models/message.rb index 092cf656..edd77d2c 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -97,7 +97,7 @@ def authorized? end def any_objects_with_requested_signature? - objects.any? { |message_object| message_object.tags.where(type: SignatureRequestedFromTag.to_s).any? } + MessageObjectsTag.where(message_object: objects, tag: tenant.tags.signature_requesting).exists? end # TODO remove UPVS stuff from core domain diff --git a/app/models/message_thread.rb b/app/models/message_thread.rb index 8992d913..e46045ca 100644 --- a/app/models/message_thread.rb +++ b/app/models/message_thread.rb @@ -167,10 +167,6 @@ def unassign_tag(tag) message_threads_tags.find_by(tag: tag)&.destroy end - def any_objects_with_requested_signature? - tags.signature_requesting.any? - end - private def has_tag?(tag)