You are here

public function OpignoMessageThread::markReadAll in Opigno messaging 8

Marks all unread treads as read.

1 string reference to 'OpignoMessageThread::markReadAll'
opigno_messaging.routing.yml in ./opigno_messaging.routing.yml
opigno_messaging.routing.yml

File

src/OpignoMessageThread.php, line 89

Class

OpignoMessageThread
Class OpignoMessageThread.

Namespace

Drupal\opigno_messaging

Code

public function markReadAll() {
  $ids = self::getUnreadThreadCount('id');
  if ($ids) {
    $db_connection = \Drupal::service('database');
    $db_connection
      ->update('pm_thread_access_time')
      ->fields([
      'access_time' => time(),
    ])
      ->condition('id', $ids, 'IN')
      ->execute();
  }
  return new JsonResponse([]);
}