From 89d2dca4b88eaf8dd34554e0fbff8aa3818d3b1a Mon Sep 17 00:00:00 2001 From: Vladyslav Smolianets <74509296+Just-Web-Developer@users.noreply.github.com> Date: Wed, 31 May 2023 00:18:23 +0300 Subject: [PATCH 1/2] Update jira.js Fix of function "getUsers" for api version 2 --- src/jira.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/jira.js b/src/jira.js index 9844d0d3..ef710c17 100644 --- a/src/jira.js +++ b/src/jira.js @@ -829,10 +829,11 @@ export default class JiraApi { */ getUsers(startAt = 0, maxResults = 100) { return this.doRequest(this.makeRequestHeader(this.makeUri({ - pathname: '/users', + pathname: this.apiVersion === '2' ? '/user/search' : '/users', query: { startAt, maxResults, + ...(this.apiVersion === '2' ? {username: '.', includeInactive: 'true'} : {}) }, }))); } From 0ac019317a67c5fb648159f03fe0dd5946718bf5 Mon Sep 17 00:00:00 2001 From: Vladyslav Smolianets <74509296+Just-Web-Developer@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:22:37 +0200 Subject: [PATCH 2/2] Update jira.js Added "local" an additional parameter that would indicate whether the request sent to a local Jira or not. --- src/jira.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jira.js b/src/jira.js index ef710c17..ac960b91 100644 --- a/src/jira.js +++ b/src/jira.js @@ -827,13 +827,13 @@ export default class JiraApi { * @param {integer} [startAt=0] - The index of the first user to return (0-based) * @param {integer} [maxResults=50] - The maximum number of users to return (defaults to 50). */ - getUsers(startAt = 0, maxResults = 100) { + getUsers(startAt = 0, maxResults = 100, local = false) { return this.doRequest(this.makeRequestHeader(this.makeUri({ - pathname: this.apiVersion === '2' ? '/user/search' : '/users', + pathname: this.apiVersion === '2' && local ? '/user/search' : '/users', query: { startAt, maxResults, - ...(this.apiVersion === '2' ? {username: '.', includeInactive: 'true'} : {}) + ...(this.apiVersion === '2' && local ? {username: '.', includeInactive: 'true'} : {}) }, }))); }