Merged heads/v5.22.8 into main

This commit is contained in:
Ghost CI 2022-11-07 16:13:43 +00:00
commit 92c3d1e933
6 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ghost-admin", "name": "ghost-admin",
"version": "5.22.7", "version": "5.22.8",
"description": "Ember.js admin client for Ghost", "description": "Ember.js admin client for Ghost",
"author": "Ghost Foundation", "author": "Ghost Foundation",
"homepage": "http://ghost.org", "homepage": "http://ghost.org",

View File

@ -62,6 +62,6 @@ module.exports = class FeedbackRepository {
} }
async getPostById(id) { async getPostById(id) {
return await this.#Post.findOne({id}); return await this.#Post.findOne({id, status: 'all'});
} }
}; };

View File

@ -40,7 +40,7 @@ class MemberAttributionServiceWrapper {
Integration: models.Integration Integration: models.Integration
}, },
attributionBuilder: this.attributionBuilder, attributionBuilder: this.attributionBuilder,
isTrackingEnabled: !!settingsCache.get('members_track_sources') getTrackingEnabled: () => !!settingsCache.get('members_track_sources')
}); });
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "ghost", "name": "ghost",
"version": "5.22.7", "version": "5.22.8",
"description": "The professional publishing platform", "description": "The professional publishing platform",
"author": "Ghost Foundation", "author": "Ghost Foundation",
"homepage": "https://ghost.org", "homepage": "https://ghost.org",

View File

@ -5,15 +5,19 @@ class MemberAttributionService {
* *
* @param {Object} deps * @param {Object} deps
* @param {Object} deps.attributionBuilder * @param {Object} deps.attributionBuilder
* @param {boolean} deps.isTrackingEnabled
* @param {Object} deps.models * @param {Object} deps.models
* @param {Object} deps.models.MemberCreatedEvent * @param {Object} deps.models.MemberCreatedEvent
* @param {Object} deps.models.SubscriptionCreatedEvent * @param {Object} deps.models.SubscriptionCreatedEvent
* @param {() => boolean} deps.getTrackingEnabled
*/ */
constructor({attributionBuilder, models, isTrackingEnabled}) { constructor({attributionBuilder, models, getTrackingEnabled}) {
this.models = models; this.models = models;
this.attributionBuilder = attributionBuilder; this.attributionBuilder = attributionBuilder;
this.isTrackingEnabled = isTrackingEnabled; this._getTrackingEnabled = getTrackingEnabled;
}
get isTrackingEnabled() {
return this._getTrackingEnabled();
} }
/** /**

View File

@ -13,7 +13,7 @@ describe('MemberAttributionService', function () {
describe('getAttributionFromContext', function () { describe('getAttributionFromContext', function () {
it('returns null if no context is provided', async function () { it('returns null if no context is provided', async function () {
const service = new MemberAttributionService({ const service = new MemberAttributionService({
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const attribution = await service.getAttributionFromContext(); const attribution = await service.getAttributionFromContext();
@ -31,7 +31,7 @@ describe('MemberAttributionService', function () {
it('returns attribution for importer context', async function () { it('returns attribution for importer context', async function () {
const service = new MemberAttributionService({ const service = new MemberAttributionService({
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const attribution = await service.getAttributionFromContext({importer: true}); const attribution = await service.getAttributionFromContext({importer: true});
@ -40,7 +40,7 @@ describe('MemberAttributionService', function () {
it('returns attribution for admin context', async function () { it('returns attribution for admin context', async function () {
const service = new MemberAttributionService({ const service = new MemberAttributionService({
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const attribution = await service.getAttributionFromContext({user: 'abc'}); const attribution = await service.getAttributionFromContext({user: 'abc'});
@ -49,7 +49,7 @@ describe('MemberAttributionService', function () {
it('returns attribution for api without integration context', async function () { it('returns attribution for api without integration context', async function () {
const service = new MemberAttributionService({ const service = new MemberAttributionService({
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const attribution = await service.getAttributionFromContext({ const attribution = await service.getAttributionFromContext({
api_key: 'abc' api_key: 'abc'
@ -69,7 +69,7 @@ describe('MemberAttributionService', function () {
} }
} }
}, },
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const attribution = await service.getAttributionFromContext({ const attribution = await service.getAttributionFromContext({
api_key: 'abc', api_key: 'abc',
@ -96,7 +96,7 @@ describe('MemberAttributionService', function () {
}; };
} }
}, },
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const model = { const model = {
id: 'event_id', id: 'event_id',
@ -130,7 +130,7 @@ describe('MemberAttributionService', function () {
}; };
} }
}, },
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const model = { const model = {
id: 'event_id', id: 'event_id',
@ -170,7 +170,7 @@ describe('MemberAttributionService', function () {
}; };
} }
}, },
isTrackingEnabled: true getTrackingEnabled: () => true
}); });
const model = { const model = {
id: 'event_id', id: 'event_id',