205 $userId = (int)($params[
'userId'] ?? 0);
206 $logIdList = (is_set($params[
'logIdList']) && is_array($params[
'logIdList']) ? $params[
'logIdList'] : []);
216 foreach($logIdList as $logId)
218 $result[(int)$logId] = [];
221 $query = UserCounterTable::query();
222 $query->addFilter(
'=USER_ID',
$userId);
223 $query->addFilter(
'=SITE_ID', SITE_ID);
226 $subQuery->whereIn(
'LOG_ID', $logIdList);
229 $query->addFilter(
'@CODE',
new SqlExpression($subQuery->getQuery()));
230 $query->addSelect(
'CODE');
231 $res = $query->exec();
233 $unreadCommentIdList = [];
235 while ($counterFields = $res->fetch())
237 if (preg_match(
'/\*\*LC(\d+)/i', $counterFields[
'CODE'], $matches))
239 $unreadCommentIdList[] = (int)$matches[1];
243 if (!empty($unreadCommentIdList))
247 '@ID' => $unreadCommentIdList,
249 'select' => [
'ID',
'LOG_ID' ],
251 while ($logCommentFields = $res->fetch())
253 $result[(int)$logCommentFields[
'LOG_ID']][] = (
int)$logCommentFields[
'ID'];
262 $result[
'RESULT_TASKS_DATA'] = [];
263 $result[
'RESULT_FIELD_TASKS_ID'] = [];
264 $result[
'RESULT_COMMENTS_DATA'] = [];
266 $tasks2LogList = $this->
getComponent()->getTask2LogListValue();
268 empty($tasks2LogList)
269 || !Loader::includeModule(
'tasks')
270 || !class_exists(
"Bitrix\\Tasks\\Internals\\Task\\Result\\ResultManager")
276 foreach ($tasks2LogList as $taskId => $logId)
278 $result[
'RESULT_TASKS_DATA'][(int)$logId] = (
int)$taskId;
283 $res = \Bitrix\Tasks\Internals\TaskTable::getList([
285 '@ID' => array_keys($tasks2LogList),
286 '!=STATUS' => Status::COMPLETED,
288 'select' => [
'ID' ],
290 while ($taskFields = $res->fetch())
292 $taskIdList[] = (int)$taskFields[
'ID'];
295 if (empty($taskIdList))
300 $result[
'RESULT_FIELD_TASKS_ID'] = $taskIdList;
302 $resultCommentIdList = \Bitrix\Tasks\Internals\Task\Result\ResultManager::findResultComments($taskIdList);
303 foreach ($tasks2LogList as $taskId => $logId)
305 if (isset($resultCommentIdList[$taskId]))
308 foreach ($resultCommentIdList[$taskId] as $value)
313 'commentId' => $value,
316 $result[
'RESULT_COMMENTS_DATA'][$taskId] = $res;
325 $result[
'MICROBLOG_USER_ID'] = (
326 $result[
'currentUserId'] > 0
328 ($params[
'ENTITY_TYPE'] ??
null) !== SONET_ENTITY_GROUP
330 \CSocNetFeaturesPerms::canPerformOperation($result[
'currentUserId'], SONET_ENTITY_GROUP, $params[
'GROUP_ID'],
'blog',
'full_post', $this->
getComponent()->getCurrentUserAdmin())
331 || \CSocNetFeaturesPerms::canPerformOperation($result[
'currentUserId'], SONET_ENTITY_GROUP, $params[
'GROUP_ID'],
'blog',
'write_post')
332 || \CSocNetFeaturesPerms::canPerformOperation($result[
'currentUserId'], SONET_ENTITY_GROUP, $params[
'GROUP_ID'],
'blog',
'moderate_post')
333 || \CSocNetFeaturesPerms::canPerformOperation($result[
'currentUserId'], SONET_ENTITY_GROUP, $params[
'GROUP_ID'],
'blog',
'premoderate_post')
336 ? $result[
'currentUserId']