From: Alexander Ebert Date: Mon, 8 Jul 2013 14:34:24 +0000 (+0200) Subject: Showing deleted participants X-Git-Tag: 2.0.0_Beta_3~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07e90692edcdfefbdd6318257db54db6e5fe5f3d;p=GitHub%2FWoltLab%2Fcom.woltlab.wcf.conversation.git Showing deleted participants --- diff --git a/files/lib/data/conversation/ConversationParticipantList.class.php b/files/lib/data/conversation/ConversationParticipantList.class.php index 71adef7..6d22854 100644 --- a/files/lib/data/conversation/ConversationParticipantList.class.php +++ b/files/lib/data/conversation/ConversationParticipantList.class.php @@ -1,5 +1,7 @@ * @package com.woltlab.wcf.conversation * @subpackage data.conversation * @category Community Framework */ class ConversationParticipantList extends UserProfileList { + /** + * conversation id + * @var integer + */ + public $conversationID = 0; + /** * @see wcf\data\DatabaseObjectList::$sqlLimit */ @@ -28,6 +36,7 @@ class ConversationParticipantList extends UserProfileList { public function __construct($conversationID, $userID = 0, $isAuthor = false) { parent::__construct(); + $this->conversationID = $conversationID; $this->getConditionBuilder()->add('conversation_to_user.conversationID = ?', array($conversationID)); if (!$isAuthor) { if ($userID) { @@ -74,4 +83,26 @@ class ConversationParticipantList extends UserProfileList { $this->objectIDs[] = $row['objectID']; } } + + /** + * @see wcf\data\user\UserProfileList::readObjects() + */ + public function readObjects() { + parent::readObjects(); + + // check for deleted users + $sql = "SELECT username + FROM wcf".WCF_N."_conversation_to_user + WHERE conversationID = ? + AND participantID IS NULL"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->conversationID)); + $i = 0; + while ($row = $statement->fetchArray()) { + // create fake user profiles + $user = new User(null, array('userID' => 0, 'username' => $row['username'])); + $this->objects['x'.++$i] = new UserProfile($user); + $this->indexToObject[] = 'x'.$i; + } + } } diff --git a/templates/conversation.tpl b/templates/conversation.tpl index 5dc52af..4a22864 100644 --- a/templates/conversation.tpl +++ b/templates/conversation.tpl @@ -78,12 +78,12 @@ {foreach from=$participants item=participant}
  • - {@$participant->getAvatar()->getImageTag(24)} + {if $participant->userID}{@$participant->getAvatar()->getImageTag(24)}{else}{@$participant->getAvatar()->getImageTag(24)}{/if}

    - {$participant->username} + {if $participant->userID}{$participant->username}{else}{$participant->username}{/if} {if $participant->isInvisible}({lang}wcf.conversation.invisible{/lang}){/if} - {if ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2} + {if $participant->userID && ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2} {/if}