mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
Fix user duplication in visitors and threads lists
User can be either in threads list or in visitors list but not in both at the same time.
This commit is contained in:
parent
862e23e79c
commit
caa90f9f9c
@ -22,6 +22,7 @@ require_once('libs/groups.php');
|
|||||||
require_once('libs/expand.php');
|
require_once('libs/expand.php');
|
||||||
require_once('libs/captcha.php');
|
require_once('libs/captcha.php');
|
||||||
require_once('libs/invitation.php');
|
require_once('libs/invitation.php');
|
||||||
|
require_once('libs/track.php');
|
||||||
require_once('libs/classes/thread.php');
|
require_once('libs/classes/thread.php');
|
||||||
|
|
||||||
if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
||||||
|
@ -689,6 +689,11 @@ function chat_start_for_user($group_id, $requested_operator, $visitor_id, $visit
|
|||||||
|
|
||||||
$_SESSION['threadid'] = $thread->id;
|
$_SESSION['threadid'] = $thread->id;
|
||||||
|
|
||||||
|
// Bind thread to the visitor
|
||||||
|
if (Settings::get('enabletracking')) {
|
||||||
|
track_visitor_bind_thread($visitor_id, $thread);
|
||||||
|
}
|
||||||
|
|
||||||
// Send several messages
|
// Send several messages
|
||||||
if ($is_invited) {
|
if ($is_invited) {
|
||||||
$operator = operator_by_id($thread->agentId);
|
$operator = operator_by_id($thread->agentId);
|
||||||
|
@ -221,4 +221,24 @@ function track_get_user_id($visitorid) {
|
|||||||
return $visitor['userid'];
|
return $visitor['userid'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind chat thread with visitor
|
||||||
|
*
|
||||||
|
* @param string $user_id User ID ({chatsitevisitor}.userid field) of the
|
||||||
|
* visitor.
|
||||||
|
* @param Thread $thread Chat thread object
|
||||||
|
*/
|
||||||
|
function track_visitor_bind_thread($user_id, $thread) {
|
||||||
|
$db = Database::getInstance();
|
||||||
|
$db->query(
|
||||||
|
'UPDATE {chatsitevisitor} ' .
|
||||||
|
'SET threadid = :thread_id ' .
|
||||||
|
'WHERE userid = :user_id',
|
||||||
|
array(
|
||||||
|
':thread_id' => $thread->id,
|
||||||
|
':user_id' => $user_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Reference in New Issue
Block a user