79 if (isset($this->commentsInfo))
84 $this->commentsInfo = [];
86 if (empty($this->messageIds))
91 $query = ChatTable::query()
92 ->setSelect([
'ID',
'MESSAGE_COUNT',
'PARENT_MID'])
93 ->where(
'PARENT_ID', $this->chatId)
94 ->whereIn(
'PARENT_MID', $this->messageIds)
97 if ($this->withSubscriptionFlag)
100 ->addSelect(
'RELATION.NOTIFY_BLOCK',
'NOTIFY_BLOCK')
101 ->withRelation($this->getContext()->getUserId())
105 $raw =
$query->fetchAll();
107 foreach ($raw as $row)
109 $this->childChatIds[] = (int)$row[
'ID'];
110 $this->commentsInfo[] = [
111 'chatId' => (int)$row[
'ID'],
112 'dialogId' =>
'chat' . $row[
'ID'],
113 'messageId' => (
int)$row[
'PARENT_MID'],
115 'messageCount' => (int)$row[
'MESSAGE_COUNT'],
116 'isUserSubscribed' => ($row[
'NOTIFY_BLOCK'] ??
'Y') ===
'N',