Commit 4464fe7c authored by David O'Regan's avatar David O'Regan

Limit incident assignees to single

Drop username assignees in GraphQL
to single assignee to enable a safe
API and limit incident list
parent 9e72553a
......@@ -354,7 +354,7 @@ export default {
return INCIDENT_SEVERITY[severity];
},
handleFilterIncidents(filters) {
const filterParams = { authorUsername: '', assigneeUsername: [], search: '' };
const filterParams = { authorUsername: '', assigneeUsername: '', search: '' };
filters.forEach(filter => {
if (typeof filter === 'object') {
......@@ -363,7 +363,7 @@ export default {
filterParams.authorUsername = filter.value.data;
break;
case 'assignee_username':
filterParams.assigneeUsername.push(filter.value.data);
filterParams.assigneeUsername = filter.value.data;
break;
case 'filtered-search-term':
if (filter.value.data !== '') filterParams.search = filter.value.data;
......
......@@ -3,7 +3,7 @@ query getIncidentsCountByStatus(
$projectPath: ID!
$issueTypes: [IssueType!]
$authorUsername: String = ""
$assigneeUsernames: [String!] = []
$assigneeUsernames: String = ""
) {
project(fullPath: $projectPath) {
issueStatusCounts(
......
......@@ -11,7 +11,7 @@ query getIncidents(
$nextPageCursor: String = ""
$searchTerm: String = ""
$authorUsername: String = ""
$assigneeUsernames: [String!] = []
$assigneeUsernames: String = ""
) {
project(fullPath: $projectPath) {
issues(
......
......@@ -21,7 +21,7 @@ module IssueResolverArguments
argument :author_username, GraphQL::STRING_TYPE,
required: false,
description: 'Username of the author of the issue'
argument :assignee_username, [GraphQL::STRING_TYPE],
argument :assignee_username, GraphQL::STRING_TYPE,
required: false,
description: 'Username of a user assigned to the issue'
argument :assignee_id, GraphQL::STRING_TYPE,
......
......@@ -6803,7 +6803,7 @@ type Group {
"""
Username of a user assigned to the issue
"""
assigneeUsername: [String!]
assigneeUsername: String
"""
Username of the author of the issue
......@@ -12283,7 +12283,7 @@ type Project {
"""
Username of a user assigned to the issue
"""
assigneeUsername: [String!]
assigneeUsername: String
"""
Username of the author of the issue
......@@ -12378,7 +12378,7 @@ type Project {
"""
Username of a user assigned to the issue
"""
assigneeUsername: [String!]
assigneeUsername: String
"""
Username of the author of the issue
......@@ -12463,7 +12463,7 @@ type Project {
"""
Username of a user assigned to the issue
"""
assigneeUsername: [String!]
assigneeUsername: String
"""
Username of the author of the issue
......
......@@ -18905,17 +18905,9 @@
"name": "assigneeUsername",
"description": "Username of a user assigned to the issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
......@@ -36505,17 +36497,9 @@
"name": "assigneeUsername",
"description": "Username of a user assigned to the issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
......@@ -36734,17 +36718,9 @@
"name": "assigneeUsername",
"description": "Username of a user assigned to the issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
......@@ -36929,17 +36905,9 @@
"name": "assigneeUsername",
"description": "Username of a user assigned to the issue",
"type": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
......@@ -380,7 +380,7 @@ describe('Incidents List', () => {
wrapper.vm.handleFilterIncidents(mockFilters);
expect(wrapper.vm.authorUsername).toBe('root');
expect(wrapper.vm.assigneeUsernames).toEqual(['root2']);
expect(wrapper.vm.assigneeUsernames).toEqual('root2');
expect(wrapper.vm.searchTerm).toBe(mockFilters[2].value.data);
});
......
......@@ -54,13 +54,6 @@ RSpec.describe Resolvers::IssuesResolver do
expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_ANY)).to contain_exactly(issue2)
end
it 'filters by two assignees' do
user_2 = create(:user)
issue2.update!(assignees: [assignee, user_2])
expect(resolve_issues(assignee_id: [assignee.id, user_2.id])).to contain_exactly(issue2)
end
it 'filters by no assignee' do
expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_NONE)).to contain_exactly(issue1)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment