Skip to content

Commit

Permalink
Now using fetch-retry for unstable connections. Fixed a bug where ano…
Browse files Browse the repository at this point in the history
…ther user's worklogs would show on oauth authentication
  • Loading branch information
J2-Tech committed Mar 25, 2024
1 parent 6ae989b commit 4e28b3f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/jiraAPIController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fetch = require('node-fetch');
const fetch = require('@adobe/node-fetch-retry');
const https = require('https');

function getDefaultHeaders(req) {
Expand Down
3 changes: 3 additions & 0 deletions controllers/jiraController.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ exports.getUsersWorkLogsAsEvent = function(req, start, end) {
if (process.env.JIRA_BASIC_AUTH_USERNAME) {
condition = condition && worklog.author.emailAddress == process.env.JIRA_BASIC_AUTH_USERNAME;
}
if (process.env.JIRA_AUTH_TYPE =="OAUTH") {
condition = condition && worklog.author.emailAddress == req.user.email;
}
return condition;
})
.map(worklog => {
Expand Down
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"start": "node ./bin/www"
},
"dependencies": {
"@adobe/node-fetch-retry": "^2.2.0",
"cookie-parser": "~1.4.4",
"dayjs": "^1.11.10",
"debug": "~2.6.9",
Expand Down

0 comments on commit 4e28b3f

Please sign in to comment.