Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
147
web/core/modules/tracker/js/tracker-history.es6.js
Normal file
147
web/core/modules/tracker/js/tracker-history.es6.js
Normal file
|
@ -0,0 +1,147 @@
|
|||
/**
|
||||
* Attaches behaviors for the Tracker module's History module integration.
|
||||
*
|
||||
* May only be loaded for authenticated users, with the History module enabled.
|
||||
*/
|
||||
(function($, Drupal, window) {
|
||||
function processNodeNewIndicators($placeholders) {
|
||||
const newNodeString = Drupal.t('new');
|
||||
const updatedNodeString = Drupal.t('updated');
|
||||
|
||||
$placeholders.each((index, placeholder) => {
|
||||
const timestamp = parseInt(
|
||||
placeholder.getAttribute('data-history-node-timestamp'),
|
||||
10,
|
||||
);
|
||||
const nodeID = placeholder.getAttribute('data-history-node-id');
|
||||
const lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
||||
|
||||
if (timestamp > lastViewTimestamp) {
|
||||
const message =
|
||||
lastViewTimestamp === 0 ? newNodeString : updatedNodeString;
|
||||
$(placeholder).append(`<span class="marker">${message}</span>`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function processNewRepliesIndicators($placeholders) {
|
||||
// Figure out which placeholders need the "x new" replies links.
|
||||
const placeholdersToUpdate = {};
|
||||
$placeholders.each((index, placeholder) => {
|
||||
const timestamp = parseInt(
|
||||
placeholder.getAttribute('data-history-node-last-comment-timestamp'),
|
||||
10,
|
||||
);
|
||||
const nodeID = placeholder.previousSibling.previousSibling.getAttribute(
|
||||
'data-history-node-id',
|
||||
);
|
||||
const lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
||||
|
||||
// Queue this placeholder's "X new" replies link to be downloaded from the
|
||||
// server.
|
||||
if (timestamp > lastViewTimestamp) {
|
||||
placeholdersToUpdate[nodeID] = placeholder;
|
||||
}
|
||||
});
|
||||
|
||||
// Perform an AJAX request to retrieve node view timestamps.
|
||||
const nodeIDs = Object.keys(placeholdersToUpdate);
|
||||
if (nodeIDs.length === 0) {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: Drupal.url('comments/render_new_comments_node_links'),
|
||||
type: 'POST',
|
||||
data: { 'node_ids[]': nodeIDs },
|
||||
dataType: 'json',
|
||||
success(results) {
|
||||
Object.keys(results || {}).forEach(nodeID => {
|
||||
if (placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
||||
const url = results[nodeID].first_new_comment_link;
|
||||
const text = Drupal.formatPlural(
|
||||
results[nodeID].new_comment_count,
|
||||
'1 new',
|
||||
'@count new',
|
||||
);
|
||||
$(placeholdersToUpdate[nodeID]).append(
|
||||
`<br /><a href="${url}">${text}</a>`,
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Render "new" and "updated" node indicators, as well as "X new" replies links.
|
||||
*/
|
||||
Drupal.behaviors.trackerHistory = {
|
||||
attach(context) {
|
||||
// Find all "new" comment indicator placeholders newer than 30 days ago that
|
||||
// have not already been read after their last comment timestamp.
|
||||
const nodeIDs = [];
|
||||
const $nodeNewPlaceholders = $(context)
|
||||
.find('[data-history-node-timestamp]')
|
||||
.once('history')
|
||||
.filter(function() {
|
||||
const nodeTimestamp = parseInt(
|
||||
this.getAttribute('data-history-node-timestamp'),
|
||||
10,
|
||||
);
|
||||
const nodeID = this.getAttribute('data-history-node-id');
|
||||
if (Drupal.history.needsServerCheck(nodeID, nodeTimestamp)) {
|
||||
nodeIDs.push(nodeID);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Find all "new" comment indicator placeholders newer than 30 days ago that
|
||||
// have not already been read after their last comment timestamp.
|
||||
const $newRepliesPlaceholders = $(context)
|
||||
.find('[data-history-node-last-comment-timestamp]')
|
||||
.once('history')
|
||||
.filter(function() {
|
||||
const lastCommentTimestamp = parseInt(
|
||||
this.getAttribute('data-history-node-last-comment-timestamp'),
|
||||
10,
|
||||
);
|
||||
const nodeTimestamp = parseInt(
|
||||
this.previousSibling.previousSibling.getAttribute(
|
||||
'data-history-node-timestamp',
|
||||
),
|
||||
10,
|
||||
);
|
||||
// Discard placeholders that have zero comments.
|
||||
if (lastCommentTimestamp === nodeTimestamp) {
|
||||
return false;
|
||||
}
|
||||
const nodeID = this.previousSibling.previousSibling.getAttribute(
|
||||
'data-history-node-id',
|
||||
);
|
||||
if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
|
||||
if (nodeIDs.indexOf(nodeID) === -1) {
|
||||
nodeIDs.push(nodeID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if (
|
||||
$nodeNewPlaceholders.length === 0 &&
|
||||
$newRepliesPlaceholders.length === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the node read timestamps from the server.
|
||||
Drupal.history.fetchTimestamps(nodeIDs, () => {
|
||||
processNodeNewIndicators($nodeNewPlaceholders);
|
||||
processNewRepliesIndicators($newRepliesPlaceholders);
|
||||
});
|
||||
},
|
||||
};
|
||||
})(jQuery, Drupal, window);
|
|
@ -1,71 +1,11 @@
|
|||
/**
|
||||
* Attaches behaviors for the Tracker module's History module integration.
|
||||
*
|
||||
* May only be loaded for authenticated users, with the History module enabled.
|
||||
*/
|
||||
* DO NOT EDIT THIS FILE.
|
||||
* See the following change record for more information,
|
||||
* https://www.drupal.org/node/2815083
|
||||
* @preserve
|
||||
**/
|
||||
|
||||
(function ($, Drupal, window) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Render "new" and "updated" node indicators, as well as "X new" replies links.
|
||||
*/
|
||||
Drupal.behaviors.trackerHistory = {
|
||||
attach: function (context) {
|
||||
// Find all "new" comment indicator placeholders newer than 30 days ago that
|
||||
// have not already been read after their last comment timestamp.
|
||||
var nodeIDs = [];
|
||||
var $nodeNewPlaceholders = $(context)
|
||||
.find('[data-history-node-timestamp]')
|
||||
.once('history')
|
||||
.filter(function () {
|
||||
var nodeTimestamp = parseInt(this.getAttribute('data-history-node-timestamp'), 10);
|
||||
var nodeID = this.getAttribute('data-history-node-id');
|
||||
if (Drupal.history.needsServerCheck(nodeID, nodeTimestamp)) {
|
||||
nodeIDs.push(nodeID);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Find all "new" comment indicator placeholders newer than 30 days ago that
|
||||
// have not already been read after their last comment timestamp.
|
||||
var $newRepliesPlaceholders = $(context)
|
||||
.find('[data-history-node-last-comment-timestamp]')
|
||||
.once('history')
|
||||
.filter(function () {
|
||||
var lastCommentTimestamp = parseInt(this.getAttribute('data-history-node-last-comment-timestamp'), 10);
|
||||
var nodeTimestamp = parseInt(this.previousSibling.previousSibling.getAttribute('data-history-node-timestamp'), 10);
|
||||
// Discard placeholders that have zero comments.
|
||||
if (lastCommentTimestamp === nodeTimestamp) {
|
||||
return false;
|
||||
}
|
||||
var nodeID = this.previousSibling.previousSibling.getAttribute('data-history-node-id');
|
||||
if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
|
||||
if (nodeIDs.indexOf(nodeID) === -1) {
|
||||
nodeIDs.push(nodeID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ($nodeNewPlaceholders.length === 0 && $newRepliesPlaceholders.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the node read timestamps from the server.
|
||||
Drupal.history.fetchTimestamps(nodeIDs, function () {
|
||||
processNodeNewIndicators($nodeNewPlaceholders);
|
||||
processNewRepliesIndicators($newRepliesPlaceholders);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function processNodeNewIndicators($placeholders) {
|
||||
var newNodeString = Drupal.t('new');
|
||||
var updatedNodeString = Drupal.t('updated');
|
||||
|
@ -76,28 +16,24 @@
|
|||
var lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
||||
|
||||
if (timestamp > lastViewTimestamp) {
|
||||
var message = (lastViewTimestamp === 0) ? newNodeString : updatedNodeString;
|
||||
var message = lastViewTimestamp === 0 ? newNodeString : updatedNodeString;
|
||||
$(placeholder).append('<span class="marker">' + message + '</span>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function processNewRepliesIndicators($placeholders) {
|
||||
// Figure out which placeholders need the "x new" replies links.
|
||||
var placeholdersToUpdate = {};
|
||||
$placeholders.each(function (index, placeholder) {
|
||||
var timestamp = parseInt(placeholder.getAttribute('data-history-node-last-comment-timestamp'), 10);
|
||||
var nodeID = placeholder.previousSibling.previousSibling.getAttribute('data-history-node-id');
|
||||
var lastViewTimestamp = Drupal.history.getLastRead(nodeID);
|
||||
|
||||
// Queue this placeholder's "X new" replies link to be downloaded from the
|
||||
// server.
|
||||
if (timestamp > lastViewTimestamp) {
|
||||
placeholdersToUpdate[nodeID] = placeholder;
|
||||
}
|
||||
});
|
||||
|
||||
// Perform an AJAX request to retrieve node view timestamps.
|
||||
var nodeIDs = Object.keys(placeholdersToUpdate);
|
||||
if (nodeIDs.length === 0) {
|
||||
return;
|
||||
|
@ -105,18 +41,60 @@
|
|||
$.ajax({
|
||||
url: Drupal.url('comments/render_new_comments_node_links'),
|
||||
type: 'POST',
|
||||
data: {'node_ids[]': nodeIDs},
|
||||
data: { 'node_ids[]': nodeIDs },
|
||||
dataType: 'json',
|
||||
success: function (results) {
|
||||
for (var nodeID in results) {
|
||||
if (results.hasOwnProperty(nodeID) && placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
||||
success: function success(results) {
|
||||
Object.keys(results || {}).forEach(function (nodeID) {
|
||||
if (placeholdersToUpdate.hasOwnProperty(nodeID)) {
|
||||
var url = results[nodeID].first_new_comment_link;
|
||||
var text = Drupal.formatPlural(results[nodeID].new_comment_count, '1 new', '@count new');
|
||||
$(placeholdersToUpdate[nodeID]).append('<br /><a href="' + url + '">' + text + '</a>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})(jQuery, Drupal, window);
|
||||
Drupal.behaviors.trackerHistory = {
|
||||
attach: function attach(context) {
|
||||
var nodeIDs = [];
|
||||
var $nodeNewPlaceholders = $(context).find('[data-history-node-timestamp]').once('history').filter(function () {
|
||||
var nodeTimestamp = parseInt(this.getAttribute('data-history-node-timestamp'), 10);
|
||||
var nodeID = this.getAttribute('data-history-node-id');
|
||||
if (Drupal.history.needsServerCheck(nodeID, nodeTimestamp)) {
|
||||
nodeIDs.push(nodeID);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
var $newRepliesPlaceholders = $(context).find('[data-history-node-last-comment-timestamp]').once('history').filter(function () {
|
||||
var lastCommentTimestamp = parseInt(this.getAttribute('data-history-node-last-comment-timestamp'), 10);
|
||||
var nodeTimestamp = parseInt(this.previousSibling.previousSibling.getAttribute('data-history-node-timestamp'), 10);
|
||||
|
||||
if (lastCommentTimestamp === nodeTimestamp) {
|
||||
return false;
|
||||
}
|
||||
var nodeID = this.previousSibling.previousSibling.getAttribute('data-history-node-id');
|
||||
if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
|
||||
if (nodeIDs.indexOf(nodeID) === -1) {
|
||||
nodeIDs.push(nodeID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if ($nodeNewPlaceholders.length === 0 && $newRepliesPlaceholders.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Drupal.history.fetchTimestamps(nodeIDs, function () {
|
||||
processNodeNewIndicators($nodeNewPlaceholders);
|
||||
processNewRepliesIndicators($newRepliesPlaceholders);
|
||||
});
|
||||
}
|
||||
};
|
||||
})(jQuery, Drupal, window);
|
|
@ -2,6 +2,7 @@ id: d7_tracker_node
|
|||
label: Tracker node
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
- Content
|
||||
source:
|
||||
plugin: d7_tracker_node
|
||||
process:
|
|
@ -2,10 +2,12 @@ id: d7_tracker_settings
|
|||
label: Tracker settings
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
- Configuration
|
||||
source:
|
||||
plugin: variable
|
||||
variables:
|
||||
- tracker_batch_size
|
||||
source_module: tracker
|
||||
process:
|
||||
cron_index_limit: tracker_batch_size
|
||||
destination:
|
|
@ -2,6 +2,7 @@ id: d7_tracker_user
|
|||
label: Tracker user
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
- Content
|
||||
source:
|
||||
plugin: d7_tracker_user
|
||||
process:
|
|
@ -32,7 +32,6 @@ class UserTrackerTab extends LocalTaskDefault {
|
|||
return $this->currentUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
|||
*
|
||||
* @MigrateSource(
|
||||
* id = "d7_tracker_node",
|
||||
* source_provider = "tracker"
|
||||
* source_module = "tracker"
|
||||
* )
|
||||
*/
|
||||
class TrackerNode extends DrupalSqlBase {
|
||||
|
|
|
@ -9,7 +9,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
|||
*
|
||||
* @MigrateSource(
|
||||
* id = "d7_tracker_user",
|
||||
* source_provider = "tracker"
|
||||
* source_module = "tracker"
|
||||
* )
|
||||
*/
|
||||
class TrackerUser extends DrupalSqlBase {
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Drupal\tracker\Tests\Views;
|
||||
|
||||
@trigger_error(__NAMESPACE__ . '\TrackerTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\tracker\Functional\Views\TrackerTestBase', E_USER_DEPRECATED);
|
||||
|
||||
use Drupal\comment\Tests\CommentTestTrait;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\views\Tests\ViewTestBase;
|
||||
|
@ -10,6 +12,9 @@ use Drupal\comment\Entity\Comment;
|
|||
|
||||
/**
|
||||
* Base class for all tracker tests.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use \Drupal\Tests\tracker\Functional\Views\TrackerTestBase instead.
|
||||
*/
|
||||
abstract class TrackerTestBase extends ViewTestBase {
|
||||
|
||||
|
@ -36,8 +41,8 @@ abstract class TrackerTestBase extends ViewTestBase {
|
|||
*/
|
||||
protected $comment;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), ['tracker_test_views']);
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ package: Testing
|
|||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- tracker
|
||||
- views
|
||||
- drupal:tracker
|
||||
- drupal:views
|
||||
|
|
|
@ -9,8 +9,8 @@ use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
|||
use Drupal\Core\Session\AccountInterface;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait;
|
||||
|
||||
/**
|
||||
* Create and delete nodes and check for their display in the tracker listings.
|
||||
|
@ -93,6 +93,7 @@ class TrackerTest extends BrowserTestBase {
|
|||
$expected_tags = Cache::mergeTags($expected_tags, $role_tags);
|
||||
$block_tags = [
|
||||
'block_view',
|
||||
'local_task',
|
||||
'config:block.block.page_actions_block',
|
||||
'config:block.block.page_tabs_block',
|
||||
'config:block_list',
|
||||
|
@ -179,6 +180,7 @@ class TrackerTest extends BrowserTestBase {
|
|||
$expected_tags = Cache::mergeTags($expected_tags, $role_tags);
|
||||
$block_tags = [
|
||||
'block_view',
|
||||
'local_task',
|
||||
'config:block.block.page_actions_block',
|
||||
'config:block.block.page_tabs_block',
|
||||
'config:block_list',
|
||||
|
@ -361,8 +363,14 @@ class TrackerTest extends BrowserTestBase {
|
|||
];
|
||||
$this->drupalPostForm('comment/reply/node/' . $nodes[3]->id() . '/comment', $comment, t('Save'));
|
||||
|
||||
// Start indexing backwards from node 3.
|
||||
\Drupal::state()->set('tracker.index_nid', 3);
|
||||
// Create an unpublished node.
|
||||
$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.
|
||||
db_delete('tracker_node')
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\tracker\Functional\Views;
|
||||
|
||||
use Drupal\comment\Tests\CommentTestTrait;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Tests\views\Functional\ViewTestBase;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
use Drupal\comment\Entity\Comment;
|
||||
|
||||
/**
|
||||
* Base class for all tracker tests.
|
||||
*/
|
||||
abstract class TrackerTestBase extends ViewTestBase {
|
||||
|
||||
use CommentTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['comment', 'tracker', 'tracker_test_views'];
|
||||
|
||||
/**
|
||||
* The node used for testing.
|
||||
*
|
||||
* @var \Drupal\node\NodeInterface
|
||||
*/
|
||||
protected $node;
|
||||
|
||||
/**
|
||||
* The comment used for testing.
|
||||
*
|
||||
* @var \Drupal\comment\CommentInterface
|
||||
*/
|
||||
protected $comment;
|
||||
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
||||
ViewTestData::createTestViews(get_class($this), ['tracker_test_views']);
|
||||
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
// Add a comment field.
|
||||
$this->addDefaultCommentField('node', 'page');
|
||||
|
||||
$permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval'];
|
||||
$account = $this->drupalCreateUser($permissions);
|
||||
|
||||
$this->drupalLogin($account);
|
||||
|
||||
$this->node = $this->drupalCreateNode([
|
||||
'title' => $this->randomMachineName(8),
|
||||
'uid' => $account->id(),
|
||||
'status' => 1,
|
||||
]);
|
||||
|
||||
$this->comment = Comment::create([
|
||||
'entity_id' => $this->node->id(),
|
||||
'entity_type' => 'node',
|
||||
'field_name' => 'comment',
|
||||
'subject' => $this->randomMachineName(),
|
||||
'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\tracker\Tests\Views;
|
||||
namespace Drupal\Tests\tracker\Functional\Views;
|
||||
|
||||
use Drupal\views\Views;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class TrackerUserUidTest extends TrackerTestBase {
|
|||
[
|
||||
'nid' => $this->node->id(),
|
||||
'title' => $this->node->label(),
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
$view = Views::getView('test_tracker_user_uid');
|
|
@ -30,7 +30,7 @@ class TrackerNodeTest extends MigrateSqlSourceTestBase {
|
|||
'nid' => '2',
|
||||
'published' => '1',
|
||||
'changed' => '1421727536',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results are identical to the source data.
|
||||
|
|
|
@ -31,7 +31,7 @@ class TrackerUserTest extends MigrateSqlSourceTestBase {
|
|||
'uid' => '2',
|
||||
'published' => '1',
|
||||
'changed' => '1421727536',
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
// The expected results are identical to the source data.
|
||||
|
|
|
@ -2,8 +2,8 @@ name: Activity Tracker
|
|||
type: module
|
||||
description: 'Enables tracking of recent content for users.'
|
||||
dependencies:
|
||||
- node
|
||||
- comment
|
||||
- drupal:node
|
||||
- drupal:comment
|
||||
package: Core
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
|
|
|
@ -72,7 +72,7 @@ function tracker_cron() {
|
|||
db_insert('tracker_node')
|
||||
->fields([
|
||||
'nid' => $nid,
|
||||
'published' => $node->isPublished(),
|
||||
'published' => (int) $node->isPublished(),
|
||||
'changed' => $changed,
|
||||
])
|
||||
->execute();
|
||||
|
@ -81,7 +81,7 @@ function tracker_cron() {
|
|||
db_insert('tracker_user')
|
||||
->fields([
|
||||
'nid' => $nid,
|
||||
'published' => $node->isPublished(),
|
||||
'published' => (int) $node->isPublished(),
|
||||
'changed' => $changed,
|
||||
'uid' => $node->getOwnerId(),
|
||||
])
|
||||
|
@ -135,16 +135,21 @@ function tracker_cron() {
|
|||
/**
|
||||
* Access callback: Determines access permission for a user's own account.
|
||||
*
|
||||
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. As
|
||||
* internal API, _tracker_user_access() may also be removed in a minor
|
||||
* release.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param \Drupal\Core\Session\AccountInterface $account
|
||||
* The user account to track.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if a user is accessing tracking info for their own account and
|
||||
* has permission to access the content.
|
||||
*
|
||||
* @see tracker_menu()
|
||||
*/
|
||||
function _tracker_myrecent_access(AccountInterface $account) {
|
||||
@trigger_error('_tracker_myrecent_access() is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.', E_USER_DEPRECATED);
|
||||
// This path is only allowed for authenticated users looking at their own content.
|
||||
return $account->id() && (\Drupal::currentUser()->id() == $account->id()) && $account->hasPermission('access content');
|
||||
}
|
||||
|
@ -152,16 +157,21 @@ function _tracker_myrecent_access(AccountInterface $account) {
|
|||
/**
|
||||
* Access callback: Determines access permission for an account.
|
||||
*
|
||||
* @deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. As
|
||||
* internal API, _tracker_user_access() may also be removed in a minor
|
||||
* release.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param int $account
|
||||
* The user account ID to track.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if a user has permission to access the account for $account and
|
||||
* has permission to access the content.
|
||||
*
|
||||
* @see tracker_menu()
|
||||
*/
|
||||
function _tracker_user_access($account) {
|
||||
@trigger_error('_tracker_user_access() is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0.', E_USER_DEPRECATED);
|
||||
return $account->access('view') && $account->hasPermission('access content');
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ use Drupal\node\Entity\Node;
|
|||
*
|
||||
* @return array
|
||||
* A renderable array.
|
||||
*
|
||||
* @see tracker_menu()
|
||||
*/
|
||||
function tracker_page($account = NULL) {
|
||||
if ($account) {
|
||||
|
|
|
@ -25,4 +25,3 @@ tracker.user_tab:
|
|||
_permission: 'access content'
|
||||
_entity_access: 'user.view'
|
||||
user: \d+
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ function tracker_views_data_alter(&$data) {
|
|||
'field' => 'uid',
|
||||
'name table' => 'users_field_data',
|
||||
'name field' => 'name',
|
||||
'id' => 'tracker_user_uid'
|
||||
'id' => 'tracker_user_uid',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
Reference in a new issue