0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Renamed members import/export endpoints to match API changes

refs 5f00619d1a
This commit is contained in:
Nazar Gargol 2020-06-16 18:13:06 +12:00
parent 736ca84c20
commit fca6d3300d
3 changed files with 8 additions and 8 deletions

View file

@ -39,7 +39,7 @@ export default ModalComponent.extend({
closeDisabled: computed.reads('uploading'), closeDisabled: computed.reads('uploading'),
uploadUrl: computed(function () { uploadUrl: computed(function () {
return `${ghostPaths().apiRoot}/members/csv/`; return `${ghostPaths().apiRoot}/members/upload/`;
}), }),
importDisabled: computed('file', 'validationErrors', function () { importDisabled: computed('file', 'validationErrors', function () {

View file

@ -128,7 +128,7 @@ export default class MembersController extends Controller {
@action @action
exportData() { exportData() {
let exportUrl = ghostPaths().url.api('members/csv'); let exportUrl = ghostPaths().url.api('members/upload');
let downloadURL = `${exportUrl}?limit=all`; let downloadURL = `${exportUrl}?limit=all`;
let iframe = document.getElementById('iframeDownload'); let iframe = document.getElementById('iframeDownload');

View file

@ -17,13 +17,13 @@ const notificationsStub = Service.extend({
}); });
const stubSuccessfulUpload = function (server, delay = 0) { const stubSuccessfulUpload = function (server, delay = 0) {
server.post('/ghost/api/v3/admin/members/csv/', function () { server.post('/ghost/api/v3/admin/members/upload/', function () {
return [200, {'Content-Type': 'application/json'}, '{"url":"/content/images/test.png"}']; return [200, {'Content-Type': 'application/json'}, '{"url":"/content/images/test.png"}'];
}, delay); }, delay);
}; };
const stubFailedUpload = function (server, code, error, delay = 0) { const stubFailedUpload = function (server, code, error, delay = 0) {
server.post('/ghost/api/v3/admin/members/csv/', function () { server.post('/ghost/api/v3/admin/members/upload/', function () {
return [code, {'Content-Type': 'application/json'}, JSON.stringify({ return [code, {'Content-Type': 'application/json'}, JSON.stringify({
errors: [{ errors: [{
type: error, type: error,
@ -40,7 +40,7 @@ describe('Integration: Component: modal-import-members-test', function () {
beforeEach(function () { beforeEach(function () {
server = new Pretender(); server = new Pretender();
this.set('uploadUrl', '/ghost/api/v3/admin/members/csv/'); this.set('uploadUrl', '/ghost/api/v3/admin/members/upload/');
this.owner.register('service:notifications', notificationsStub); this.owner.register('service:notifications', notificationsStub);
}); });
@ -71,7 +71,7 @@ describe('Integration: Component: modal-import-members-test', function () {
await click('.gh-btn-green'); await click('.gh-btn-green');
expect(server.handledRequests.length).to.equal(1); expect(server.handledRequests.length).to.equal(1);
expect(server.handledRequests[0].url).to.equal('/ghost/api/v3/admin/members/csv/'); expect(server.handledRequests[0].url).to.equal('/ghost/api/v3/admin/members/upload/');
}); });
it('displays server error', async function () { it('displays server error', async function () {
@ -95,7 +95,7 @@ describe('Integration: Component: modal-import-members-test', function () {
}); });
it('handles file too large error directly from the web server', async function () { it('handles file too large error directly from the web server', async function () {
server.post('/ghost/api/v3/admin/members/csv/', function () { server.post('/ghost/api/v3/admin/members/upload/', function () {
return [413, {}, '']; return [413, {}, ''];
}); });
await render(hbs`{{modal-import-members}}`); await render(hbs`{{modal-import-members}}`);
@ -117,7 +117,7 @@ describe('Integration: Component: modal-import-members-test', function () {
}); });
it('handles unknown failure', async function () { it('handles unknown failure', async function () {
server.post('/ghost/api/v3/admin/members/csv/', function () { server.post('/ghost/api/v3/admin/members/upload/', function () {
return [500, {'Content-Type': 'application/json'}, '']; return [500, {'Content-Type': 'application/json'}, ''];
}); });
await render(hbs`{{modal-import-members}}`); await render(hbs`{{modal-import-members}}`);