0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

🐛 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 Daniel Lockyer
parent aec2badc6c
commit 8cd2b3182a
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
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