From 390315b4f30807df4c973d24dd73ba62cc7b9d65 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 19 Nov 2014 12:51:19 +0000
Subject: [PATCH] Issue #2322439 by subhojit777, akashjain132, znerol,
 jaimekristene, japo32, ThomWilhelm: Titles in a user's activity tab displays
 as just text and not a link

---
 .../modules/tracker/src/Tests/TrackerTest.php |  3 ++
 core/modules/tracker/tracker.pages.inc        | 38 ++++++++++++++++---
 2 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php
index d1896fb00697..c593fc4c2253 100644
--- a/core/modules/tracker/src/Tests/TrackerTest.php
+++ b/core/modules/tracker/src/Tests/TrackerTest.php
@@ -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'));
   }
 
   /**
diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc
index 1bebfbef2805..c0077a354dee 100644
--- a/core/modules/tracker/tracker.pages.inc
+++ b/core/modules/tracker/tracker.pages.inc
@@ -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;
-- 
GitLab