Skip to content
Snippets Groups Projects
Verified Commit 001a5234 authored by Phil Hughes's avatar Phil Hughes Committed by GitLab
Browse files

Merge branch 'ph/vueMergeRequestListAuthorNegated' into 'master'

Added negated author filter to Vue merge request list

See merge request !171248



Merged-by: default avatarPhil Hughes <me@iamphill.com>
Approved-by: default avatarmo khan <mo@mokhan.ca>
Approved-by: default avatarMarina Mosti <mmosti@gitlab.com>
Approved-by: default avatarNatalia Tepluhina <ntepluhina@gitlab.com>
Reviewed-by: default avatarMarina Mosti <mmosti@gitlab.com>
parents 9dc2410e 617d4faf
No related branches found
No related tags found
1 merge request!171248Added negated author filter to Vue merge request list
Pipeline #1527878373 passed
...@@ -285,7 +285,6 @@ export default { ...@@ -285,7 +285,6 @@ export default {
token: UserToken, token: UserToken,
dataType: 'user', dataType: 'user',
defaultUsers: [], defaultUsers: [],
operators: OPERATORS_IS,
fullPath: this.fullPath, fullPath: this.fullPath,
isProject: true, isProject: true,
recentSuggestionsStorageKey: `${this.fullPath}-merge-requests-recent-tokens-author`, recentSuggestionsStorageKey: `${this.fullPath}-merge-requests-recent-tokens-author`,
......
...@@ -160,6 +160,9 @@ def self.accept_reviewer ...@@ -160,6 +160,9 @@ def self.accept_reviewer
as: :assignee_username, as: :assignee_username,
required: false, required: false,
description: 'Filters merge requests to exclude any that are assigned to the usernames in the given array.' description: 'Filters merge requests to exclude any that are assigned to the usernames in the given array.'
argument :author_username, GraphQL::Types::String,
required: false,
description: 'Filters merge requests to exclude any that are authored by the given user.'
argument :labels, [GraphQL::Types::String], argument :labels, [GraphQL::Types::String],
required: false, required: false,
as: :label_name, as: :label_name,
......
...@@ -43232,6 +43232,7 @@ Defines which user roles, users, or groups can merge into a protected branch. ...@@ -43232,6 +43232,7 @@ Defines which user roles, users, or groups can merge into a protected branch.
| ---- | ---- | ----------- | | ---- | ---- | ----------- |
| <a id="mergerequestsresolvernegatedparamsapprovedby"></a>`approvedBy` | [`[String!]`](#string) | Filters merge requests to exclude any that are approved by usernames in the given array. | | <a id="mergerequestsresolvernegatedparamsapprovedby"></a>`approvedBy` | [`[String!]`](#string) | Filters merge requests to exclude any that are approved by usernames in the given array. |
| <a id="mergerequestsresolvernegatedparamsassigneeusernames"></a>`assigneeUsernames` | [`[String!]`](#string) | Filters merge requests to exclude any that are assigned to the usernames in the given array. | | <a id="mergerequestsresolvernegatedparamsassigneeusernames"></a>`assigneeUsernames` | [`[String!]`](#string) | Filters merge requests to exclude any that are assigned to the usernames in the given array. |
| <a id="mergerequestsresolvernegatedparamsauthorusername"></a>`authorUsername` | [`String`](#string) | Filters merge requests to exclude any that are authored by the given user. |
| <a id="mergerequestsresolvernegatedparamslabels"></a>`labels` | [`[String!]`](#string) | Filters merge requests to exclude any that have the labels provided in the given array. | | <a id="mergerequestsresolvernegatedparamslabels"></a>`labels` | [`[String!]`](#string) | Filters merge requests to exclude any that have the labels provided in the given array. |
| <a id="mergerequestsresolvernegatedparamsmilestonetitle"></a>`milestoneTitle` | [`String`](#string) | Filters merge requests to those not in the given milestone. | | <a id="mergerequestsresolvernegatedparamsmilestonetitle"></a>`milestoneTitle` | [`String`](#string) | Filters merge requests to those not in the given milestone. |
| <a id="mergerequestsresolvernegatedparamsmyreactionemoji"></a>`myReactionEmoji` | [`String`](#string) | Filters merge requests to those without the given reaction from the authenticated user. | | <a id="mergerequestsresolvernegatedparamsmyreactionemoji"></a>`myReactionEmoji` | [`String`](#string) | Filters merge requests to those without the given reaction from the authenticated user. |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Merge Requests > User filters by author', :js, feature_category: :code_review_workflow do
include FilteredSearchHelpers
let_it_be(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
before do
create(:merge_request, author: user, title: 'Bugfix1', source_project: project, source_branch: 'bugfix1')
create(:merge_request, author: create(:user), title: 'Bugfix2', source_project: project, source_branch: 'bugfix2')
sign_in(user)
visit project_merge_requests_path(project)
end
context 'when filtering by author=@username' do
it 'applies the filter' do
select_tokens 'Author', '=', user.username, submit: true
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix1'
expect(page).not_to have_content 'Bugfix2'
end
end
context 'when filtering by author!=@username' do
it 'applies the filter' do
select_tokens 'Author', '!=', user.username, submit: true
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).to have_content 'Bugfix2'
expect(page).not_to have_content 'Bugfix1'
end
end
end
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
describe 'filtering by text, author, assignee, milestone, and label' do describe 'filtering by text, author, assignee, milestone, and label' do
it 'filters by text, author, assignee, milestone, and label' do it 'filters by text, author, assignee, milestone, and label' do
select_tokens 'Author', user.username, 'Assignee', '=', user.username, 'Milestone', milestone.title, 'Label', '=', wontfix.title select_tokens 'Author', '=', user.username, 'Assignee', '=', user.username, 'Milestone', milestone.title, 'Label', '=', wontfix.title
send_keys 'Bug', :enter, :enter send_keys 'Bug', :enter, :enter
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
......
...@@ -133,6 +133,17 @@ ...@@ -133,6 +133,17 @@
end end
end end
context 'with negated author argument' do
let_it_be(:author) { current_user }
let_it_be(:different_author_mr) { create(:merge_request, **common_attrs, author: create(:user)) }
it 'excludes merge requests with given author from selection' do
result = resolve_mr(project, not: { author_username: author.username })
expect(result).to contain_exactly(different_author_mr)
end
end
context 'with source branches argument' do context 'with source branches argument' do
it 'takes one argument' do it 'takes one argument' do
result = resolve_mr(project, source_branches: [merge_request_3.source_branch]) result = resolve_mr(project, source_branches: [merge_request_3.source_branch])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment