Fixed comped tier assignment

closes https://github.com/TryGhost/Team/issues/1869

- When there were "archived" tiers in the system the importer incorrectly fetched them instead of only taking "active" ones into account. The "getDefaultProduct" on product repository does exactly that.
- Additionally, reusing the "getDefaultProduct" makes testing the importer slightly less complex.
This commit is contained in:
Naz 2022-10-20 15:02:27 +08:00
parent 82ed10473b
commit 5d5b77d32f
No known key found for this signature in database
2 changed files with 3 additions and 10 deletions

View File

@ -109,12 +109,7 @@ module.exports = class MembersCSVImporter {
const membersApi = await this._getMembersApi();
const defaultProductPage = await membersApi.productRepository.list({
filter: 'type:paid',
limit: 1
});
const defaultProduct = defaultProductPage.data[0];
const defaultProduct = await membersApi.productRepository.getDefaultProduct();
const result = await rows.reduce(async (resultPromise, row) => {
const resultAccumulator = await resultPromise;

View File

@ -54,10 +54,8 @@ describe('Importer', function () {
});
membersApiStub = {
productRepository: {
list: async () => {
return {
data: [defaultProduct]
};
getDefaultProduct: async () => {
return defaultProduct;
}
},
members: {