Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'as loaded' sort ordering #976

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

antonnyst
Copy link

Implemented 'as loaded' search by quite simply not sorting the results.

Resolves #933

I have only tested this with a single source of Spotify, so might be an good idea to test with multiple different sources to make sure it works before merging.

@@ -353,6 +353,7 @@ search:
more: 'All playlists (%{count})'
tracks:
title: Tracks
asloaded: 'As loaded'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to create a new translation entry here, duplication of fields.filters.as_loaded

@@ -75,6 +75,7 @@ const Search = () => {
{ value: 'followers', label: i18n('common.popularity') },
{ value: 'artist', label: i18n('common.artist') },
{ value: 'duration', label: i18n('common.duration') },
{ value: 'asloaded', label: i18n('search.asloaded')}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a gander at the equivalent syntax for other views, for instance src/js/views/Library/Albums.jsx.

"As loaded" translates quite literally to "don't sort me!" ie sortOrder: null:

      {
        value: null,
        label: i18n('fields.filters.as_loaded'),
      }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems like a better way to do it!

(type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField),
sortReverse,
);
if (sortField !== 'asloaded') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"As loaded" is null, so we would invert the logic here to if (sortField) { ... then sort

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search results "as loaded" ordering
2 participants