Skip to content
Snippets Groups Projects
Commit 390315b4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2322439 by subhojit777, akashjain132, znerol, jaimekristene, japo32,...

Issue #2322439 by subhojit777, akashjain132, znerol, jaimekristene, japo32, ThomWilhelm: Titles in a user's activity tab displays as just text and not a link
parent adc46c86
No related merge requests found
......@@ -112,6 +112,8 @@ function testTrackerUser() {
$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.");
$this->assertLink($my_published->label());
$this->assertNoLink($unpublished->label());
// Verify that title and tab title have been set correctly.
$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.');
......@@ -212,6 +214,7 @@ function testTrackerNewComments() {
$this->drupalLogin($this->user);
$this->drupalGet('activity');
$this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
$this->assertLink(t('1 new'));
}
/**
......
......@@ -73,8 +73,15 @@ function tracker_page($account = NULL) {
$comments = $node->comment_count;
if ($new = \Drupal::service('comment.manager')->getCountNewComments($node)) {
$comments .= '<br />';
$comments .= \Drupal::l(format_plural($new, '1 new', '@count new'), $node->urlInfo()->setOptions(array('fragment' => 'new')));
$comments = array(
'#type' => 'link',
'#url' => $node->urlInfo(),
'#title' => \Drupal::translation()->formatPlural($new, '1 new', '@count new'),
'#options' => array(
'fragment' => 'new',
),
'#prefix' => $node->comment_count . '<br />',
);
}
}
......@@ -85,10 +92,29 @@ function tracker_page($account = NULL) {
$row = array(
'type' => String::checkPlain(node_get_type_label($node)),
'title' => array('data' => \Drupal::l($node->getTitle(), $node->urlInfo()) . ' ' . drupal_render($mark_build)),
'author' => array('data' => array('#theme' => 'username', '#account' => $node->getOwner())),
'replies' => array('class' => array('replies'), 'data' => $comments),
'last updated' => array('data' => t('!time ago', array('!time' => \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $node->last_activity)))),
'title' => array(
'data' => array(
'#type' => 'link',
'#url' => $node->urlInfo(),
'#title' => $node->getTitle(),
'#suffix' => ' ' . drupal_render($mark_build),
),
),
'author' => array(
'data' => array(
'#theme' => 'username',
'#account' => $node->getOwner(),
),
),
'replies' => array(
'class' => array('replies'),
'data' => $comments,
),
'last updated' => array(
'data' => t('!time ago', array(
'!time' => \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $node->last_activity),
)),
),
);
$rows[] = $row;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment