Issue #2887490 by michaellenahan, cilefen, rOprOprOp, catch: Activity Tracker cannot be enabled if there are unpublished nodes

merge-requests/1654/head
Alex Pott 2018-06-29 23:34:57 +01:00
parent 5e908886e9
commit 713294e96e
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 10 additions and 4 deletions

View File

@ -361,8 +361,14 @@ class TrackerTest extends BrowserTestBase {
]; ];
$this->drupalPostForm('comment/reply/node/' . $nodes[3]->id() . '/comment', $comment, t('Save')); $this->drupalPostForm('comment/reply/node/' . $nodes[3]->id() . '/comment', $comment, t('Save'));
// Start indexing backwards from node 3. // Create an unpublished node.
\Drupal::state()->set('tracker.index_nid', 3); $unpublished = $this->drupalCreateNode([
'title' => $this->randomMachineName(8),
'status' => 0,
]);
// Start indexing backwards from node 4.
\Drupal::state()->set('tracker.index_nid', 4);
// Clear the current tracker tables and rebuild them. // Clear the current tracker tables and rebuild them.
db_delete('tracker_node') db_delete('tracker_node')

View File

@ -72,7 +72,7 @@ function tracker_cron() {
db_insert('tracker_node') db_insert('tracker_node')
->fields([ ->fields([
'nid' => $nid, 'nid' => $nid,
'published' => $node->isPublished(), 'published' => (int) $node->isPublished(),
'changed' => $changed, 'changed' => $changed,
]) ])
->execute(); ->execute();
@ -81,7 +81,7 @@ function tracker_cron() {
db_insert('tracker_user') db_insert('tracker_user')
->fields([ ->fields([
'nid' => $nid, 'nid' => $nid,
'published' => $node->isPublished(), 'published' => (int) $node->isPublished(),
'changed' => $changed, 'changed' => $changed,
'uid' => $node->getOwnerId(), 'uid' => $node->getOwnerId(),
]) ])