🐛 Fixed commenting on tier-only posts (#15333)

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

**Problem:**
Members were not able to comment on a post that was only visible for members with a specific tier.

**Causes:**
Content gating was done on models with missing relations.
- The products relation was not loaded on the member when doing content gating
- The tiers relation was not loaded on the post when doing content gating

**Tests:**
- Added for tier-only posts
- Added for paid-only commenting
This commit is contained in:
Simon Backx 2022-08-30 17:38:58 +02:00 committed by GitHub
parent e7786ca482
commit 4282ead3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2643 additions and 670 deletions

View File

@ -160,7 +160,8 @@ class CommentsService {
id: member
}, {
require: true,
...options
...options,
withRelated: ['products']
});
this.checkCommentAccess(memberModel);
@ -169,7 +170,8 @@ class CommentsService {
id: post
}, {
require: true,
...options
...options,
withRelated: ['tiers']
});
this.checkPostAccess(postModel, memberModel);
@ -208,7 +210,8 @@ class CommentsService {
id: member
}, {
require: true,
...options
...options,
withRelated: ['products']
});
this.checkCommentAccess(memberModel);
@ -229,7 +232,8 @@ class CommentsService {
id: parentComment.get('post_id')
}, {
require: true,
...options
...options,
withRelated: ['tiers']
});
this.checkPostAccess(postModel, memberModel);

File diff suppressed because it is too large Load Diff