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

Support multiple order by statements in the discussion model (breaks backwards compat of discussion sorting) #3523

Closed
wants to merge 5 commits into from

Conversation

beckyvb
Copy link
Contributor

@beckyvb beckyvb commented Feb 10, 2016

Add a function that checks order by values.
Add order by values in a loop to support multiple order by values.
Adds Score to allowed sort fields.
Gives events the ability to override these values.


$this->EventArguments['SortField'] = &$SortField;
$this->EventArguments['SortDirection'] = c('Vanilla.Discussions.SortDirection', 'desc');
$this->EventArguments['OrderFields'] = &$orderFields;
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks backwards compatibility for any plugin manipulating this, and I don't see any good reason for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pull request is to support multiple order by clauses. Keeping the single string-type sort field as an argument means that we would need to build extra logic (i.e., if the OrderFields exist, use that, otherwise default to the SortField... etc.) Consolidating the sort fields and directions into one array is simpler and more explicit in that we know which direction belongs to which field.

I've done a search to see whether these arguments are even being used in Vanilla and it came up empty. I think it's a pretty safe enhancement.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's gonna break some open source plugins for sure. There was a whole conversation about using this hook a couple weeks back. Super conflicted about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear: conflicted about whether we need some logic here to restore backwards compat, not the need for the change.

@linc linc changed the title Support multiple order by statements in the discussion model. Support multiple order by statements in the discussion model (breaks backwards compat of BeforeGet) Feb 22, 2016
@linc linc added the Status: WIP This pull request is currently in progress. Do NOT merge it. label Feb 22, 2016
@linc linc changed the title Support multiple order by statements in the discussion model (breaks backwards compat of BeforeGet) Support multiple order by statements in the discussion model (breaks backwards compat of discussion sorting) Feb 22, 2016
@linc
Copy link
Contributor

linc commented Feb 22, 2016

I feel like maybe we should merge this into #3528 as 1 big pull request since we're now destroying the old discussion sorting behavior and wholesale replacing it.

@beckyvb
Copy link
Contributor Author

beckyvb commented Feb 23, 2016

Merged into #3528

@beckyvb beckyvb closed this Feb 23, 2016
@beckyvb beckyvb deleted the feature/discussion-model-ordering branch February 23, 2016 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: WIP This pull request is currently in progress. Do NOT merge it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants