diff --git a/src/jira.js b/src/jira.js index 60e0bb80..5640d33b 100644 --- a/src/jira.js +++ b/src/jira.js @@ -992,11 +992,17 @@ export default class JiraApi { * @param {object} worklog - worklog object from the rest API * @param {object} newEstimate - the new value for the remaining estimate field */ - addWorklog(issueId, worklog, newEstimate) { + addWorklog(issueId, worklog, newEstimate = null) { + const query = { adjustEstimate: 'auto' }; + if (newEstimate) { + query.adjustEstimate = 'new'; + query.newEstimate = newEstimate; + } + const header = { uri: this.makeUri({ pathname: `/issue/${issueId}/worklog`, - query: { adjustEstimate: 'new', newEstimate }, + query, }), body: worklog, method: 'POST',