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 branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -112,6 +112,8 @@ function testTrackerUser() { ...@@ -112,6 +112,8 @@ function testTrackerUser() {
$this->assertText($my_published->label(), "Published nodes 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->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->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. // Verify that title and tab title have been set correctly.
$this->assertText('Activity', 'The user activity tab has the name "Activity".'); $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.'); $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() { ...@@ -212,6 +214,7 @@ function testTrackerNewComments() {
$this->drupalLogin($this->user); $this->drupalLogin($this->user);
$this->drupalGet('activity'); $this->drupalGet('activity');
$this->assertText('1 new', 'New comments are counted on the tracker listing pages.'); $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) { ...@@ -73,8 +73,15 @@ function tracker_page($account = NULL) {
$comments = $node->comment_count; $comments = $node->comment_count;
if ($new = \Drupal::service('comment.manager')->getCountNewComments($node)) { if ($new = \Drupal::service('comment.manager')->getCountNewComments($node)) {
$comments .= '<br />'; $comments = array(
$comments .= \Drupal::l(format_plural($new, '1 new', '@count new'), $node->urlInfo()->setOptions(array('fragment' => 'new'))); '#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) { ...@@ -85,10 +92,29 @@ function tracker_page($account = NULL) {
$row = array( $row = array(
'type' => String::checkPlain(node_get_type_label($node)), 'type' => String::checkPlain(node_get_type_label($node)),
'title' => array('data' => \Drupal::l($node->getTitle(), $node->urlInfo()) . ' ' . drupal_render($mark_build)), 'title' => array(
'author' => array('data' => array('#theme' => 'username', '#account' => $node->getOwner())), 'data' => array(
'replies' => array('class' => array('replies'), 'data' => $comments), '#type' => 'link',
'last updated' => array('data' => t('!time ago', array('!time' => \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $node->last_activity)))), '#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; $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