Operators can post messages only to own threads

This commit is contained in:
Dmitriy Simushev 2014-12-25 15:28:47 +00:00
parent 5a2e48eeef
commit 6a17db4e04

View File

@ -392,8 +392,8 @@ class ThreadProcessor extends ClientSideProcessor implements
} else { } else {
$is_typing = abs($thread->lastPingUser - time()) < Settings::get('connection_timeout') $is_typing = abs($thread->lastPingUser - time()) < Settings::get('connection_timeout')
&& $thread->userTyping; && $thread->userTyping;
// Operators can always post messages. // Operators can post messages only to own threads.
$can_post = true; $can_post = ($operator['operatorid'] == $thread->agentId);
} }
return array( return array(
@ -462,8 +462,8 @@ class ThreadProcessor extends ClientSideProcessor implements
// Get operator's array // Get operator's array
if (!$args['user']) { if (!$args['user']) {
$operator = $this->checkOperator(); $operator = $this->checkOperator();
// Operators can always post messages. // Operators can post messages only to own threads.
$can_post = true; $can_post = ($operator['operatorid'] == $thread->agentId);
} else { } else {
// Users can post messages only when a thread is open. // Users can post messages only when a thread is open.
$can_post = $thread->state != Thread::STATE_CLOSED; $can_post = $thread->state != Thread::STATE_CLOSED;