Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update draft deploy #702

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/management/ActionsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ class ActionsManager {
* @param {object} params Action parameters.
* @param {string} params.id Action ID.
* @param {string} params.version_id Action ID.
* @param {boolean} params.update_draft Update draft
* @param {Function} [cb] Callback function.
* @returns {Promise|undefined}
*/
Expand All @@ -542,11 +543,18 @@ class ActionsManager {
delete params.action_id;
}

const body = {};

if (params.update_draft) {
body.update_draft = params.update_draft;
delete params.update_draft;
}

if (cb && cb instanceof Function) {
return this.actionVersionDeploy.create(params, {}, cb);
return this.actionVersionDeploy.create(params, body, cb);
}

return this.actionVersionDeploy.create(params, {});
return this.actionVersionDeploy.create(params, body);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/management/actions.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ describe('ActionsManager', () => {
it('should perform a post request', function (done) {
const { request } = this;

this.actions.deployVersion({ action_id, version_id }).then(() => {
this.actions.deployVersion({ action_id, version_id, update_draft: true }).then(() => {
expect(request.isDone()).to.be.true;

done();
Expand Down