diff options
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/filtered_search/filtered_search_token_keys.js | 17 | ||||
-rw-r--r-- | app/assets/javascripts/pages/groups/issues/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/issues/index/index.js | 2 | ||||
-rw-r--r-- | app/controllers/concerns/issuable_collections.rb | 1 | ||||
-rw-r--r-- | app/finders/issues_finder.rb | 11 | ||||
-rw-r--r-- | app/models/issue.rb | 1 | ||||
-rw-r--r-- | app/views/shared/issuable/_search_bar.html.haml | 8 | ||||
-rw-r--r-- | changelogs/unreleased/filter-confidential-issues.yml | 5 | ||||
-rw-r--r-- | doc/api/issues.md | 7 | ||||
-rw-r--r-- | lib/api/issues.rb | 1 | ||||
-rw-r--r-- | spec/controllers/concerns/issuable_collections_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/issues/filtered_search/dropdown_hint_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/issues/filtered_search/search_bar_spec.rb | 2 | ||||
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 28 | ||||
-rw-r--r-- | spec/models/issue_spec.rb | 9 | ||||
-rw-r--r-- | spec/requests/api/issues_spec.rb | 36 |
17 files changed, 5 insertions, 145 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js index 4d05f46ed17..57ec6603d80 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js +++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js @@ -96,11 +96,6 @@ export default class FilteredSearchDropdownManager { gl: DropdownNonUser, element: this.container.querySelector('#js-dropdown-wip'), }, - confidential: { - reference: null, - gl: DropdownNonUser, - element: this.container.querySelector('#js-dropdown-confidential'), - }, status: { reference: null, gl: NullDropdown, diff --git a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js index 48534bdf815..b70da240833 100644 --- a/app/assets/javascripts/filtered_search/filtered_search_token_keys.js +++ b/app/assets/javascripts/filtered_search/filtered_search_token_keys.js @@ -72,23 +72,6 @@ export default class FilteredSearchTokenKeys { ); } - addExtraTokensForIssues() { - const confidentialToken = { - key: 'confidential', - type: 'string', - param: '', - symbol: '', - icon: 'eye-slash', - tag: 'Yes or No', - lowercaseValueOnSubmit: true, - uppercaseTokenName: false, - capitalizeTokenValue: true, - }; - - this.tokenKeys.push(confidentialToken); - this.tokenKeysWithAlternative.push(confidentialToken); - } - addExtraTokensForMergeRequests() { const wipToken = { key: 'wip', diff --git a/app/assets/javascripts/pages/groups/issues/index.js b/app/assets/javascripts/pages/groups/issues/index.js index 21ec3f9f9ba..736c6a62610 100644 --- a/app/assets/javascripts/pages/groups/issues/index.js +++ b/app/assets/javascripts/pages/groups/issues/index.js @@ -4,8 +4,6 @@ import { FILTERED_SEARCH } from '~/pages/constants'; import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; document.addEventListener('DOMContentLoaded', () => { - IssuableFilteredSearchTokenKeys.addExtraTokensForIssues(); - initFilteredSearch({ page: FILTERED_SEARCH.ISSUES, isGroupDecendent: true, diff --git a/app/assets/javascripts/pages/projects/issues/index/index.js b/app/assets/javascripts/pages/projects/issues/index/index.js index bb91e38cb64..a56c0bb6be8 100644 --- a/app/assets/javascripts/pages/projects/issues/index/index.js +++ b/app/assets/javascripts/pages/projects/issues/index/index.js @@ -9,8 +9,6 @@ import { FILTERED_SEARCH } from '~/pages/constants'; import { ISSUABLE_INDEX } from '~/pages/projects/constants'; document.addEventListener('DOMContentLoaded', () => { - IssuableFilteredSearchTokenKeys.addExtraTokensForIssues(); - initFilteredSearch({ page: FILTERED_SEARCH.ISSUES, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index c529aabf797..07d0bf16d93 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -91,7 +91,6 @@ module IssuableCollections options = { scope: params[:scope], state: params[:state], - confidential: Gitlab::Utils.to_boolean(params[:confidential]), sort: set_sort_order } diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index cb44575d6f1..a0504ca0879 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -69,16 +69,7 @@ class IssuesFinder < IssuableFinder end def filter_items(items) - issues = super - issues = by_due_date(issues) - issues = by_confidential(issues) - issues - end - - def by_confidential(items) - return items if params[:confidential].nil? - - params[:confidential] ? items.confidential_only : items.public_only + by_due_date(super) end def by_due_date(items) diff --git a/app/models/issue.rb b/app/models/issue.rb index 0b46e949052..182c5d3d4b0 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -66,7 +66,6 @@ class Issue < ActiveRecord::Base scope :preload_associations, -> { preload(:labels, project: :namespace) } scope :public_only, -> { where(confidential: false) } - scope :confidential_only, -> { where(confidential: true) } after_save :expire_etag_cache after_save :ensure_metrics, unless: :imported? diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index bdba47ed14d..588659c7e9c 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -128,14 +128,6 @@ %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } } %button.btn.btn-link{ type: 'button' } = _('No') - #js-dropdown-confidential.filtered-search-input-dropdown-menu.dropdown-menu - %ul.filter-dropdown{ data: { dropdown: true } } - %li.filter-dropdown-item{ data: { value: 'yes', capitalize: true } } - %button.btn.btn-link{ type: 'button' } - = _('Yes') - %li.filter-dropdown-item{ data: { value: 'no', capitalize: true } } - %button.btn.btn-link{ type: 'button' } - = _('No') = render_if_exists 'shared/issuable/filter_weight', type: type diff --git a/changelogs/unreleased/filter-confidential-issues.yml b/changelogs/unreleased/filter-confidential-issues.yml deleted file mode 100644 index 83f19a57aab..00000000000 --- a/changelogs/unreleased/filter-confidential-issues.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Ability to filter confidential issues -merge_request: 24960 -author: Robert Schilling -type: added diff --git a/doc/api/issues.md b/doc/api/issues.md index d8b2ff07e30..27ae54da316 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -32,7 +32,6 @@ GET /issues?author_id=5 GET /issues?assignee_id=5 GET /issues?my_reaction_emoji=star GET /issues?search=foo&in=title -GET /issues?confidential=true ``` | Attribute | Type | Required | Description | @@ -53,7 +52,6 @@ GET /issues?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time | | `updated_after` | datetime | no | Return issues updated on or after the given time | | `updated_before` | datetime | no | Return issues updated on or before the given time | -| `confidential ` | Boolean | no | Filter confidential or public issues. | ```bash curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/issues @@ -150,7 +148,6 @@ GET /groups/:id/issues?search=issue+title+or+description GET /groups/:id/issues?author_id=5 GET /groups/:id/issues?assignee_id=5 GET /groups/:id/issues?my_reaction_emoji=star -GET /groups/:id/issues?confidential=true ``` | Attribute | Type | Required | Description | @@ -171,7 +168,6 @@ GET /groups/:id/issues?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time | | `updated_after` | datetime | no | Return issues updated on or after the given time | | `updated_before` | datetime | no | Return issues updated on or before the given time | -| `confidential ` | Boolean | no | Filter confidential or public issues. | ```bash curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/4/issues @@ -268,7 +264,6 @@ GET /projects/:id/issues?search=issue+title+or+description GET /projects/:id/issues?author_id=5 GET /projects/:id/issues?assignee_id=5 GET /projects/:id/issues?my_reaction_emoji=star -GET /projects/:id/issues?confidential=true ``` | Attribute | Type | Required | Description | @@ -289,8 +284,6 @@ GET /projects/:id/issues?confidential=true | `created_before` | datetime | no | Return issues created on or before the given time | | `updated_after` | datetime | no | Return issues updated on or after the given time | | `updated_before` | datetime | no | Return issues updated on or before the given time | -| `confidential ` | Boolean | no | Filter confidential or public issues. | - ```bash curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues diff --git a/lib/api/issues.rb b/lib/api/issues.rb index f43f4d961d6..94ed9ac6fb1 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -54,7 +54,6 @@ module API optional :scope, type: String, values: %w[created-by-me assigned-to-me created_by_me assigned_to_me all], desc: 'Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`' optional :my_reaction_emoji, type: String, desc: 'Return issues reacted by the authenticated user by the given emoji' - optional :confidential, type: Boolean, desc: 'Filter confidential or public issues' use :pagination use :issues_params_ee diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb index 8580900215c..307c5d60c57 100644 --- a/spec/controllers/concerns/issuable_collections_spec.rb +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -112,8 +112,7 @@ describe IssuableCollections do assignee_username: 'user1', author_id: '2', author_username: 'user2', - authorized_only: 'yes', - confidential: true, + authorized_only: 'true', due_date: '2017-01-01', group_id: '3', iids: '4', @@ -141,7 +140,6 @@ describe IssuableCollections do 'assignee_username' => 'user1', 'author_id' => '2', 'author_username' => 'user2', - 'confidential' => true, 'label_name' => 'foo', 'milestone_title' => 'bar', 'my_reaction_emoji' => 'thumbsup', diff --git a/spec/features/issues/filtered_search/dropdown_hint_spec.rb b/spec/features/issues/filtered_search/dropdown_hint_spec.rb index 096756f19cc..0e296ab2109 100644 --- a/spec/features/issues/filtered_search/dropdown_hint_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_hint_spec.rb @@ -66,7 +66,7 @@ describe 'Dropdown hint', :js do it 'filters with text' do filtered_search.set('a') - expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 5) + expect(find(js_dropdown_hint)).to have_selector('.filter-dropdown .filter-dropdown-item', count: 4) end end @@ -119,15 +119,6 @@ describe 'Dropdown hint', :js do expect_tokens([{ name: 'my-reaction' }]) expect_filtered_search_input_empty end - - it 'opens the yes-no dropdown when you click on confidential' do - click_hint('confidential') - - expect(page).to have_css(js_dropdown_hint, visible: false) - expect(page).to have_css('#js-dropdown-confidential', visible: true) - expect_tokens([{ name: 'confidential' }]) - expect_filtered_search_input_empty - end end describe 'selecting from dropdown with some input' do diff --git a/spec/features/issues/filtered_search/search_bar_spec.rb b/spec/features/issues/filtered_search/search_bar_spec.rb index c4468922883..8abab3f35d6 100644 --- a/spec/features/issues/filtered_search/search_bar_spec.rb +++ b/spec/features/issues/filtered_search/search_bar_spec.rb @@ -100,7 +100,7 @@ describe 'Search bar', :js do find('.filtered-search-box .clear-search').click filtered_search.click - expect(find('#js-dropdown-hint')).to have_selector('.filter-dropdown .filter-dropdown-item', count: 6) + expect(find('#js-dropdown-hint')).to have_selector('.filter-dropdown .filter-dropdown-item', count: 5) expect(get_left_style(find('#js-dropdown-hint')['style'])).to eq(hint_offset) end end diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 47e2548c3d6..fe8000e419b 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -490,32 +490,6 @@ describe IssuesFinder do end end - context 'filtering by confidential' do - set(:confidential_issue) { create(:issue, project: project1, confidential: true) } - - context 'no filtering' do - it 'returns all issues' do - expect(issues).to contain_exactly(issue1, issue2, issue3, issue4, confidential_issue) - end - end - - context 'user filters confidential issues' do - let(:params) { { confidential: true } } - - it 'returns only confdential issues' do - expect(issues).to contain_exactly(confidential_issue) - end - end - - context 'user filters only public issues' do - let(:params) { { confidential: false } } - - it 'returns only confdential issues' do - expect(issues).to contain_exactly(issue1, issue2, issue3, issue4) - end - end - end - context 'when the user is unauthorized' do let(:search_user) { nil } @@ -582,7 +556,7 @@ describe IssuesFinder do it 'returns the number of rows for the default state' do finder = described_class.new(user) - expect(finder.row_count).to eq(5) + expect(finder.row_count).to eq(4) end it 'returns the number of rows for a given state' do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 6101df2e099..5d18e085a6f 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -765,15 +765,6 @@ describe Issue do end end - describe '.confidential_only' do - it 'only returns confidential_only issues' do - create(:issue) - confidential_issue = create(:issue, confidential: true) - - expect(described_class.confidential_only).to eq([confidential_issue]) - end - end - it_behaves_like 'throttled touch' do subject { create(:issue, updated_at: 1.hour.ago) } end diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 1a4be2bd30f..d10ee6cc320 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -183,18 +183,6 @@ describe API::Issues do expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id]) end - it 'returns only confidential issues' do - get api('/issues', user), params: { confidential: true, scope: 'all' } - - expect_paginated_array_response(confidential_issue.id) - end - - it 'returns only public issues' do - get api('/issues', user), params: { confidential: false } - - expect_paginated_array_response([issue.id, closed_issue.id]) - end - it 'returns issues reacted by the authenticated user' do issue2 = create(:issue, project: project, author: user, assignees: [user]) create(:award_emoji, awardable: issue2, user: user2, name: 'star') @@ -569,18 +557,6 @@ describe API::Issues do expect_paginated_array_response([group_confidential_issue.id, group_issue.id]) end - it 'returns only confidential issues' do - get api(base_url, user), params: { confidential: true } - - expect_paginated_array_response(group_confidential_issue.id) - end - - it 'returns only public issues' do - get api(base_url, user), params: { confidential: false } - - expect_paginated_array_response([group_closed_issue.id, group_issue.id]) - end - it 'returns an array of labeled group issues' do get api(base_url, user), params: { labels: group_label.title } @@ -806,18 +782,6 @@ describe API::Issues do expect_paginated_array_response([issue.id, confidential_issue.id, closed_issue.id]) end - it 'returns only confidential issues' do - get api("#{base_url}/issues", author), params: { confidential: true } - - expect_paginated_array_response(confidential_issue.id) - end - - it 'returns only public issues' do - get api("#{base_url}/issues", author), params: { confidential: false } - - expect_paginated_array_response([issue.id, closed_issue.id]) - end - it 'returns project confidential issues for assignee' do get api("#{base_url}/issues", assignee) |