Skip to content

Commit 3e2fd60

Browse files
committed
fixed wrong worklog filters
1 parent 290e456 commit 3e2fd60

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

controllers/jiraAPIController.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ exports.getIssueTypes = async function(req) {
276276

277277
async function searchIssuesWithWorkLogsInternal(req, start, end) {
278278
const url = getCallURL(req);
279-
const jql = `worklogDate >= "${start}" AND worklogDate <= "${end}"`;
279+
const jql = `worklogDate >= "${start}" AND worklogDate <= "${end}" AND worklogAuthor = currentUser()`;
280280
return fetch(url + '/rest/api/2/search', {
281281
method: 'POST',
282282
headers: getDefaultHeaders(req),

controllers/jiraController.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ exports.getUsersWorkLogsAsEvent = async function(req, start, end) {
8787
comment: worklog.comment,
8888
author: worklog.author.emailAddress
8989
};
90-
});
90+
}).filter(worklog => filterWorklog(req, worklog, filterStartTime, filterEndTime));
9191
return acc.concat(issueWorklogs);
9292
}, []);
9393

@@ -136,10 +136,10 @@ function filterWorklog(req, worklog, filterStartTime, filterEndTime) {
136136
let condition = startTime.getTime() > filterStartTime.getTime() && startTime.getTime() < filterEndTime.getTime();
137137

138138
if (process.env.JIRA_BASIC_AUTH_USERNAME) {
139-
condition = condition && worklog.author.emailAddress == process.env.JIRA_BASIC_AUTH_USERNAME;
139+
condition = condition && worklog.author == process.env.JIRA_BASIC_AUTH_USERNAME;
140140
}
141141
if (process.env.JIRA_AUTH_TYPE == "OAUTH") {
142-
condition = condition && worklog.author.emailAddress == req.user.email;
142+
condition = condition && worklog.author == req.user.email;
143143
}
144144

145145
return condition;

0 commit comments

Comments
 (0)