Skip to content

Commit

Permalink
Fix email digests
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetsprague committed Apr 8, 2021
1 parent bb38616 commit ffd89c2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/models/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ module.exports = bookshelf.Model.extend(merge({
.orderBy('groups.name', 'asc')
},

comments: function () {
return Comment.collection().query(q => {
q.join('groups_posts', 'groups_posts.post_id', 'comments.post_id')
q.where({
'groups_posts.group_id': this.id,
'comments.active': true
})
})
},

creator: function () {
return this.belongsTo(User, 'created_by_id')
},
Expand Down

0 comments on commit ffd89c2

Please sign in to comment.