*/
public function removeParticipant($userID)
{
- $sql = "SELECT joinedAt
+ $sql = "SELECT joinedAt, isInvisible
FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID = ?";
$statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$this->conversationID, $userID]);
- $joinedAt = $statement->fetchSingleColumn();
+ $participantData = $statement->fetchSingleRow();
$sql = "SELECT messageID
FROM wcf1_conversation_message
$statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([
$this->conversationID,
- $joinedAt,
+ $participantData['joinedAt'],
TIME_NOW,
]);
$lastMessageID = $statement->fetchSingleColumn();
$userID,
]);
- // decrease participant count unless it is the author
- if ($userID != $this->userID) {
+ // The author and invisible participants are not included in the count.
+ if ($userID != $this->userID && !$participantData['isInvisible']) {
$this->updateCounters([
'participants' => -1,
]);