Fixed options not being passed to loaded replies

fixes https://github.com/TryGhost/Team/issues/1787

- Options were not passed
- The member context variable was not passed to the count helper
- Liked was always false for replies
This commit is contained in:
Simon Backx 2022-08-12 14:41:29 +02:00
parent 60cd54dda3
commit 5c75997685

View File

@ -52,8 +52,7 @@ const Comment = ghostBookshelf.Model.extend({
replies() {
return this.hasMany('Comment', 'parent_id', 'id')
.query('orderBy', 'id', 'ASC')
.query('limit', 3);
.query('orderBy', 'created_at', 'ASC');
},
emitChange: function emitChange(event, options) {
@ -214,7 +213,7 @@ const Comment = ghostBookshelf.Model.extend({
const result = await ghostBookshelf.Model.findPage.call(this, options);
for (const model of result.data) {
await model.load(relationsToLoadIndividually);
await model.load(relationsToLoadIndividually, _.omit(options, 'withRelated'));
}
return result;