From 14dc5c4c7c7f20070a2262c18b95e687a5eb624e Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 22 Sep 2015 13:35:45 -0500 Subject: [PATCH] thread: email: Fix incorrect collaborator lookup --- include/class.thread.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/class.thread.php b/include/class.thread.php index aa78db5dd..68d1d6935 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -385,12 +385,9 @@ class Thread extends VerySimpleModel { // Consider collaborator role (disambiguate staff members as // collaborators). Normally, the block above should match based // on the Referenced message-id header - elseif ($object instanceof Ticket - && ($E = UserEmail::lookup($mailinfo['email'])) - && ($C = Collaborator::lookup(array( - 'ticketId' => $object->getId(), 'userId' => $E->user_id - ))) - ) { + elseif ($C = $this->collaborators->filter(array( + 'user__emails__address' => $mailinfo['email'] + ))->first()) { $vars['thread-type'] = 'M'; // XXX: There's no way that mailinfo[userId] would be set $vars['userId'] = $mailinfo['userId'] ?: $C->getUserId(); -- GitLab