Skip to content

Commit

Permalink
"Connected before" should only appear if there have been actual messa…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
edwh committed Feb 8, 2022
1 parent 476061f commit 209c003
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions include/chat/ChatRoom.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,18 @@ public function createConversation($user1, $user2, $checkonly = FALSE)

if (count($chats) > 0) {
# We have an existing chat. That'll do nicely.
$id = $chats[0]['id'];
if ($checkonly) {
# Check if we have any messages.
$msgs = $this->dbhr->preQuery("SELECT COUNT(*) AS count FROM chat_messages WHERE chatid = ?;", [
$chats[0]['id']
]);

$this->ensureAppearInList($id);
$id = $msgs[0]['count'] ? $chats[0]['id'] : NULL;
} else {
# Return and bump.
$id = $chats[0]['id'];
$this->ensureAppearInList($id);
}
} else if (!$checkonly) {
# We don't have one.
#
Expand Down

0 comments on commit 209c003

Please sign in to comment.