mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
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:
parent
82ed10473b
commit
5d5b77d32f
@ -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;
|
||||
|
@ -54,10 +54,8 @@ describe('Importer', function () {
|
||||
});
|
||||
membersApiStub = {
|
||||
productRepository: {
|
||||
list: async () => {
|
||||
return {
|
||||
data: [defaultProduct]
|
||||
};
|
||||
getDefaultProduct: async () => {
|
||||
return defaultProduct;
|
||||
}
|
||||
},
|
||||
members: {
|
||||
|
Loading…
Reference in New Issue
Block a user