Fix showing the link to start video chat on own chat history - refs #7558

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 1707e8a16d
commit 8b091eebf7
  1. 16
      main/inc/ajax/chat.ajax.php
  2. 25
      main/inc/lib/chat.lib.php

@ -82,7 +82,13 @@ switch ($action) {
api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['room_name']}"
);
$chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false);
$chat->send(
api_get_user_id(),
$to_user_id,
$videoChatLink,
false,
false
);
echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
break;
@ -131,7 +137,13 @@ switch ($action) {
api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room=$roomName"
);
$chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false);
$chat->send(
api_get_user_id(),
$to_user_id,
$videoChatLink,
false,
false
);
echo Display::tag('p', $videoChatLink, ['class' => 'lead']);
break;

@ -167,12 +167,20 @@ class Chat extends Model
/**
* Sends a message from one user to another user
* @param int The ID of the user sending the message
* @param int The ID of the user receiving the message
* @param string Message
* @param int $from_user_id The ID of the user sending the message
* @param int $to_user_id The ID of the user receiving the message
* @param string $message Message
* @param boolean $printResult Optional. Whether print the result
* @param boolean $sanitize Optional. Whether sanitize the message
* @return void Prints "1"
*/
public function send($from_user_id, $to_user_id, $message, $printResult = true)
public function send(
$from_user_id,
$to_user_id,
$message,
$printResult = true,
$sanitize = true
)
{
$user_friend_relation = SocialManager::get_relation_between_contacts($from_user_id, $to_user_id);
if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) {
@ -181,7 +189,14 @@ class Chat extends Model
$this->save_window($to_user_id);
$_SESSION['openChatBoxes'][$to_user_id] = api_get_utc_datetime();
$messagesan = self::sanitize($message);
if ($sanitize) {
$messagesan = self::sanitize($message);
} else {
$messagesan = $message;
}
error_log(print_r($sanitize) . '----' . $messagesan);
if (!isset($_SESSION['chatHistory'][$to_user_id])) {
$_SESSION['chatHistory'][$to_user_id] = array();

Loading…
Cancel
Save