diff --git a/include/class.thread.php b/include/class.thread.php index aa78db5ddea37c73b32504fcf6231578f32e5fb4..68d1d69358e1feb9db91de5ca05423fbd3dd9cbb 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();