Problem/Motivation

Converting tracker listing to Drupal view.

Steps to reproduce

NA - not a bug.

Proposed resolution

Clean up current code. Convert the tracker listing into a view instead.

Remaining tasks

  1. Update patch with view which was taken out starting at #75
  2. Verified desired fields for view
  3. Update hook for importing new view
  4. Review current code base to make sure nothing was calling the tracker routes
  5. Code review

User interface changes

  • There will be an additional view now.
  • There will be a new tab on the user page for "Activity"

API changes

Removing tracker routes and menu link if that counts

Data model changes

Release notes snippet

Original report by damiankloip

Opposite to #1853572: Remove the old default tracker view, we need to create a new tracker view when #1829734: Expose tracker data to views is committed.

CommentFileSizeAuthor
#98 1941830-98-WIP.patch36.4 KBsmustgrave
#94 1941830-94.patch5.13 KBsmustgrave
#93 1941830-93.patch5.14 KBsmustgrave
#93 interdiff-86-93.txt1.7 KBsmustgrave
#92 1941830-92.patch5.13 KBsmustgrave
#92 interdiff-86-92.txt1.21 KBsmustgrave
#86 1941830-86.patch6.53 KBHardik_Patel_12
#84 1941830-tracker_view-84.patch11.94 KBvsujeetkumar
#77 1941830-tracker_view-77.patch15.87 KBpk188
#75 1941830-tracker_view-75.patch40.31 KBpk188
#61 1941830-tracker_view-61.patch43.75 KBfgm
#59 1941830-tracker_view-59.patch43.23 KBfgm
#57 1941830-tracker_view-57.patch43.23 KBfgm
#55 1941830-tracker_view-55.patch41.32 KBfgm
#53 1941830-tracker_view-53.patch41.55 KBfgm
#51 1941830-tracker_view-51.patch39.77 KBfgm
#49 1941830-tracker_view-49.patch133.4 KBfgm
#47 1941830-tracker_view-47.patch39.31 KBfgm
#44 1941830-tracker_view-44.patch39.29 KBfgm
#39 interdiff-1941830-34-39.txt4.29 KBfgm
#39 1941830-tracker_view-39.patch38.19 KBfgm
#34 1941830-tracker_view-32.patch37.46 KBfgm
#34 1941830-tracker_view-32.patch37.46 KBfgm
#32 tracker-1941830-32.patch35.84 KBpcambra
#32 interdiff-1941830-29-32.txt1.77 KBpcambra
#30 interdiff-1941830-27-29.txt7.79 KBpcambra
#29 tracker-1941830-29.patch35.68 KBpcambra
#27 tracker-1941830-27.patch36.17 KBpcambra
#19 tracker-1941830-19.patch12.58 KBamitgoyal
#14 tracker-1941830-14.patch15.35 KBkillua99
#12 interdiff-do-not-test.patch11.25 KBoadaeh
#12 tracker-1941830-12.patch39.15 KBoadaeh
#10 tracker-1941830-10.patch33 KBoadaeh
#5 tracker-1941830-5.patch43.21 KBekes
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

damiankloip’s picture

Title: Create new tracker default view » Port tracker default view based on new info
xjm’s picture

Status: Postponed » Active
xjm’s picture

Title: Port tracker default view based on new info » Convert tracker listings to a view

Actually, let's be bolder. There's no reason to maintain the legacy listing since tracker is a feature module.

ekes’s picture

Changing the filter to use the tracker_user table alters explain results to:

