diff -u b/core/modules/comment/src/CommentManager.php b/core/modules/comment/src/CommentManager.php --- b/core/modules/comment/src/CommentManager.php +++ b/core/modules/comment/src/CommentManager.php @@ -60,11 +60,11 @@ protected $currentUser; /** - * History read limit time. + * History mark read time. * * @var int */ - protected $historyReadLimit; + protected $historyMarkRead; /** * Construct the CommentManager object. @@ -89,7 +89,7 @@ $this->urlGenerator = $url_generator; $this->moduleHandler = $module_handler; $this->currentUser = $current_user; - $this->historyReadLimit = REQUEST_TIME - $config_factory->get('history.settings')->get('history_mark_read'); + $this->historyMarkRead = $config_factory->get('history.settings')->get('history_mark_read'); } /** @@ -206,7 +206,8 @@ } } } - $timestamp = ($timestamp > $this->historyReadLimit ? $timestamp : $this->historyReadLimit); + $history_read_limit = REQUEST_TIME - $this->historyMarkRead; + $timestamp = ($timestamp > $history_read_limit ? $timestamp : $history_read_limit); // Use the timestamp to retrieve the number of new comments. $query = $this->entityManager->getStorage('comment')->getQuery() diff -u b/core/modules/forum/src/ForumManager.php b/core/modules/forum/src/ForumManager.php --- b/core/modules/forum/src/ForumManager.php +++ b/core/modules/forum/src/ForumManager.php @@ -307,16 +307,19 @@ * previously viewed the node; otherwise - history read limit. */ protected function lastVisit($nid, AccountInterface $account) { + $history_read_limit = $this->configFactory + ->get('history.settings') + ->get('history_mark_read'); if (empty($this->history[$nid])) { $result = $this->connection->select('history', 'h') ->fields('h', ['nid', 'timestamp']) ->condition('uid', $account->id()) ->execute(); foreach ($result as $t) { - $this->history[$t->nid] = $t->timestamp > $this->history_read_limit ? $t->timestamp : $this->history_read_limit; + $this->history[$t->nid] = $t->timestamp > $history_read_limit ? $t->timestamp : $history_read_limit; } } - return isset($this->history[$nid]) ? $this->history[$nid] : $this->history_read_limit; + return isset($this->history[$nid]) ? $this->history[$nid] : $history_read_limit; } /** @@ -474,6 +477,9 @@ * {@inheritdoc} */ public function unreadTopics($term, $uid) { + $history_read_limit = $this->configFactory + ->get('history.settings') + ->get('history_mark_read'); $query = $this->connection->select('node_field_data', 'n'); $query->join('forum', 'f', 'n.vid = f.vid AND f.tid = :tid', [':tid' => $term]); $query->leftJoin('history', 'h', 'n.nid = h.nid AND h.uid = :uid', [':uid' => $uid]); diff -u b/core/modules/history/config/install/history.settings.yml b/core/modules/history/config/install/history.settings.yml --- b/core/modules/history/config/install/history.settings.yml +++ b/core/modules/history/config/install/history.settings.yml @@ -5 +5 @@ -history_mark_read: '2592000' +history_mark_read: 2592000 diff -u b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php --- b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php +++ b/core/modules/history/src/Plugin/views/filter/HistoryUserTimestamp.php @@ -34,7 +34,7 @@ $configuration, $plugin_id, $plugin_definition, - REQUEST_TIME - $container->get('config.factory')->get('history.settings')->config->get('history_mark_read') + REQUEST_TIME - $container->get('config.factory')->get('history.settings')->get('history_mark_read') ); }