Commit 022163f5 authored by alexpott's avatar alexpott

Issue #140363 by synth3tk, makemineatriple, realityloop, yoroy, YesCT, Niklas...

Issue #140363 by synth3tk, makemineatriple, realityloop, yoroy, YesCT, Niklas Fiekas, Schnitzel, corbacho | Jao: In user profiles, "Track" tab should be renamed "Activity".
parent fa9e8bbe
......@@ -56,19 +56,19 @@ function testTrackerNodeAccess() {
));
// User with access should see both nodes created.
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
$this->drupalGet('user/' . $access_user->id() . '/track');
$this->drupalGet('user/' . $access_user->id() . '/activity');
$this->assertText($private_node->getTitle(), 'Private node is visible to user with private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user with private access.');
// User without access should not see private node.
$this->drupalLogin($no_access_user);
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
$this->drupalGet('user/' . $access_user->id() . '/track');
$this->drupalGet('user/' . $access_user->id() . '/activity');
$this->assertNoText($private_node->getTitle(), 'Private node is not visible to user without private access.');
$this->assertText($public_node->getTitle(), 'Public node is visible to user without private access.');
}
......
......@@ -64,14 +64,14 @@ function testTrackerAll() {
'status' => 1,
));
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertNoText($unpublished->label(), 'Unpublished node does not show up in the tracker listing.');
$this->assertText($published->label(), 'Published node shows up in the tracker listing.');
$this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
// Delete a node and ensure it no longer appears on the tracker.
$published->delete();
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertNoText($published->label(), 'Deleted node does not show up in the tracker listing.');
}
......@@ -107,20 +107,20 @@ function testTrackerUser() {
);
$this->drupalPostForm('comment/reply/node/' . $other_published_my_comment->id() . '/comment', $comment, t('Save'));
$this->drupalGet('user/' . $this->user->id() . '/track');
$this->drupalGet('user/' . $this->user->id() . '/activity');
$this->assertNoText($unpublished->label(), "Unpublished nodes do not show up in the user's tracker listing.");
$this->assertText($my_published->label(), "Published nodes show up in the user's tracker listing.");
$this->assertNoText($other_published_no_comment->label(), "Another user's nodes do not show up in the user's tracker listing.");
$this->assertText($other_published_my_comment->label(), "Nodes that the user has commented on appear in the user's tracker listing.");
// Verify that title and tab title have been set correctly.
$this->assertText('Track', 'The user tracker tab has the name "Track".');
$this->assertText('Activity', 'The user activity tab has the name "Activity".');
$this->assertTitle(t('@name | @site', array('@name' => $this->user->getUsername(), '@site' => \Drupal::config('system.site')->get('name'))), 'The user tracker page has the correct page title.');
// Verify that unpublished comments are removed from the tracker.
$admin_user = $this->drupalCreateUser(array('post comments', 'administer comments', 'access user profiles'));
$this->drupalLogin($admin_user);
$this->drupalPostForm('comment/1/edit', array('status' => CommentInterface::NOT_PUBLISHED), t('Save'));
$this->drupalGet('user/' . $this->user->id() . '/track');
$this->drupalGet('user/' . $this->user->id() . '/activity');
$this->assertNoText($other_published_my_comment->label(), 'Unpublished comments are not counted on the tracker listing.');
}
......@@ -136,8 +136,8 @@ function testTrackerNewNodes() {
$node = $this->drupalCreateNode($edit);
$title = $edit['title'];
$this->drupalGet('tracker');
$this->assertPattern('/' . $title . '.*new/', 'New nodes are flagged as such in the tracker listing.');
$this->drupalGet('activity');
$this->assertPattern('/' . $title . '.*new/', 'New nodes are flagged as such in the activity listing.');
$this->drupalGet('node/' . $node->id());
// Simulate the JavaScript on the node page to mark the node as read.
......@@ -148,11 +148,11 @@ function testTrackerNewNodes() {
'Accept: application/json',
),
));
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertNoPattern('/' . $title . '.*new/', 'Visited nodes are not flagged as new.');
$this->drupalLogin($this->other_user);
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertPattern('/' . $title . '.*new/', 'For another user, new nodes are flagged as such in the tracker listing.');
$this->drupalGet('node/' . $node->id());
......@@ -164,7 +164,7 @@ function testTrackerNewNodes() {
'Accept: application/json',
),
));
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertNoPattern('/' . $title . '.*new/', 'For another user, visited nodes are not flagged as new.');
}
......@@ -195,7 +195,7 @@ function testTrackerNewComments() {
));
$this->drupalLogin($this->other_user);
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
$this->drupalGet('node/' . $node->id());
......@@ -210,7 +210,7 @@ function testTrackerNewComments() {
$this->drupalPostForm('comment/reply/node/' . $node->id(). '/comment', $comment, t('Save'));
$this->drupalLogin($this->user);
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
}
......@@ -271,7 +271,7 @@ function testTrackerOrderingNewComments() {
// Switch back to the other_user and assert that the order has swapped.
$this->drupalLogin($this->other_user);
$this->drupalGet('user/' . $this->other_user->id() . '/track');
$this->drupalGet('user/' . $this->other_user->id() . '/activity');
// This is a cheeky way of asserting that the nodes are in the right order
// on the tracker page.
// It's almost certainly too brittle.
......@@ -317,7 +317,7 @@ function testTrackerCronIndexing() {
$this->drupalLogin($this->user);
// Fetch the user's tracker.
$this->drupalGet('tracker/' . $this->user->id());
$this->drupalGet('activity/' . $this->user->id());
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
......@@ -327,7 +327,7 @@ function testTrackerCronIndexing() {
$this->assertText('updated', 'Node is listed as updated');
// Fetch the site-wide tracker.
$this->drupalGet('tracker');
$this->drupalGet('activity');
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
......@@ -349,7 +349,7 @@ function testTrackerAdminUnpublish() {
));
// Assert that the node is displayed.
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertText($node->label(), 'A node is displayed on the tracker listing pages.');
// Unpublish the node and ensure that it's no longer displayed.
......@@ -359,7 +359,7 @@ function testTrackerAdminUnpublish() {
);
$this->drupalPostForm('admin/content', $edit, t('Apply'));
$this->drupalGet('tracker');
$this->drupalGet('activity');
$this->assertText(t('No content available.'), 'A node is displayed on the tracker listing pages.');
}
}
name: Tracker
name: Activity Tracker
type: module
description: 'Enables tracking of recent content for users.'
dependencies:
......
......@@ -12,4 +12,4 @@ tracker.users_recent_tab:
tracker.user_tab:
route_name: tracker.user_tab
base_route: user.view
title: 'Track'
title: 'Activity'
......@@ -24,7 +24,7 @@ function tracker_help($route_name, RouteMatchInterface $route_match) {
$output .= '<dt>' . t('Tracking new and updated site content') . '</dt>';
$output .= '<dd>' . t('The <a href="!recent">Recent content</a> page shows new and updated content in reverse chronological order, listing the content type, title, author\'s name, number of comments, and time of last update. Content is considered updated when changes occur in the text, or when new comments are added. The <em>My recent content</em> tab limits the list to the currently logged-in user.', array('!recent' => \Drupal::url('tracker.page'))) . '</dd>';
$output .= '<dt>' . t('Tracking user-specific content') . '</dt>';
$output .= '<dd>' . t("To follow a specific user's new and updated content, select the <em>Track</em> tab from the user's profile page.") . '</dd>';
$output .= '<dd>' . t("To follow a specific user's new and updated content, select the <em>Activity</em> tab from the user's profile page.") . '</dd>';
$output .= '</dl>';
return $output;
}
......
tracker.page:
path: '/tracker'
path: '/activity'
defaults:
_content: '\Drupal\tracker\Controller\TrackerPage::getContent'
_title: 'Recent content'
......@@ -7,7 +7,7 @@ tracker.page:
_permission: 'access content'
tracker.users_recent_content:
path: '/tracker/{user}'
path: '/activity/{user}'
defaults:
_content: '\Drupal\tracker\Controller\TrackerUserRecent::getContent'
_title: 'My recent content'
......@@ -18,7 +18,7 @@ tracker.users_recent_content:
_access_tracker_own_information: 'TRUE'
tracker.user_tab:
path: '/user/{user}/track'
path: '/user/{user}/activity'
defaults:
_content: '\Drupal\tracker\Controller\TrackerUserTab::getContent'
_title_callback: '\Drupal\tracker\Controller\TrackerUserTab::getTitle'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment