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 { ...@@ -354,7 +354,7 @@ export default {
return INCIDENT_SEVERITY[severity]; return INCIDENT_SEVERITY[severity];
}, },
handleFilterIncidents(filters) { handleFilterIncidents(filters) {
const filterParams = { authorUsername: '', assigneeUsername: [], search: '' }; const filterParams = { authorUsername: '', assigneeUsername: '', search: '' };
filters.forEach(filter => { filters.forEach(filter => {
if (typeof filter === 'object') { if (typeof filter === 'object') {
...@@ -363,7 +363,7 @@ export default { ...@@ -363,7 +363,7 @@ export default {
filterParams.authorUsername = filter.value.data; filterParams.authorUsername = filter.value.data;
break; break;
case 'assignee_username': case 'assignee_username':
filterParams.assigneeUsername.push(filter.value.data); filterParams.assigneeUsername = filter.value.data;
break; break;
case 'filtered-search-term': case 'filtered-search-term':
if (filter.value.data !== '') filterParams.search = filter.value.data; if (filter.value.data !== '') filterParams.search = filter.value.data;
......
...@@ -3,7 +3,7 @@ query getIncidentsCountByStatus( ...@@ -3,7 +3,7 @@ query getIncidentsCountByStatus(
$projectPath: ID! $projectPath: ID!
$issueTypes: [IssueType!] $issueTypes: [IssueType!]
$authorUsername: String = "" $authorUsername: String = ""
$assigneeUsernames: [String!] = [] $assigneeUsernames: String = ""
) { ) {
project(fullPath: $projectPath) { project(fullPath: $projectPath) {
issueStatusCounts( issueStatusCounts(
......
...@@ -11,7 +11,7 @@ query getIncidents( ...@@ -11,7 +11,7 @@ query getIncidents(
$nextPageCursor: String = "" $nextPageCursor: String = ""
$searchTerm: String = "" $searchTerm: String = ""
$authorUsername: String = "" $authorUsername: String = ""
$assigneeUsernames: [String!] = [] $assigneeUsernames: String = ""
) { ) {
project(fullPath: $projectPath) { project(fullPath: $projectPath) {
issues( issues(
......
...@@ -21,7 +21,7 @@ module IssueResolverArguments ...@@ -21,7 +21,7 @@ module IssueResolverArguments
argument :author_username, GraphQL::STRING_TYPE, argument :author_username, GraphQL::STRING_TYPE,
required: false, required: false,
description: 'Username of the author of the issue' description: 'Username of the author of the issue'
argument :assignee_username, [GraphQL::STRING_TYPE], argument :assignee_username, GraphQL::STRING_TYPE,
required: false, required: false,
description: 'Username of a user assigned to the issue' description: 'Username of a user assigned to the issue'
argument :assignee_id, GraphQL::STRING_TYPE, argument :assignee_id, GraphQL::STRING_TYPE,
......
...@@ -6803,7 +6803,7 @@ type Group { ...@@ -6803,7 +6803,7 @@ type Group {
""" """
Username of a user assigned to the issue Username of a user assigned to the issue
""" """
assigneeUsername: [String!] assigneeUsername: String
""" """
Username of the author of the issue Username of the author of the issue
...@@ -12283,7 +12283,7 @@ type Project { ...@@ -12283,7 +12283,7 @@ type Project {
""" """
Username of a user assigned to the issue Username of a user assigned to the issue
""" """
assigneeUsername: [String!] assigneeUsername: String
""" """
Username of the author of the issue Username of the author of the issue
...@@ -12378,7 +12378,7 @@ type Project { ...@@ -12378,7 +12378,7 @@ type Project {
""" """
Username of a user assigned to the issue Username of a user assigned to the issue
""" """
assigneeUsername: [String!] assigneeUsername: String
""" """
Username of the author of the issue Username of the author of the issue
...@@ -12463,7 +12463,7 @@ type Project { ...@@ -12463,7 +12463,7 @@ type Project {
""" """
Username of a user assigned to the issue Username of a user assigned to the issue
""" """
assigneeUsername: [String!] assigneeUsername: String
""" """
Username of the author of the issue Username of the author of the issue
......
...@@ -18905,17 +18905,9 @@ ...@@ -18905,17 +18905,9 @@
"name": "assigneeUsername", "name": "assigneeUsername",
"description": "Username of a user assigned to the issue", "description": "Username of a user assigned to the issue",
"type": { "type": {
"kind": "LIST", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}, },
"defaultValue": null "defaultValue": null
}, },
...@@ -36505,17 +36497,9 @@ ...@@ -36505,17 +36497,9 @@
"name": "assigneeUsername", "name": "assigneeUsername",
"description": "Username of a user assigned to the issue", "description": "Username of a user assigned to the issue",
"type": { "type": {
"kind": "LIST", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}, },
"defaultValue": null "defaultValue": null
}, },
...@@ -36734,17 +36718,9 @@ ...@@ -36734,17 +36718,9 @@
"name": "assigneeUsername", "name": "assigneeUsername",
"description": "Username of a user assigned to the issue", "description": "Username of a user assigned to the issue",
"type": { "type": {
"kind": "LIST", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}, },
"defaultValue": null "defaultValue": null
}, },
...@@ -36929,17 +36905,9 @@ ...@@ -36929,17 +36905,9 @@
"name": "assigneeUsername", "name": "assigneeUsername",
"description": "Username of a user assigned to the issue", "description": "Username of a user assigned to the issue",
"type": { "type": {
"kind": "LIST", "kind": "SCALAR",
"name": null, "name": "String",
"ofType": { "ofType": null
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
}
}, },
"defaultValue": null "defaultValue": null
}, },
...@@ -380,7 +380,7 @@ describe('Incidents List', () => { ...@@ -380,7 +380,7 @@ describe('Incidents List', () => {
wrapper.vm.handleFilterIncidents(mockFilters); wrapper.vm.handleFilterIncidents(mockFilters);
expect(wrapper.vm.authorUsername).toBe('root'); 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); expect(wrapper.vm.searchTerm).toBe(mockFilters[2].value.data);
}); });
......
...@@ -54,13 +54,6 @@ RSpec.describe Resolvers::IssuesResolver do ...@@ -54,13 +54,6 @@ RSpec.describe Resolvers::IssuesResolver do
expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_ANY)).to contain_exactly(issue2) expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_ANY)).to contain_exactly(issue2)
end 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 it 'filters by no assignee' do
expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_NONE)).to contain_exactly(issue1) expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_NONE)).to contain_exactly(issue1)
end 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