Correcting contact's articles order #15962
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request for Issue #15856
Testing Instructions
Create a contact for a user who is the author of some articles, make sure to set different Publishing dates for these articles and archive one of them.
Display the contact for that user in frontend. Make sure Articles are set to display.
Actual result
When displaying a contact's articles, they are displayed by Archived descendant first and then by Created date descendant.
We have
->order('a.state DESC, a.created DESC');
and
$query->where('a.state IN (1,2)')
(2 is for the Archived)This makes no sense (or should be the choice of the user, see further)
Expected result
After patching, they will be displayed by publishing date descendant.
Archives are also displayed in that order, therefore would be mixed among other articles.
This solves #15856
@AlexRed
Note: this patch could be largely improved
We may create new params to choose the way these articles are displayed:
Recently Created, Recently Published, Recently Modified (as in mod_articles_latest), and include or not Archives and Archives first/last.
I can modify this PR to include these new params. If we do, as langs are frozen for 3.7.1, it would be for a future version.
Please test patch and feedback wanted! 😄