mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Fixed random test failure due to member newsletter ordering (#16024)
fixes https://github.com/TryGhost/Team/issues/2365 The newsletters relation of a member was not sorted. This is fixed now, so we have consistent results in the test snapshots.
This commit is contained in:
parent
c0b700147e
commit
211de82a8d
1 changed files with 2 additions and 1 deletions
|
@ -165,6 +165,7 @@ const Member = ghostBookshelf.Model.extend({
|
|||
|
||||
newsletters() {
|
||||
return this.belongsToMany('Newsletter', 'members_newsletters', 'member_id', 'newsletter_id')
|
||||
.query('orderBy', 'newsletters.sort_order', 'ASC')
|
||||
.query((qb) => {
|
||||
// avoids bookshelf adding a `DISTINCT` to the query
|
||||
// we know the result set will already be unique and DISTINCT hurts query performance
|
||||
|
|
Loading…
Add table
Reference in a new issue