Skip to content

Commit f0e40c1

Browse files
author
himaniraghav3
committed
PM-1068 refactor: allow PMs to view all copilot requests
1 parent 9ba39a3 commit f0e40c1

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/routes/copilotRequest/list.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import _ from 'lodash';
22

33
import models from '../../models';
4-
import { ADMIN_ROLES } from '../../constants';
54
import util from '../../util';
65
import { PERMISSION } from '../../permissions/constants';
76

@@ -16,9 +15,6 @@ module.exports = [
1615
return next(err);
1716
}
1817

19-
const isAdmin = util.hasRoles(req, ADMIN_ROLES);
20-
21-
const userId = req.authUser.userId;
2218
const projectId = _.parseInt(req.params.projectId);
2319

2420
let sort = req.query.sort ? decodeURIComponent(req.query.sort) : 'createdAt desc';
@@ -31,11 +27,7 @@ module.exports = [
3127
}
3228
const sortParams = sort.split(' ');
3329

34-
// Admin can see all requests and the PM can only see requests created by them
35-
const whereCondition = _.assign({},
36-
isAdmin ? {} : { createdBy: userId },
37-
projectId ? { projectId } : {},
38-
);
30+
const whereCondition = projectId ? { projectId } : {};
3931

4032
return models.CopilotRequest.findAll({
4133
where: whereCondition,

0 commit comments

Comments
 (0)