From 93700ea398b078b50c4740d5f8e5d1535aee5693 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 4 Sep 2014 10:55:45 -0500 Subject: [PATCH] Fix incorrect collaborator and owner email links Also, fix duplicate emails where a user as a collaborator would be sent a confirmation for their own respective email. --- include/class.client.php | 3 +-- include/class.thread.php | 4 ++-- include/class.ticket.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 9f29b0e10..6705b65c6 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -137,8 +137,7 @@ abstract class TicketUser { } function isOwner() { - return ($this->user - && $this->user->getId() == $this->getTicket()->getOwnerId()); + return $this instanceof TicketOwner; } function flagGuest() { diff --git a/include/class.thread.php b/include/class.thread.php index 2fa25f530..d47e3113a 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -428,11 +428,11 @@ Class ThreadEntry { if (!($ticket = $this->getTicket())) return null; - if ($ticket->getOwnerId() == $ticket->getUserId()) + if ($ticket->getOwnerId() == $this->getUserId()) $this->user = new TicketOwner( User::lookup($this->getUserId()), $ticket); else - $this->user = Collborator::lookup(array( + $this->user = Collaborator::lookup(array( 'userId'=>$this->getUserId(), 'ticketId'=>$this->getTicketId())); } diff --git a/include/class.ticket.php b/include/class.ticket.php index d180fc262..31a5742a3 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1045,7 +1045,7 @@ class Ticket { $options = array('inreplyto' => $entry->getEmailMessageId(), 'thread' => $entry); foreach ($recipients as $recipient) { - if ($uid == $recipient->getId()) continue; + if ($uid == $recipient->getUserId()) continue; $options['references'] = $entry->getEmailReferencesForUser($recipient); $notice = $this->replaceVars($msg, array('recipient' => $recipient)); $email->send($recipient->getEmail(), $notice['subj'], $notice['body'], $attachments, -- GitLab