mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Fixed announcement showing to visitors when set to paid_members
refs https://github.com/TryGhost/Team/issues/3051 - The filter was not working properly when there was no logged in member, but the announcement filter was set to "paid_members" only
This commit is contained in:
parent
4259867f4e
commit
02f9ecb7c1
@ -36,7 +36,7 @@ class AnnouncementBarSettings {
|
||||
announcement = announcementContent;
|
||||
} else if (visibilities.includes('free_members') && (member?.status === 'free')) {
|
||||
announcement = announcementContent;
|
||||
} else if (visibilities.includes('paid_members') && (member?.status !== 'free')) {
|
||||
} else if (visibilities.includes('paid_members') && (member && member.status !== 'free')) {
|
||||
announcement = announcementContent;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ describe('AnnouncementBarSettings', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns announcement if visibility is set to free members and member is free', function () {
|
||||
it('returns announcement if visibility is set to free_members and member is free', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['free_members'],
|
||||
@ -66,7 +66,7 @@ describe('AnnouncementBarSettings', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns announcement if visibility is set to paid members and member is paid', function () {
|
||||
it('returns announcement if visibility is set to paid_members and member is paid', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['paid_members'],
|
||||
@ -79,7 +79,7 @@ describe('AnnouncementBarSettings', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns announcement if visibility is set to paid and paid members and member is comped', function () {
|
||||
it('returns announcement if visibility is set to paid and paid_members and member is comped', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['paid_members'],
|
||||
@ -91,5 +91,44 @@ describe('AnnouncementBarSettings', function () {
|
||||
announcement_background: 'dark'
|
||||
});
|
||||
});
|
||||
|
||||
it('returns announcement if visibility is set to paid_members and member is comped', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['paid_members'],
|
||||
announcement_background: 'dark'
|
||||
}, {
|
||||
status: 'comped'
|
||||
}, {
|
||||
announcement: 'Hello world',
|
||||
announcement_background: 'dark'
|
||||
});
|
||||
});
|
||||
|
||||
it('does not return announcement if visibility is set to paid_members and there is no members', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['paid_members'],
|
||||
announcement_background: 'dark'
|
||||
}, undefined, undefined);
|
||||
});
|
||||
|
||||
it('does not return announcement if visibility is set to paid_members and member is free', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['paid_members'],
|
||||
announcement_background: 'dark'
|
||||
}, {
|
||||
status: 'free'
|
||||
}, undefined);
|
||||
});
|
||||
|
||||
it('does not return announcement if visibility is set to free_members && paid_member and there is no member', function () {
|
||||
testVisibility({
|
||||
announcement: 'Hello world',
|
||||
announcement_visibility: ['free_members', 'paid_members'],
|
||||
announcement_background: 'dark'
|
||||
}, undefined, undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user