Skip to content
代码片段 群组 项目
提交 dfa8233b 编辑于 作者: Phil Hughes's avatar Phil Hughes 提交者: Igor Drozdov
浏览文件

Fixes the ability to filter target branch by not equal

This fixes the target branch filter in merge requests to allow
the user to filter by not equal.
上级 f71c1719
No related branches found
No related tags found
无相关合并请求
......@@ -66,6 +66,11 @@ def filter_items(_items)
by_source_project_id(items)
end
def filter_negated_items(items)
items = super(items)
by_negated_target_branch(items)
end
private
def by_commit(items)
......@@ -98,6 +103,14 @@ def by_target_branch(items)
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def by_negated_target_branch(items)
return items unless not_params[:target_branch]
items.where.not(target_branch: not_params[:target_branch])
end
# rubocop: enable CodeReuse/ActiveRecord
def source_project_id
@source_project_id ||= params[:source_project_id].presence
end
......
---
title: Fixed target branch not filtering
merge_request: 45652
author:
type: fixed
......@@ -44,4 +44,14 @@
expect(page).not_to have_content mr2.title
end
end
context 'filtering by target-branch:!=master' do
it 'applies the filter' do
input_filtered_search('target-branch:!=master')
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
expect(page).not_to have_content mr1.title
expect(page).to have_content mr2.title
end
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册