mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Fixed auto-generated label not being attached to members during import
no issue - label was being created and returned in the response OK but it was missing from the set of labels that get added to members during import
This commit is contained in:
parent
1f776e138f
commit
14c6968388
@ -434,6 +434,8 @@ const members = {
|
|||||||
const name = `Import ${moment().tz(siteTimezone).format('YYYY-MM-DD HH:mm')}`;
|
const name = `Import ${moment().tz(siteTimezone).format('YYYY-MM-DD HH:mm')}`;
|
||||||
const result = await findOrCreateLabels([{name}], frame.options);
|
const result = await findOrCreateLabels([{name}], frame.options);
|
||||||
importLabel = result[0] && result[0].toJSON();
|
importLabel = result[0] && result[0].toJSON();
|
||||||
|
|
||||||
|
importSetLabels.push(importLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve().then(() => {
|
return Promise.resolve().then(() => {
|
||||||
|
@ -339,6 +339,21 @@ describe('Members API', function () {
|
|||||||
jsonResponse.meta.stats.imported.count.should.equal(2);
|
jsonResponse.meta.stats.imported.count.should.equal(2);
|
||||||
jsonResponse.meta.stats.invalid.count.should.equal(0);
|
jsonResponse.meta.stats.invalid.count.should.equal(0);
|
||||||
jsonResponse.meta.import_label.name.should.match(/^Import \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/);
|
jsonResponse.meta.import_label.name.should.match(/^Import \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/);
|
||||||
|
|
||||||
|
return jsonResponse.meta.import_label;
|
||||||
|
}).then((importLabel) => {
|
||||||
|
// check that members had the auto-generated label attached
|
||||||
|
return request.get(localUtils.API.getApiQuery(`members/?filter=label:${importLabel.slug}`))
|
||||||
|
.set('Origin', config.get('url'))
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||||
|
.expect(200)
|
||||||
|
.then((res) => {
|
||||||
|
const jsonResponse = res.body;
|
||||||
|
should.exist(jsonResponse);
|
||||||
|
should.exist(jsonResponse.members);
|
||||||
|
jsonResponse.members.should.have.length(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user