diff --git a/include/class.thread.php b/include/class.thread.php index 99ce210cbba6dfa26ed44b377aa4b6402398440e..0d94b8df6ef8333453492440b1e0de363741d511 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -1895,15 +1895,16 @@ class ThreadEvent extends VerySimpleModel { return $this->template(sprintf( __('%s by {somebody} {timestamp}'), $this->state - )); + ), $mode); } - function template($description) { + function template($description, $mode=self::MODE_STAFF) { global $thisstaff, $cfg; $self = $this; + $hideName = $cfg->hideStaffName(); return preg_replace_callback('/\{(<(?P<type>([^>]+))>)?(?P<key>[^}.]+)(\.(?P<data>[^}]+))?\}/', - function ($m) use ($self, $thisstaff, $cfg) { + function ($m) use ($self, $thisstaff, $cfg, $hideName, $mode) { switch ($m['key']) { case 'assignees': $assignees = array(); @@ -1919,7 +1920,10 @@ class ThreadEvent extends VerySimpleModel { } return implode('/', $assignees); case 'somebody': - $name = $self->getUserName(); + if ($hideName && $self->agent && $mode == self::MODE_CLIENT) + $name = __('Staff'); + else + $name = $self->getUserName(); if ($cfg->isAvatarsEnabled() && ($avatar = $self->getAvatar())) $name = $avatar.$name; @@ -2153,9 +2157,9 @@ class CloseEvent extends ThreadEvent { function getDescription($mode=self::MODE_STAFF) { if ($this->getData('status')) - return $this->template(__('Closed by <b>{somebody}</b> with status of {<TicketStatus>data.status} {timestamp}')); + return $this->template(__('Closed by <b>{somebody}</b> with status of {<TicketStatus>data.status} {timestamp}'), $mode); else - return $this->template(__('Closed by <b>{somebody}</b> {timestamp}')); + return $this->template(__('Closed by <b>{somebody}</b> {timestamp}'), $mode); } } @@ -2212,7 +2216,7 @@ class CollaboratorEvent extends ThreadEvent { : 'somebody'; break; } - return $this->template($desc); + return $this->template($desc, $mode); } } @@ -2221,7 +2225,7 @@ class CreationEvent extends ThreadEvent { static $state = 'created'; function getDescription($mode=self::MODE_STAFF) { - return $this->template(__('Created by <b>{somebody}</b> {timestamp}')); + return $this->template(__('Created by <b>{somebody}</b> {timestamp}'), $mode); } } @@ -2303,7 +2307,7 @@ class EditEvent extends ThreadEvent { break; } - return $this->template($desc); + return $this->template($desc, $mode); } } @@ -2321,7 +2325,7 @@ class ReopenEvent extends ThreadEvent { static $state = 'reopened'; function getDescription($mode=self::MODE_STAFF) { - return $this->template(__('Reopened by <b>{somebody}</b> {timestamp}')); + return $this->template(__('Reopened by <b>{somebody}</b> {timestamp}'), $mode); } } diff --git a/include/client/templates/thread-entry.tmpl.php b/include/client/templates/thread-entry.tmpl.php index 3ab3127e88d61207cb7d0b970d9a28eb5ce309ed..fed92a5c657b6bba249f6f365cae8462b62c895d 100644 --- a/include/client/templates/thread-entry.tmpl.php +++ b/include/client/templates/thread-entry.tmpl.php @@ -2,7 +2,10 @@ global $cfg; $entryTypes = array('M'=>'message', 'R'=>'response', 'N'=>'note', 'B' => 'bccmessage'); $user = $entry->getUser() ?: $entry->getStaff(); -$name = $user ? $user->getName() : $entry->poster; +if ($entry->staff && $cfg->hideStaffName()) + $name = __('Staff'); +else + $name = $user ? $user->getName() : $entry->poster; $avatar = ''; if ($cfg->isAvatarsEnabled() && $user) $avatar = $user->getAvatar();