You are here

public function PrivateMessageService::getUnreadThreadCount in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Service/PrivateMessageService.php \Drupal\private_message\Service\PrivateMessageService::getUnreadThreadCount()

Get the current user's unread threads count.

Return value

int The number of updated threads

Overrides PrivateMessageServiceInterface::getUnreadThreadCount

File

src/Service/PrivateMessageService.php, line 294

Class

PrivateMessageService
The Private Message service for the private message module.

Namespace

Drupal\private_message\Service

Code

public function getUnreadThreadCount() {
  $uid = $this->currentUser
    ->id();
  $last_check_timestamp = $this->userData
    ->get(self::MODULE_KEY, $uid, self::LAST_CHECK_KEY);
  $last_check_timestamp = is_numeric($last_check_timestamp) ? $last_check_timestamp : 0;
  return (int) $this->mapper
    ->getUnreadThreadCount($uid, $last_check_timestamp);
}