+----+-------------+-------------------------+--------+------------------------------+---------+---------+
----------------------------+------+---------------------------------+
| id | select_type | table                   | type   | possible_keys                | key     | key_len | ref                        | rows | Extra                           |
+----+-------------+-------------------------+--------+------------------------------+---------+---------+
----------------------------+------+---------------------------------+
|  1 | SIMPLE      | node                    | ALL    | PRIMARY                      | NULL    | NULL    | NULL                       |    2 | Using temporary; Using filesort |
|  1 | SIMPLE      | node_field_data         | ref    | PRIMARY,node_status_type,nid | PRIMARY | 4       | d8_dev.node.nid            |    1 | Using where                     |
|  1 | SIMPLE      | users_node_field_data   | eq_ref | PRIMARY                      | PRIMARY | 4       | d8_dev.node_field_data.uid |    1 |                                 |
|  1 | SIMPLE      | tracker_user            | eq_ref | PRIMARY,tracker              | PRIMARY | 8       | d8_dev.node.nid,const      |    1 | Using index                     |
|  1 | SIMPLE      | node_comment_statistics | ALL    | PRIMARY                      | NULL    | NULL    | NULL                       |    2 | Using where; Using join buffer  |
|  1 | SIMPLE      | history                 | eq_ref | PRIMARY,nid                  | PRIMARY | 8       | const,d8_dev.node.nid      |    1 |                                 |
+----+-------------+-------------------------+--------+------------------------------+---------+---------+
----------------------------+------+---------------------------------+

Where it was PRIMARY and DEPENDENT SUBQUERY before.

Looking at making a patch.

ekes’s picture

FileSize
43.21 KB

