Skip to content

Commit 9291dc0

Browse files
authored
Merge pull request #478 from topcoder-platform/revert-470-3496_search_by_manager
Revert "#3496 Includes non-customer roles when searching projects by manager."
2 parents 254b635 + a7d77cf commit 9291dc0

File tree

3 files changed

+2
-42
lines changed

3 files changed

+2
-42
lines changed

src/constants.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,6 @@ export const PROJECT_MEMBER_MANAGER_ROLES = [
4242
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
4343
];
4444

45-
export const PROJECT_MEMBER_NON_CUSTOMER_ROLES = [
46-
PROJECT_MEMBER_ROLE.MANAGER,
47-
PROJECT_MEMBER_ROLE.COPILOT,
48-
PROJECT_MEMBER_ROLE.ACCOUNT_MANAGER,
49-
PROJECT_MEMBER_ROLE.ACCOUNT_EXECUTIVE,
50-
PROJECT_MEMBER_ROLE.PROJECT_MANAGER,
51-
PROJECT_MEMBER_ROLE.PROGRAM_MANAGER,
52-
PROJECT_MEMBER_ROLE.SOLUTION_ARCHITECT,
53-
];
54-
5545
export const USER_ROLE = {
5646
TOPCODER_ADMIN: 'administrator',
5747
MANAGER: 'Connect Manager',

src/routes/projects/list.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import _ from 'lodash';
55
import config from 'config';
66

77
import models from '../../models';
8-
import { MANAGER_ROLES, INVITE_STATUS, PROJECT_MEMBER_NON_CUSTOMER_ROLES } from '../../constants';
8+
import { MANAGER_ROLES, INVITE_STATUS } from '../../constants';
99
import util from '../../util';
1010

1111
const ES_PROJECT_INDEX = config.get('elasticsearchConfig.indexName');
@@ -228,14 +228,13 @@ const buildEsQueryWithFilter = (value, keyword, matchType, fieldName) => {
228228
}
229229

230230
if (value === 'customer' || value === 'manager') {
231-
const roles = value === 'customer' ? [value] : PROJECT_MEMBER_NON_CUSTOMER_ROLES;
232231
should = _.concat(should, {
233232
nested: {
234233
path: 'members',
235234
query: {
236235
bool: {
237236
must: [
238-
{ terms: { 'members.role': roles } },
237+
{ match: { 'members.role': value } },
239238
{
240239
query_string: {
241240
query: keyword,

src/routes/projects/list.spec.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ const data = [
9393
userId: 40051332,
9494
projectId: 2,
9595
role: 'copilot',
96-
firstName: 'copi',
97-
lastName: 'lott',
98-
handle: 'tolipoc',
9996
isPrimary: true,
10097
createdBy: 1,
10198
updatedBy: 1,
@@ -210,9 +207,6 @@ describe('LIST Project', () => {
210207
userId: 40051332,
211208
projectId: project2.id,
212209
role: 'copilot',
213-
firstName: 'copi',
214-
lastName: 'lott',
215-
handle: 'tolipoc',
216210
isPrimary: true,
217211
createdBy: 1,
218212
updatedBy: 1,
@@ -735,29 +729,6 @@ describe('LIST Project', () => {
735729
});
736730
});
737731

738-
it('should return all projects that match when filtering by manager, searching on any non-customer role', (done) => {
739-
request(server)
740-
.get('/v5/projects/?manager=copi*')
741-
.set({
742-
Authorization: `Bearer ${testUtil.jwts.admin}`,
743-
})
744-
.expect('Content-Type', /json/)
745-
.expect(200)
746-
.end((err, res) => {
747-
if (err) {
748-
done(err);
749-
} else {
750-
const resJson = res.body;
751-
should.exist(resJson);
752-
resJson.should.have.lengthOf(1);
753-
resJson[0].name.should.equal('test2');
754-
resJson[0].members.should.have.deep.property('[0].role', 'copilot');
755-
resJson[0].members[0].userId.should.equal(40051332);
756-
done();
757-
}
758-
});
759-
});
760-
761732
it('should return list of projects ordered ascending by lastActivityAt when sort column is "lastActivityAt"', (done) => {
762733
request(server)
763734
.get('/v5/projects/?sort=lastActivityAt')

0 commit comments

Comments
 (0)