Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chi created an issue. See original summary.

felribeiro’s picture

Make Author column sortable

rakesh.gectcr’s picture

pls review the patch attached

rakesh.gectcr’s picture

Status: Active » Needs review
cosmicdreams’s picture

Status: Needs review » Reviewed & tested by the community

Such a simple patch. Now that you mention it. It IS rather odd that the author is the only field in the default view that isn't sortable. I wonder if that was intentional or an outcome of converting the default admin_view for the content page to Drupal 8.

I think making this small change will dodge a source of confusion to content managers who visit this page on their shiny new Drupal 8 sites.

RTBC.

Chi’s picture

capuleto’s picture

I believe this patch won't work as soon as one implementation of hook_user_format_name_alteralters the user name since the view will sort by the username stored in the database and not by the one displayed

Chi’s picture

I just found that the Author column is not sortable in Drupal 7 as well.

xjm’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Reviewed & tested by the community » Postponed

Thanks for submitting this patch!

As a feature request, this change should now be postponed to 8.1.x since Drupal 8.0.x is in its release candidate phase. Reference: https://www.drupal.org/core/d8-allowed-changes

cosmicdreams’s picture

Well at least it is a simple thing to change

yoroy’s picture

Status: Postponed » Needs review
cosmicdreams’s picture

Status: Needs review » Reviewed & tested by the community

What's to review, it's a simple configuration change. Are you saying that it should be manually tested? I could do that.

yoroy’s picture

Just checking if the patch still applies :)

catch’s picture

Status: Reviewed & tested by the community » Needs review

@capuleto's point is worth discussing a bit more I think. Not sure if that's why it isn't sortable now.

Also sorting on username is only very helpful if you're looking for something authored by A or Z - otherwise you're clicking through pages and could use a filter instead.

Chi’s picture

Not sure if that's why it isn't sortable now.

It is not sortable since #373897: admin/content still has sortable author column resulting in SQL errors.

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.

surbz’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed patch #3 in 8.2.x-dev and it works correctly.

naveenvalecha’s picture

can we add tests here for testing this functionality ?
do we need an update hook here for views update ?

alexpott’s picture

Status: Reviewed & tested by the community » Needs review

@naveenvalecha I don;t think we need to change existing sites - the functionality is not that important - plus they could have manually changed this view.

There's still not a decent response to @capuleto's point in #7 - about what happens when the user name is changed completely by the hook. For example by the realname module.

Chi’s picture

what happens when the user name is changed completely by the hook

What makes hook_user_format_name_alter() so special? There are lots of other hooks that may break the view. My point is that the developer who changes the name format owes fixing the view sorting to himself.

dawehner’s picture

What makes hook_user_format_name_alter() so special? There are lots of other hooks that may break the view. My point is that the developer who changes the name format owes fixing the view sorting to himself.

There is the realname module which implements this for example. It is more common to have this hook implemented than other hooks, which might break the view. In general though I agree with you, it should not prevent us from this here.

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.

ronchica’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
104.92 KB
116.26 KB
117.27 KB
100.18 KB

I tested this manually. It might still need automated tests, but I think this is a good feature to have, so helping it along.

Without the patch, the author is not sortable/clickable:

With the patch:

Ordered by updated date:

Click on "Author" ascending:

Click on "Author" again, descending:

I also tried changing usernames, and still all worked.

shadcn’s picture

#1986606: Convert the comments administration screen to a view might be a related issue. Most patches there makes uid, hence author, sortable. And right now the comment overview form has "Author" sortable.

ronchica’s picture

xjm’s picture

Title: Content overview page: make Author column sortable » Content overview page: make Author column sortable by default on new installations
Priority: Minor » Normal
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests, +needs profiling

Thanks @arshadcn for looking for other precedents in core; that is helpful. Thanks also @ronchica for the thorough manual testing; that's exactly the sort of review this issue needed to make progress.

I am changing the title so that everyone will keep in mind this is just a small change to new installations and will not affect existing ones.

  1. To me sorting on username did not seem that valuable... sites will have hundreds, thousands, or millions of pieces of content, so it would not be very usable to sort on username usually. On the other hand, sorting by published status makes far less sense, and the table lets you do that already in HEAD.
  2. I think the discussion about the value of the sort when username display is often altered (#7 and on) is valuable. It looks like @dawehner has signed off as a subsystem maintainer in #21, so I think that is addressed now.
  3. However, the sorting was removed on purpose in D7 critical issue #373897: admin/content still has sortable author column resulting in SQL errors for performance/scalability reasons. I don't see anyone addressing that yet after @Chi pointed it out. Maybe Views' caching etc. mitigates this performance concern in D8, but I have no idea. This view is a massive one on most sites so we need to actually profile it and confirm that the sorting doesn't cause a performance/scalability regression.
  4. Finally, if the performance turns out to not be a problem, this patch does still need automated tests. This view is very important, and is tested thoroughly in core/modules/node/src/Tests/NodeAdminTest.php (although it's maybe not... the most modern automated test out there). Other sorting for the view is tested in that class, so let's add tests there for this feature as well. However, I would not do the work to add tests until we confirm the performance is acceptable.

NW for #3 especially.

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.

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.

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.

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.

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.