Attached patch which still needs work. Three known issues. I don't know if anyone has any thoughts:-

  • The user/%/track page needs an additional check on view the entity. in the present tracker the check is both 'access content' and view user. So that's an additional 'permission to view user' on the 'Tracker - User: ...' contextual filter (which seems less obvious than the taxonomy/term/% case); or #2029509: Add a generic entity argument validation plugin. with the ability to have both view content permission, and access user entity.
  • The patch fails testing by not implementing a tab, tracker/%current_user. There is tracker/%user generally (it's the same as user/%/track - so it could actually be removed - permission note above also valid here). It would be easy to make another page tracker/my as a tab where the argument is specified as current user. If following what is already in core is most important this should be done, one more page display - nothing really. It really is duplicated user/%own_user/track though - even in core now.
  • The patch fails testing on: line 279 Drupal\tracker\Tests\TrackerTest->testTrackerAdminUnpublish(). For some reason in simpletest there is no table at all displayed if there are no results. If I repeat the test manually (create a node, delete a node, view the tracker table) the view table is displayed with the 'No results' text area shown as the row. I'm not sure what the difference is. Any experienced anything similar?
xjm’s picture

Status: Active » Needs review

Nice, thanks @ekes!

The last submitted patch, tracker-1941830-5.patch, failed testing.

xjm’s picture

Issue summary: View changes
Issue tags: +beta target
oadaeh’s picture

Assigned: Unassigned » oadaeh

This is just an FYI that I am working on this issue to upgrade the patch to the current state of D8.

oadaeh’s picture

Status: Needs work » Needs review
FileSize
33 KB

Here's my attempt so far.

Here are the issues I know about:
* When showing the count of new comments, I get a WSOD and an error similar to this in the Apache logs: "PHP Fatal error: Call to undefined method stdClass::id() in /var/www/vcs/git/drupal/drupal/8.x/core/modules/comment/lib/Drupal/comment/Plugin/views/field/NodeNewComments.php on line 130, referer: http://localhost/drupalsandboxes/drupal-8.x/"
* When removing the tracker.routing.yml file, I got Symfony errors trying to access anything in user other than user/$uid/track, and so I've removed the controllers, since they aren't being used and removing them doesn't appear to cause problems, but I've left the routing and local_task YAML files.
* Local tests failed on a couple of things that were clearly working. I'm hoping those tests won't fail here.

Status: Needs review » Needs work

The last submitted patch, 10: tracker-1941830-10.patch, failed testing.

oadaeh’s picture

Assigned: oadaeh » Unassigned
Status: Needs work » Needs review
FileSize
39.15 KB
11.25 KB

Here's a more improved view that more closely resembles the tables in the D7 version. The tests still fail, but I'm not sure how to correct them. I've tweaked the view and the tests so they better match each other, but Simpletest still doesn't see the results correctly.

Status: Needs review » Needs work

The last submitted patch, 12: tracker-1941830-12.patch, failed testing.

killua99’s picture

FileSize
15.35 KB

First a re-roll cause the patch doesn't apply to the last 8.x

So my interdiff is quite hard to reproduce.

oadaeh’s picture

Status: Needs work » Needs review

Let's at least see what the test bot has to say.

Status: Needs review » Needs work

The last submitted patch, 14: tracker-1941830-14.patch, failed testing.

killua99’s picture

@oadaeh, that patch is a big fail. I did a wrong stuff with git and did commit the new file and did a mess.

If I have change today I'll fix it, and I did some research and I guess I did find the problem. (for the test stuff)

dawehner’s picture

Issue tags: +Needs reroll

.

amitgoyal’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
12.58 KB

Reroll of #14.

Status: Needs review » Needs work

The last submitted patch, 19: tracker-1941830-19.patch, failed testing.

oadaeh’s picture

The patches in #14 and #19 are incomplete.

oadaeh’s picture

Assigned: Unassigned » oadaeh
oadaeh’s picture

Assigned: oadaeh » Unassigned
dawehner’s picture

Note: converting the tracker page to a view would fix IMHO a security issue of not checking the access to those base fields.

larowlan’s picture

Priority: Normal » Major
Issue tags: +Security

+1 to the security hardening here - bumping it to major for that reason

oadaeh’s picture

As an FYI, this will have to be restarted from scratch, as the most recent patch is so far out of date, it doesn't even pretend to apply. I started it on Sprint day, but I had too many other distractions and didn't make very much headway.

pcambra’s picture

Status: Needs work » Needs review
FileSize
36.17 KB

I gave the reroll a try and updated the view. Let's get the ball rolling again :)

Status: Needs review » Needs work

The last submitted patch, 27: tracker-1941830-27.patch, failed testing.

pcambra’s picture

Status: Needs work » Needs review
FileSize
35.68 KB

Some fixes, I guess that if we're not providing a legacy mode, the routing.yml file should be removed.
There are a bunch of tests accessing "activity" still, I guess they should go to tracker instead.

pcambra’s picture

Ooops, interdiff.

Status: Needs review » Needs work

The last submitted patch, 29: tracker-1941830-29.patch, failed testing.

pcambra’s picture

Status: Needs work » Needs review
FileSize
1.77 KB
35.84 KB

Some progress but still far fetched.

I've removed the routes and the links, I think that should probably happen on the view.

In hook_help there's this but tracker.page is not a route, what's the preferred option for arbitrary internal urls? (does views generate a route?) the Change record doesn't seem to mention it https://www.drupal.org/node/2346779

      $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>';

Status: Needs review » Needs work

The last submitted patch, 32: tracker-1941830-32.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
37.46 KB
37.46 KB

Latest patch no longer even applied. Rerolled to check how it fares now.

dawehner’s picture

  1. +++ b/core/modules/tracker/config/install/views.view.tracker.yml
    @@ -0,0 +1,806 @@
    +      access:
    +        type: perm
    +        options:
    +          perm: 'access content'
    
    +++ /dev/null
    @@ -1,26 +0,0 @@
    -  requirements:
    -    _permission: 'access content'
    -    _access_tracker_own_information: 'TRUE'
    

    This is the only access checking we do ... we need so a test to ensure that it works.

  2. +++ b/core/modules/tracker/config/install/views.view.tracker.yml
    @@ -0,0 +1,806 @@
    +    position: 2
    +    display_options:
    +      path: user/%/activity
    ...
    +        access: true
    
    +++ /dev/null
    @@ -1,26 +0,0 @@
    -  requirements:
    -    _permission: 'access content'
    -    _entity_access: 'user.view'
    

    Maybe I'm stupid but we seem to not care about the level of access control ...

The last submitted patch, 34: 1941830-tracker_view-32.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 34: 1941830-tracker_view-32.patch, failed testing.

fgm’s picture

Assigned: Unassigned » fgm

Assigning to self to avoid someone else doing duplicate work.

fgm’s picture

Status: Needs work » Needs review
FileSize
38.19 KB
4.29 KB

This seems to work locally, do tests pass ?

@dawehner : all displays have access control based on perm: access content.

Status: Needs review » Needs work

The last submitted patch, 39: 1941830-tracker_view-39.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
39.29 KB

Some (all ?) fails were due to views' format changes. This should fail less.

andypost’s picture

The last submitted patch, 41: 1941830-tracker_view-41.patch, failed testing.

fgm’s picture

More fixes.

Status: Needs review » Needs work

The last submitted patch, 44: 1941830-tracker_view-44.patch, failed testing.

fgm’s picture

Much better, and it confirms andypost's remark about the comment statistics issue.

fgm’s picture

Status: Needs work » Needs review
FileSize
39.31 KB

This should fix all the fails on the NodeAccessTest...

Status: Needs review » Needs work

The last submitted patch, 47: 1941830-tracker_view-47.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
133.4 KB

This restores the tabs, so should fixe some more errors.

Status: Needs review » Needs work

The last submitted patch, 49: 1941830-tracker_view-49.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
39.77 KB

This removes most exceptions and some of the errors locally. What does it give here ?

Status: Needs review » Needs work

The last submitted patch, 51: 1941830-tracker_view-51.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
41.55 KB

No time for more right now, but this should remove one fail.

Status: Needs review » Needs work

The last submitted patch, 53: 1941830-tracker_view-53.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
41.32 KB

Just to be sure, part of one test removed : the case when comment module is there (it's a dependency for tracker) but comments are disabled.

This should pass, and is to make sure the problem is isolated.

Status: Needs review » Needs work

The last submitted patch, 55: 1941830-tracker_view-55.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
43.23 KB

One more of the test functions should now pass.

Status: Needs review » Needs work

The last submitted patch, 57: 1941830-tracker_view-57.patch, failed testing.

fgm’s picture

One more complete test should now be passing: the regex for new nodes had been wrong all the time.

Status: Needs review » Needs work

The last submitted patch, 59: 1941830-tracker_view-59.patch, failed testing.

fgm’s picture

Status: Needs work » Needs review
FileSize
43.75 KB

Expecting one less fail.

Status: Needs review » Needs work

The last submitted patch, 61: 1941830-tracker_view-61.patch, failed testing.

fgm’s picture

Assigned: fgm » Unassigned

One less fail indeed, but as Drupalcon is over, I will not be able to continue on this in the next few days, so unassigning myself for now.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 61: 1941830-tracker_view-61.patch, failed testing.

andypost’s picture

Version: 8.0.x-dev » 8.1.x-dev

Suppose that should go into 8.1

gaydabura’s picture

Assigned: Unassigned » gaydabura

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Issue tags: -beta target

This issue was marked as a beta target for the 8.0.x beta, but is not applicable as an 8.1.x beta target, so untagging.

gaydabura’s picture

Assigned: gaydabura » Unassigned

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Manuel Garcia’s picture

Issue tags: +Needs reroll

Had a go at re-rolling this but it may be worth just starting from a new patch at this point. Adding the tag for visibility.

Manuel Garcia’s picture

Component: views.module » tracker.module
pk188’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
40.31 KB

Status: Needs review » Needs work

The last submitted patch, 75: 1941830-tracker_view-75.patch, failed testing.

pk188’s picture

Status: Needs work » Needs review
FileSize
15.87 KB

Status: Needs review » Needs work

The last submitted patch, 77: 1941830-tracker_view-77.patch, failed testing.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
11.94 KB

Patch re-rolled, Please review.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Hardik_Patel_12’s picture

Status: Needs review » Needs work

The last submitted patch, 86: 1941830-86.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

rerolled for 9.5

smustgrave’s picture

phpcs fix

smustgrave’s picture

Status: Needs work » Needs review
FileSize
5.13 KB

Another phpcs

Status: Needs review » Needs work

The last submitted patch, 94: 1941830-94.patch, failed testing. View results

smustgrave’s picture

So I believe all patches after #75 should be ignored. Seems after 75 the view itself was removed and if that wasn't noticed then these patches probably need more work.

Know the help text in tracker.module isn't functional because it's pointing to a route that is now being deleted.
The view itself probably needs to be recreated
Will need an install hook to import this new view.

Am I forgetting anything?

smustgrave’s picture

Issue summary: View changes
smustgrave’s picture

Updated the issue summary

Deleted TrackerController as that doesn't appear to be needed with tracker.routing being deleted.
Scanned the core repo looking for tracker routes and believe they've all been updated.
Updated the view to be more simple. Removed page_3 as it appeared ot be a duplicate of page_2

Just need to write an update hook

Attaching a work in progress patch for any early review.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

This extension is deprecated and scheduled for removal in Drupal 11.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to the contributed extension once the Drupal 11 branch is open.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.